Repository navigation
feat: device binding for refresh tokens - #7
Merged
Merged
Conversation
Login and refresh accept DeviceSignals (deviceId, fingerprint, clientSessionId, info), cleaned and stored on the session. A refresh from another deviceId ends the session (deviceBinding enforce, the default; flag audits; off ignores). A fingerprint change is audited. 1.2.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BA5Vx77ihDsLiZpyg5duJV
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.
What and why
Before: a stolen refresh token worked from any device until it was used twice.
After: clients can send security signals with
loginandrefresh(device: { deviceId, fingerprint, clientSessionId, info }). They are cleaned, size-capped and stored on the session. A refresh from a differentdeviceIdis refused withINVALID_TOKEN, the session ends, and the event is audited asauth.device_mismatch. A changed fingerprint is only audited (auth.fingerprint_changed), because browser updates change it.How: there is a new
deviceBindingoption,"enforce"(default),"flag"or"off".cleanDeviceSignalstreats client input as untrusted.sessionsOfnow returnsdevice. The version goes to 1.2.0. 110 checks pass on the memory and Redis stores.Type
Screenshots
n/a (library)
Checklist
npm run typecheck && npm test && npm run build🤖 Generated with Claude Code
https://claude.ai/code/session_01BA5Vx77ihDsLiZpyg5duJV
Generated by Claude Code