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

fix: drop invalid three-legged flow detection; treat all tokens as two-legged

parent 35768f96
Loading
Loading
Loading
Loading
Loading
+44 −0
Changes for .cursor/hook-logs/audit.jsonl: 44 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -131,3 +131,47 @@
{"attachments_count":1,"event":"beforeSubmitPrompt","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","prompt_length":19,"prompt_preview":"set it true for now","timestamp":"2026-10-01T10:41:05.803Z"}
{"attachments_count":1,"event":"beforeSubmitPrompt","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","prompt_length":20,"prompt_preview":"can we change this ?","timestamp":"2026-10-01T10:41:24.777Z"}
{"edits_count":2,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/helm/oop-platform-chart/values.yaml","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-01T10:41:30.393Z"}
{"attachments_count":1,"event":"beforeSubmitPrompt","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","prompt_length":3765,"prompt_preview":"Repo: open-exposure-gateway (Python/FastAPI), branch feat/keycloak. Do NOT git add/commit. CONTEXT Reviewer: the token \"flow\" detection is invalid. tokens.py marks a token THREE_LEGGED if it has `auth_time`, but every interactive portal log...","timestamp":"2026-10-02T07:44:26.157Z"}
{"edits_count":4,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/core/auth/tokens.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:13.885Z"}
{"edits_count":23,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/core/authorization.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:25.562Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/dependencies.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:25.899Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/dependencies.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:27.275Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/dependencies.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:28.829Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/quality_on_demand/v0_10_1/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:29.445Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/dependencies.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:30.285Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:30.674Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/quality_on_demand/v0_10_1/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:32.163Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/location_retrieval/v0_5_0/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:32.175Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:33.219Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/location_retrieval/v0_5_0/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:33.805Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/api/camara/location_retrieval/v0_5_0/router.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:35.383Z"}
{"edits_count":4,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/src/open_exposure_gateway/application/services/location_retrieval_service.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:38.510Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/test_core_auth.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:44.885Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/test_core_auth.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:45:48.987Z"}
{"edits_count":24,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/test_authorization.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:00.757Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/conftest.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:01.804Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/conftest.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:05.647Z"}
{"edits_count":6,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/unit/test_location_retrieval_flows.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:10.293Z"}
{"edits_count":4,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/conformance/test_location_retrieval_conformance.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:14.227Z"}
{"edits_count":1,"event":"afterFileEdit","file_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway/tests/conformance/conftest.py","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","timestamp":"2026-10-02T07:46:15.237Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests || true","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:18.952Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests || true","duration_ms":6450.734,"event":"afterShellExecution","output_length":1487,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:25.458Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests --include='*.py' --include='*.yaml' --include='*.yml' || true","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:29.100Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests --include='*.py' --include='*.yaml' --include='*.yml' || true","duration_ms":5812.155,"event":"afterShellExecution","output_length":0,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:34.972Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 pytest tests/unit tests/conformance -q 2\u003e\u00261","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:37.856Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 mypy src 2\u003e\u00261 \u0026\u0026 ruff check src tests 2\u003e\u00261","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:37.883Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 mypy src 2\u003e\u00261 \u0026\u0026 ruff check src tests 2\u003e\u00261","duration_ms":6538.034,"event":"afterShellExecution","output_length":712,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:44.462Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 pytest tests/unit tests/conformance -q 2\u003e\u00261","duration_ms":7451.615,"event":"afterShellExecution","output_length":233,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:45.349Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 ls -la .venv venv 2\u003e/dev/null; which poetry uv 2\u003e/dev/null; head -n 80 pyproject.toml 2\u003e/dev/null | head -80; ls Makefile* justfile* 2\u003e/dev/null; cat .python-version 2\u003e/dev/null","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:50.577Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 ls -la .venv venv 2\u003e/dev/null; which poetry uv 2\u003e/dev/null; head -n 80 pyproject.toml 2\u003e/dev/null | head -80; ls Makefile* justfile* 2\u003e/dev/null; cat .python-version 2\u003e/dev/null","duration_ms":5718.822,"event":"afterShellExecution","output_length":2567,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:46:56.332Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/pytest tests/unit tests/conformance -q 2\u003e\u00261","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:47:00.068Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/mypy src 2\u003e\u00261; .venv/bin/ruff check src tests 2\u003e\u00261","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:47:00.882Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/mypy src 2\u003e\u00261; .venv/bin/ruff check src tests 2\u003e\u00261","duration_ms":7616.706,"event":"afterShellExecution","output_length":1418,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:47:08.547Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/pytest tests/unit tests/conformance -q 2\u003e\u00261","duration_ms":171477.122,"event":"afterShellExecution","output_length":10761,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:49:51.592Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/ruff check --fix tests/unit/test_location_retrieval_flows.py 2\u003e\u00261 \u0026\u0026 .venv/bin/ruff check src tests 2\u003e\u00261 \u0026\u0026 .venv/bin/pytest tests/unit tests/conformance/test_location_retrieval_conformance.py -q 2\u003e\u00261","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:49:56.321Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/ruff check --fix tests/unit/test_location_retrieval_flows.py 2\u003e\u00261 \u0026\u0026 .venv/bin/ruff check src tests 2\u003e\u00261 \u0026\u0026 .venv/bin/pytest tests/unit tests/conformance/test_location_retrieval_conformance.py -q 2\u003e\u00261","duration_ms":31743.915,"event":"afterShellExecution","output_length":1140,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:50:28.106Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/mypy src 2\u003e\u00261 \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests --include='*.py' --include='*.yaml' || echo \"(no matches)\"","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:50:31.561Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 .venv/bin/mypy src 2\u003e\u00261 \u0026\u0026 grep -rn \"TokenFlow\\|three_legged\\|subject_id\\|_device_from_subject\\|\\.flow\\b\" src tests --include='*.py' --include='*.yaml' || echo \"(no matches)\"","duration_ms":7092.881,"event":"afterShellExecution","output_length":57,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:50:38.698Z"}
{"attachments_count":1,"event":"beforeSubmitPrompt","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","prompt_length":33,"prompt_preview":"give me a commit message for this","timestamp":"2026-10-02T07:51:42.473Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 git log -8 --oneline \u0026\u0026 echo '---' \u0026\u0026 git diff --stat HEAD","cwd":"","event":"beforeShellExecution","project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:51:51.180Z"}
{"command":"cd /home/gpapathan/Desktop/etsi/open-exposure-gateway \u0026\u0026 git log -8 --oneline \u0026\u0026 echo '---' \u0026\u0026 git diff --stat HEAD","duration_ms":6199.456,"event":"afterShellExecution","output_length":1528,"project_name":"open-exposure-gateway","project_path":"/home/gpapathan/Desktop/etsi/open-exposure-gateway","sandbox":true,"timestamp":"2026-10-02T07:51:57.434Z"}
+1 −2
Changes for src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ from open_exposure_gateway.application.services.edge_application_management_serv
from open_exposure_gateway.core.authorization import (
    require_role,
    require_scope,
    require_three_legged,
)
from open_exposure_gateway.core.exceptions import (
    AbortedException,
@@ -50,7 +49,7 @@ BASE_PATH = "/edge-application-management/v0.1alpha1"

router = APIRouter(
    prefix=BASE_PATH,
    dependencies=[Depends(require_role), Depends(require_three_legged), Depends(require_scope)],
    dependencies=[Depends(require_role), Depends(require_scope)],
)

EdgeAppService = Annotated[EdgeApplicationManagementService, Depends(get_edge_app_service)]
+1 −3
Changes for src/open_exposure_gateway/api/camara/location_retrieval/v0_5_0/router.py: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ from open_exposure_gateway.application.services.location_retrieval_service impor
from open_exposure_gateway.core.authorization import (
    require_role,
    require_scope,
    require_three_legged,
)
from open_exposure_gateway.core.exceptions import (
    BadRequestException,
@@ -37,7 +36,7 @@ BASE_PATH = "/location-retrieval/v0.5"

router = APIRouter(
    prefix=BASE_PATH,
    dependencies=[Depends(require_role), Depends(require_three_legged), Depends(require_scope)],
    dependencies=[Depends(require_role), Depends(require_scope)],
)

LocationService = Annotated[LocationRetrievalService, Depends(get_location_retrieval_service)]
@@ -83,6 +82,5 @@ async def retrieve_location(
    return await service.retrieve_location(
        request=request,
        app_provider_id=caller.app_provider_id,
        subject_id=caller.subject_id,
        x_correlator=caller.x_correlator,
    )
+1 −2
Changes for src/open_exposure_gateway/api/camara/quality_on_demand/v0_10_1/router.py: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@ from open_exposure_gateway.application.services.quality_on_demand_service import
from open_exposure_gateway.core.authorization import (
    require_role,
    require_scope,
    require_three_legged,
)
from open_exposure_gateway.core.exceptions import (
    BadRequestException,
@@ -33,7 +32,7 @@ BASE_PATH = "/qod/v0"

router = APIRouter(
    prefix=BASE_PATH,
    dependencies=[Depends(require_role), Depends(require_three_legged), Depends(require_scope)],
    dependencies=[Depends(require_role), Depends(require_scope)],
)

QoDService = Annotated[QualityOnDemandService, Depends(get_qod_service)]
+1 −7
Changes for src/open_exposure_gateway/application/services/location_retrieval_service.py: 1 added line, 7 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ from uuid import UUID, uuid4
import structlog

from open_exposure_gateway.api.camara.location_retrieval.v0_5_0.schemas import (
    Device,
    Location,
    RetrievalLocationRequest,
)
@@ -38,10 +37,9 @@ class LocationRetrievalService:
        self,
        request: RetrievalLocationRequest,
        app_provider_id: str,
        subject_id: Optional[str] = None,
        x_correlator: Optional[str] = None,
    ) -> Location:
        device = request.device or self._device_from_subject(subject_id)
        device = request.device
        if device is None:
            raise UnprocessableEntityException(
                error_code=ErrorCode.MISSING_IDENTIFIER,
@@ -74,7 +72,3 @@ class LocationRetrievalService:
                message="SRM returned an unusable location",
                details=str(exc),
            ) from exc

    def _device_from_subject(self, subject_id: Optional[str]) -> Optional[Device]:
        # No token claim maps to a device identifier yet, so never guess one.
        return None
Loading