fix: require auth on submitFeedback mutation#1385
Open
damsleth wants to merge 1 commit into
Open
Conversation
The submitFeedback resolver was undecorated, so unauthenticated POSTs to /graphql could reach GitHubService.createIssue and spam the feedback repo with our app credentials. Add @Authorized<IAuthOptions>({ requiresUserContext: true }) to match the pattern used by updateUserConfiguration and updateUserTimebank - rejects anonymous callers at the TypeGraphQL layer with UNAUTHENTICATED before any GitHub call is made.
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
submitFeedbackonUserResolverhad no@Authorizedguard, and/graphqlis a public Express route, so unauthenticated callers could invoke the mutation and spam GitHub issues on the feedback repo using our app-configured credentials.@Authorized<IAuthOptions>({ requiresUserContext: true })- matching the pattern already used onupdateUserConfigurationandupdateUserTimebank- so anonymous requests are rejected withUNAUTHENTICATEDat the TypeGraphQL layer before anyGitHubService.createIssuecall.IAuthOptionswas already imported, so no new imports are needed.server/graphql/resolvers/user/UserResolver.test.tscovering the feedback auth option shape againstauthChecker: unauthenticated rejected, authenticated accepted.Test plan
npm run lintcleannpm test- 3 new submitFeedback auth tests pass; no new uncaught exceptions introduced (the 5 pre-existing TS compile failures on unrelated test files are unchanged fromdev)grep -rn submitFeedback client/that the only client call site isclient/parts/UserFeedback/FeedbackPanel/useSubmitFeedback.ts, which lives inside the logged-in shell - no unauthenticated UI pathNon-goals