Repository navigation
route_auth_map: read NestJS controllers, guards and global guards - #2419
Closed
remigiusz-antczak wants to merge 2 commits into
Closed
remigiusz-antczak wants to merge 2 commits into
remigiusz-antczak wants to merge 2 commits into
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. On a read-only NestJS monorepo clone the --all inventory went from 2 to 560 routes. Tests: 14/14 (test_route_auth_nestjs), route-auth-map.sh green Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc
Widen the stale MUTANTS rows so each old text occurs exactly once in the script: the brace-walk decrement, the RCV new-prefix group, the analyze call that now passes glob, and the HIGH rule that now exempts HEAD and OPTIONS. Tests: all route-auth-map suites pass Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc
Collaborator
Author
|
Superseded by #2421 (same change, one squashed commit on current main). |
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.
Summary
route_auth_map.pynow reads NestJS controllers. Before this change, a NestJS service showed almost no routes, so unauthenticated mutating handlers in NestJS apps were invisible to the route-auth check.@Controller('prefix' | { path })plus@Get/@Post/@Put/@Patch/@Delete/@All/@Head/@Options('path' | ['a', 'b'])members become inventoried routes (METHOD /prefix/path). A constant path reads{?}.@UseGuards(X)on the member or the class counts as auth evidence. A rate-limit guard (Throttler*,RateLimit*) does not, unless its name also says Auth, Jwt, Session, Role or Permission.@Public()-style decorator readsauth=public.auth=none(HIGH), as for the other frameworks. When the scanned tree wires a non-rate-limitAPP_GUARDoruseGlobalGuards(), it reads "global guard, unverified" (INFO) instead.Tests
scripts/test_route_auth_nestjs.py: 14/14. It uses fictional fixtures with clean twins for a controller guard, a global auth guard versus a throttler-only global guard, and@Publicunder a global guard.scripts/ci-tests.d/route-auth-map.sh: green.--allinventory went from 2 to 560 routes.🤖 Generated with Claude Code
https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc