Construct TokenAuthenticator once on Handler (H-13) #114
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!114
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/token-authenticator-deps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Workstream item #19. Audit finding H-13.
handleAPIUploadWithSlugandhandleAPICreateProjecteach calledauth.NewTokenAuthenticator(h.tokens, h.users)per request — cheap, but a sign that token auth wasn't a first-class handler member. Any new token-auth call site would have re-constructed it the same way; adding the second auth path the audit flagged (e.g. webhook signing) would have required yet another bespoke construction.Changes
Handler.tokenAuth *auth.TokenAuthenticatorfield, constructed once inhandler.Newfrom the existingTokens+UsersDeps.api.goswitched fromauth.NewTokenAuthenticator(h.tokens, h.users).Xtoh.tokenAuth.X.projectServiceandcheckerwhich are also built in-constructor from existing Deps.Net diff: 5 / -5 lines.
Test plan
go test ./...passes; all existing API token tests continue to work since behavior is unchanged🤖 Generated with Claude Code