Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/aleph/vm/orchestrator/views/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,19 @@
signed_operation = get_signed_operation(request)
if signed_operation.content.domain != settings.DOMAIN_NAME:
logger.debug(f"Invalid domain '{signed_operation.content.domain}' != '{settings.DOMAIN_NAME}'")
raise web.HTTPUnauthorized(reason="Invalid domain")
raise web.HTTPUnauthorized(
reason=f"Invalid domain: Signed: '{signed_operation.content.domain}' != Request: '{settings.DOMAIN_NAME}'"
)
if signed_operation.content.path != request.path:
logger.debug(f"Invalid path '{signed_operation.content.path}' != '{request.path}'")
raise web.HTTPUnauthorized(reason="Invalid path")
raise web.HTTPUnauthorized(

Check warning on line 242 in src/aleph/vm/orchestrator/views/authentication.py

View check run for this annotation

Codecov / codecov/patch

src/aleph/vm/orchestrator/views/authentication.py#L242

Added line #L242 was not covered by tests
reason=f"Invalid path. Signed: '{signed_operation.content.path}' != requested path: '{request.path}'"
)
if signed_operation.content.method != request.method:
logger.debug(f"Invalid method '{signed_operation.content.method}' != '{request.method}'")
raise web.HTTPUnauthorized(reason="Invalid method")
raise web.HTTPUnauthorized(

Check warning on line 247 in src/aleph/vm/orchestrator/views/authentication.py

View check run for this annotation

Codecov / codecov/patch

src/aleph/vm/orchestrator/views/authentication.py#L247

Added line #L247 was not covered by tests
reason=f"Invalid method. Signed: '{signed_operation.content.method}' != request:'{request.method}"
)
return verify_signed_operation(signed_operation, signed_pubkey)


Expand Down
2 changes: 1 addition & 1 deletion tests/supervisor/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def view(request, authenticated_sender):
assert resp.status == 401, await resp.text()

r = await resp.json()
assert {"error": "Invalid domain"} == r
assert {"error": "Invalid domain: Signed: 'baddomain' != Request: 'localhost'"} == r


@pytest.mark.asyncio
Expand Down
Loading