fix(config): close Sep 2026 Gunicorn worker-scan bypass gaps (#254–#257) - #258
Conversation
…to_thread, pool imap/starmap/apply_async Extend the static gunicorn.conf.py AST scan so import-time mutations through Thread.run(), asyncio.run(asyncio.to_thread(...)), ThreadPool.apply_async().get(), and ThreadPool imap/starmap are treated as dynamic worker assignments. This blocks memory:// rate-limit storage when those patterns can raise the real worker count across processes. Adds regression tests for the 2026-09-20 security review findings (#254-#257). Co-authored-by: Alexander Wagner <info@alexanderwagnerdev.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a271c85a-19e7-4b4a-8233-d52b68342dae) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9ef02a742
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_439f87bd-1f41-4e6f-9b3c-9acaed752ae6) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b1b902ca-a8a7-4a23-91c5-3b16bbae779c) |
|



Security review (2026-09-20)
Closes gaps in the static
gunicorn.conf.pyworker scan that allowed import-timeworkersmutations while startup still acceptedmemory://rate-limit storage.config.pyThread.run(),asyncio.run(asyncio.to_thread(...)),ThreadPool.apply_async().get(), orThreadPool imap/starmapto bumpworkersafter a staticworkers = 1assignmentmemory://)Issues
Thread.run()asyncio.to_threadapply_async().get()imap/starmapTests
Regression parametrized cases in
tests/test_gunicorn_indirect_workers_bypass.py.CI should run the full pytest suite (especially
test_gunicorn_indirect_workers_bypass.pyandtest_app.pyconfig worker detection).Note
High Risk
Changes static security analysis for Gunicorn worker count; incorrect detection could still allow cross-worker login rate-limit bypass with
memory://storage.Overview
Extends the static
gunicorn.conf.pyworker scan so more import-time execution paths are treated as dynamic (fail closed onmemory://rate-limit storage).Threading: Detects
Thread.start()andThread.run()(including class-levelthreading.Thread.run(t)), with shared logic via_thread_class_reference_is_active/_thread_call_starts_mutating_target.ThreadPool:
map-style detection now coversimap,imap_unordered, andstarmap; addsapply_async(task pluscallback/error_callback) and flagsimapiterators as risky lazy iterators when consumed. Pool callbacks can also mutate workers when they reference namespace updates (e.g.globals().update).Asyncio: Collects
asyncio/run/to_threadimport alias events and flagsasyncio.run(asyncio.to_thread(...))when the threaded target mutates workers.Regression parametrized tests in
tests/test_gunicorn_indirect_workers_bypass.pycover these bypass patterns.Reviewed by Cursor Bugbot for commit 0abfe12. Bugbot is set up for automated code reviews on this repo. Configure here.