Repository navigation
route_auth_map: NestJS review fixes (per-app guard scope, bounded decorators) - #2423
Merged
Merged
Conversation
…al guard, member Public, class keyword) HEAD/OPTIONS are exempt from HIGH only for NestJS rows; no other framework emits such rows today. A global APP_GUARD reaches only controllers of its own app: the nearest directory above marked by package.json, nest-cli.json (including each projects.*.root), main.ts or tsconfig.app.json, so a root-manifest-only monorepo is split per app. A workspace lib with its own package.json, or a nested main.ts app, is its own app and is not reached by the guard (safe direction, documented). A member @public() or @UseGuards() is read only from the decorators above the signature (a spaced `@UseGuards (X)` or a generic `@ApiBody<Foo>()` still counts as a decorator), so a call in a body or parameter list does not count, and a member @public() beats a class-level @UseGuards. The class keyword is found as a whole word. The docstring notes that setGlobalPrefix and URI versioning are not applied to paths. MUTANTS rows updated to the new texts. Tests: 22/22 (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
…et, src-scoped guard) HEAD/OPTIONS are exempt from HIGH only for NestJS rows; no other framework emits such rows today. A global APP_GUARD reaches only controllers of its own app: the nearest directory above marked by package.json, nest-cli.json (including each projects.*.root), main.ts or tsconfig.app.json, so a root-manifest-only monorepo is split per app. A workspace lib with its own package.json, or a nested main.ts app, is its own app and is not reached by the guard (safe direction, documented). A member @public() or @UseGuards() is read only from the decorators above the signature (a spaced `@UseGuards (X)` or a generic `@ApiBody<Foo>()` still counts as a decorator), so a call in a body or parameter list does not count, and a member @public() beats a class-level @UseGuards. The class keyword is found as a whole word. The docstring notes that setGlobalPrefix and URI versioning are not applied to paths. MUTANTS rows updated to the new texts. Follow-up: nested generics in decorators parse, NestJS scan state is reset per scan (a two-scan test and a MUTANTS row fail if the reset is removed), the global guard is scoped to src, and the Express/Fastify HEAD/OPTIONS assertions are restored in their own test. Tests: 27/27 (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.
Follow-up to #2421: review fixes for NestJS route-auth mapping in
route_auth_map.py.Changes
nest-cli.jsonprojects(root and sourceRoot). When there is no app manifest, the fallback is the nearest directory holdingmain.tsortsconfig.app.json. In a root-manifest monorepo, a global guard inapps/ano longer hides a missing guard inapps/b.@Public()and@UseGuards(...)are read only from the decorator run above the signature, never from the method body. The run accepts@Name (, with a space before the paren, and@Name<T>(, with a generic argument.main.tslikewise becomes its own app.Tests
scripts/test_route_auth_nestjs.py: 22/22. The new tests fail on the route_auth_map: inventory NestJS controllers and guards #2421 code. They cover:main.ts/tsconfig.app.jsonfallback@Publicinside a method bodyscripts/test_route_auth_map.py: 8/8.🤖 Generated with Claude Code
https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc