(janitor/dedupe): consolidate bot link-token signing into signed-token helper - #6718
Merged
kilo-code-bot[bot] merged 1 commit intoSep 25, 2026
Merged
Conversation
bot-identity.ts hand-rolled the HMAC-signed, time-limited token scheme that signed-token.ts already owns. Delegate create/verify to createSignedToken/verifySignedToken, removing the duplicated hmacSign, wire-format, and timing-safe verification logic.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryRefactor of Files Reviewed (1 file)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Sep 25, 2026
kilo-code-bot
Bot
deleted the
janitor/dedupe/bot-identity-signed-token
branch
September 25, 2026 15:58
This was referenced Sep 26, 2026
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
bot-identity.tshand-rolled the HMAC-signed, time-limited token scheme thatsigned-token.tsalready owns, despite a comment noting it "follows the same pattern as src/lib/integrations/oauth-state.ts" (which itself delegates tosigned-token.ts).Finding
Classification: Shared behavior
signed-token.tsis the authoritative owner of thebase64url(JSON({...payload, iat, nonce})).HMAC-SHA256signed-token concept, with seven call sites already delegating to it (oauth-state,linear-link-state,linear-link-token,github-link-state,github-link-token,device-auth-viewer-token, plus gitlab/google oauth-state viacreateOAuthState).bot-identity.tswas the lone straggler re-implementing the identical scheme:hmacSign— byte-for-byte identical tosigned-token.ts's privatehmacSigncreateLinkToken— duplicated theiat/nonceinjection and wire formatverifyLinkToken— duplicated dot-split,timingSafeEqualcomparison, base64url decode, and age/TTL checksChange
Replace the duplicated internals with calls to
createSignedToken/verifySignedToken, keeping the link-account-specific Redis context load. Theiat/noncevalidation is now owned bysigned-token.ts(which already validates them more strictly viaNumber.isFinite), so they are dropped from the local Zod schema.Net: -33 lines, no behavioral change to the wire format or TTL.
Verification
oxlint(70 rules): 0 warnings, 0 errorsoxfmt --list-different: no formatting changestsgotypecheck: no errors attributable to this change (only pre-existing@types/noderesolution artifacts from running outside the full web typecheck pipeline)src/tests/setup/workerSetup.tsrequires a live Postgres instance to bootstrap a per-worker test DB. The existingbot-identity.test.tsexercisescreateLinkAccountToken/verifyLinkTokenround-trips and is unaffected in behavior.