Repository navigation
route_auth_map: inventory NestJS controllers and guards - #2421
Merged
Merged
Conversation
…Guards, global guard) A class @controller('prefix' | { path }) with @Get/@Post/@Put/@Patch/@Delete/@All/@Head/ @options('path' | ['a', 'b']) members is an inventoried route (METHOD /prefix/path); a constant path reads {?}. @UseGuards(X) on the member or the class is the auth evidence; a rate-limit guard (Throttler*, RateLimit*) is not, unless its name also says Auth, Jwt, Session, Role or Permission. A @public()-style decorator reads auth=public. An unguarded mutating route reads auth=none (HIGH) like the other frameworks; when the scanned tree wires a non-rate-limit APP_GUARD (provider object read in either key order) or useGlobalGuards(), it reads "global guard, unverified" (INFO) instead. The class-guard window stops at the previous class. New per-feature test scripts/test_route_auth_nestjs.py with fictional fixtures and clean twins, registered in scripts/ci-tests.d/route-auth-map.sh. The route-auth-map MUTANTS rows are widened so each old text occurs exactly once. On a read-only NestJS monorepo clone the --all inventory went from 2 to 560 routes. Held-out bench: recall and false positives unchanged against the pinned baseline. Tests: 14/14 (test_route_auth_nestjs), 8/8 (test_route_auth_map), route-auth-map.sh green Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc
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.
Supersedes #2419 with one squashed commit rebased on current main (the train requires one commit per PR).
What changes
route_auth_map.pynow inventories NestJS controllers:@Controllerprefixes, verb decorators,@UseGuardson member or class,@Public()-style decorators, and global guards (APP_GUARD,useGlobalGuards). Rate-limit-only guards do not count as auth. Before this change a NestJS monorepo produced 2 routes; it now produces 560.Evidence
scripts/test_route_auth_nestjs.py: 14/14, with clean twins for controller guard, global auth guard vs throttler-only guard, and@Publicunder a global guard.scripts/test_route_auth_map.py: 8/8;scripts/ci-tests.d/route-auth-map.shgreen.\bclass\bmatching, and global prefix or URI versioning not applied to paths.🤖 Generated with Claude Code
https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc