Commit f8d33f21 authored by George Papathanail's avatar George Papathanail
Browse files

fix: require https for webhook.notificationUrl

parent ae4bff0c
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for src/open_exposure_gateway/api/camara/quality_on_demand/v0_10_1/schemas.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class PortsSpec(BaseModel):


class Webhook(BaseModel):
    notificationUrl: str
    notificationUrl: str = Field(pattern=r"^https://.+$")
    notificationAuthToken: Optional[str] = Field(
        default=None, min_length=20, max_length=256, repr=False
    )
+6 −0
Changes for tests/unit/test_qod_flows.py: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -463,6 +463,12 @@ class TestQodSessionValidation:
        response = api_client.post(f"{QOD_BASE}/sessions", json=body)
        assert response.status_code == 400

    def test_http_notification_url_is_rejected(self, api_client: TestClient) -> None:
        body = {**SESSION_BODY, "webhook": {"notificationUrl": "http://client.example.com/cb"}}
        response = api_client.post(f"{QOD_BASE}/sessions", json=body)
        assert response.status_code == 400
        assert response.json()["code"] == "INVALID_ARGUMENT"

    def test_devports_with_neither_ranges_nor_ports_is_rejected(
        self, api_client: TestClient
    ) -> None: