Repository navigation
Conversation
…ant-tolerant) Three-layer remediation of the rate-limit identity bypass family: 1. Session-cookie rotation bypass (CLOSED): limiter identity recognizes EXACTLY apiKeyAuth's scheme and parse — case-sensitive 'Bearer ' prefix, single space, slice(7).trim(); both middlewares parse identically (verified byte-for-byte). Expressed as a slice(0,7) comparison: same bytes as startsWith, without the scheme-validation method call on the raw credential header that CodeQL's missing-rate-limiting model reads as an authorization operation (flagging the limiter mount itself — a limiter cannot precede itself). Every other Authorization form falls back to the request IP. End-to-end: 130 rotating-Basic session requests → 429 at 121 on ONE bucket. 2. Pre-authentication login bypass (CLOSED): the limiter cannot validate Bearer tokens (it runs before auth) and /api/auth/login authenticates by body password — login attempts ALWAYS key on the request IP. End-to-end: 130 login attempts with rotating random Bearer tokens → 429 at 121 on ONE bucket (each still 401s). 3. Route-variant bypass (CLOSED): Express's default non-strict, case-insensitive-to-route matching serves '/api/auth/login/', '/API/AUTH/LOGIN' to the same handler — the pre-auth check is a trailing-slash-and-case tolerant regex so no variant re-opens the mint. Regression drives all three variants; the bucket is the IP. Unchanged: 120/min threshold, /health + /webhooks exclusions, Redis fail-open, TTL, valid-Bearer per-token buckets on non-login paths (pinned). Deployment facts on record: no trust proxy (req.ip = socket address; forwarded headers cannot mint buckets); tunnelled traffic shares the tunnel peer's bucket (pre-existing, errs safe); invalid-Bearer Redis-key growth = TTL-bounded documented follow-up. Identity suite 14 tests + behavior suite 9 — all green. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com>
Contributor
Author
|
/gitwire run review |
Contributor
|
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
There was a problem hiding this comment.
🤖 AI Code Review — ✅ Approved
Confidence: high · Findings: 0
AI judgment: APPROVE · Evidence: COMPLETE · Authority: advisory
Evidence complete · 3/3 changed files accounted for
GitWire AI Review Gate (bundle-driven v2) · Structured schema · Scope-validated · AI recommendation — maintainers and repository policy retain authority
Contributor
Author
|
Superseded by the v5 PR: identity derivation isolated into an exported function — resolves the CodeQL model pairing with byte-identical semantics. |
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.
Final branch of the limiter identity remediation (supersedes #454 → #456 → #458; branch updates ruleset-refused). One delta from #458, plus everything prior:
The #458 CodeQL red: diagnosed and resolved
The new-alert annotation pointed at
app.js:84— the rate limiter's own mount — flagging it as "performs authorization, but is not rate-limited." Root cause: the limiter called.startsWith("Bearer ")directly on the raw credential header, and CodeQL's missing-rate-limiting model reads that shape as an authorization operation — a limiter cannot precede itself, so the finding is structural. The recognition is now expressed asauthHeader.slice(0, 7) === "Bearer "— byte-identical semantics (case-sensitive scheme, single space), without the scheme-validation method call on the credential header. Behavior unchanged; all 23 tests green.Everything prior stands
req.ip= socket address — forwarded headers cannot mint buckets); tunnelled traffic shares the tunnel peer's bucket (pre-existing, errs safe); invalid-Bearer Redis-key growth = TTL-bounded documented follow-up. Threshold, exclusions, fail-open untouched.Holding at the merge gate — exact head
a356c913e2361040519eef065ef1c66407e8cbe0.