Skip to content

fix(config): close Sep 2026 Gunicorn worker-scan bypass gaps (#254–#257) - #258

Merged
AlexanderWagnerDev merged 3 commits into
mainfrom
cursor/application-security-review-d4e4
Sep 20, 2026
Merged

AlexanderWagnerDev merged 3 commits into
mainfrom
cursor/application-security-review-d4e4

Conversation

@cursor

@cursor cursor Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Security review (2026-09-20)

Closes gaps in the static gunicorn.conf.py worker scan that allowed import-time workers mutations while startup still accepted memory:// rate-limit storage.

Severity Location Impact Remediation
Medium config.py Login rate limits can be bypassed across Gunicorn workers when config uses Thread.run(), asyncio.run(asyncio.to_thread(...)), ThreadPool.apply_async().get(), or ThreadPool imap/starmap to bump workers after a static workers = 1 assignment Treat these import-time execution paths as dynamic worker assignments (fail closed on memory://)

Issues

Tests

Regression parametrized cases in tests/test_gunicorn_indirect_workers_bypass.py.

CI should run the full pytest suite (especially test_gunicorn_indirect_workers_bypass.py and test_app.py config worker detection).

Open in Web View Automation 

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.py worker scan so more import-time execution paths are treated as dynamic (fail closed on memory:// rate-limit storage).

Threading: Detects Thread.start() and Thread.run() (including class-level threading.Thread.run(t)), with shared logic via _thread_class_reference_is_active / _thread_call_starts_mutating_target.

ThreadPool: map-style detection now covers imap, imap_unordered, and starmap; adds apply_async (task plus callback / error_callback) and flags imap iterators 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_thread import alias events and flags asyncio.run(asyncio.to_thread(...)) when the threaded target mutates workers.

Regression parametrized tests in tests/test_gunicorn_indirect_workers_bypass.py cover these bypass patterns.

Reviewed by Cursor Bugbot for commit 0abfe12. Bugbot is set up for automated code reviews on this repo. Configure here.

…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>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5aa1c85c-f421-4132-bc12-bcad251cdb75

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AlexanderWagnerDev
AlexanderWagnerDev marked this pull request as ready for review September 20, 2026 12:36
@AlexanderWagnerDev

Copy link
Copy Markdown
Contributor

@codex review

@cursor

cursor Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py
@cursor

cursor Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor

cursor Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

@sonarqubecloud

Copy link
Copy Markdown

@AlexanderWagnerDev
AlexanderWagnerDev merged commit 952249e into main Sep 20, 2026
13 checks passed
@AlexanderWagnerDev
AlexanderWagnerDev deleted the cursor/application-security-review-d4e4 branch September 20, 2026 12:59
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.

2 participants