Skip to content

Conversation

@bitterpanda63
Copy link
Member

@bitterpanda63 bitterpanda63 commented Jan 14, 2026

Summary by Aikido

Security Issues: 0 πŸ” Quality Issues: 1 Resolved Issues: 0

πŸš€ New Features

  • Added InternalASGIMiddleware and wrapped uvicorn apps with it.

⚑ Enhancements

  • Introduced ASGI send interceptor and pre/post-response handling logic.
  • Extended psycopg sink to patch AsyncCursor methods for async support.
  • Added django-asgi-uvicorn end-to-end test to the CI matrix.

πŸ”§ Refactors

  • Registered 'uvicorn' as an ASGI source and reorganized imports.

More info

@bitterpanda63 bitterpanda63 changed the title add django asgi support add uvicorn context-creation support when run with gUnicorn Jan 14, 2026
@@ -0,0 +1,53 @@
# Django ASGI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document the caveats? of the limited support? e.g. https://github.com/AikidoSec/firewall-node/blob/main/docs/next.md#caveats

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no caveats, the limited support is about with which frameworks it works? not sure how I am supposed to clarify that further, is already in bold under ## Support (as in limited support)

await self.client_app(receive, send)
else:
# client_app = coroutine application(scope, receive, send)
await self.client_app(scope, receive, send)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for return here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdym, returning the value? not done for ASGI apps

Base automatically changed from create-django-asgi-app to main January 15, 2026 09:57
@bitterpanda63 bitterpanda63 force-pushed the add-django-asgi-support branch from 57eed8f to af0b50c Compare January 15, 2026 11:20

@on_import("psycopg.cursor_async", "psycopg", version_requirement="3.1.0")
def patch_async(m):
"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring in patch_async only restates that it patches psycopg.cursor_async. Replace with the rationale for the async-specific patch or remove the redundant comment.

Details

✨ AI Reasoning
​An added docstring for the newly introduced async patch function merely restates that it patches the psycopg.cursor_async module and that it's similar to the normal patch. This repeats what the code (registering AsyncCursor.copy/execute/executemany) already shows and doesn't explain why the separate async patch is needed or any design rationale. A 'why' comment or removal would be more valuable.

πŸ”§ How do I fix it?
Write comments that explain the purpose, reasoning, or business logic behind the code using words like 'because', 'so that', or 'in order to'.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants