Repository navigation
[Aikido] Enforce firewall decisions at Starlette app entry point to prevent bypass - #748
Closed
aikido-autofix[bot] wants to merge 1 commit into
Closed
aikido-autofix[bot] wants to merge 1 commit into
aikido-autofix[bot] wants to merge 1 commit into
Conversation
…ed ASGI applications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch addresses a critical firewall bypass vulnerability in Starlette mounted ASGI applications where firewall decisions were not being enforced before dispatching requests to mounted or custom ASGI callables. The fix introduces a
firewall_enforcedflag that is initialized in the request context and enforced at the application entry point before any handler dispatch occurs. Changes were made toaikido_zen/context/__init__.pyto initialize the flag,aikido_zen/sources/starlette/starlette_routing.pyto enforce firewall decisions early in the request lifecycle, and corresponding test files to validate the new behavior.✅ 1 issue fixed by this PR
Starlette.__call__establishes request context and invokes onlyrequest_handler(stage="init"); the blockingpre_responsestage is reached only from the wrapper installed throughstarlette.routing.request_response. Starlette mounts and custom ASGI applications are dispatched directly as ASGI callables rather than being constructed through that route factory. Therefore, under the automatic Starlette integration, a request targeting such an application does not receive the configured firewall decision before dispatch. The separately defined ASGI middleware is not installed byprotect(), so it is not an automatic compensating boundary. This is an access-control enforcement bypass for mounted/custom ASGI handlers.