Repository navigation
Fix FastAPI router-level authentication detection - #73
Merged
haydenschmitty merged 1 commit intoNov 15, 2026
Merged
haydenschmitty merged 1 commit into
haydenschmitty merged 1 commit into
Conversation
spacecampkatie
marked this pull request as ready for review
November 3, 2026 17:59
7 tasks done
haydenschmitty
added a commit
that referenced
this pull request
Nov 15, 2026
#73's bracket walker finds where APIRouter(...) ends without stopping at brackets in strings or comments, but the dependencies were then read from the raw text, so a commented-out `# Depends(require_login)` or a description mentioning one protected every route of the router. The walker now blanks comments and string contents in what it returns. Near-miss tests for both and for a router whose brackets never close; the test's comment names no real project. Changelog line and tests table row.
Owner
|
Merged and released in 0.10.0, on top of 0.9.0's FastAPI work. I also made it ignore checks that only appear in a comment or a string inside the router. Thank you! Update with |
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.
FastAPI endpoints protected by
APIRouter(dependencies=[...])can be reported as open. The constructor regex stops at the first nested), only the first dependency is examined, and the bareauthenticatename is not recognized.Read balanced constructor/list expressions, consider every dependency (including
Security), and recognizeauthenticate/authorize. Database-only dependencies still do not count as authentication, and guards stay scoped to their router.Validation:
npm test— 203 passed, 1 platform-specific skip. Added a regression covering shared read/write protection, database-before-guard order, nested factories, qualified names, delimiter-containing strings/comments, and genuinely open sibling routers.