Skip to content

feat: device binding for refresh tokens - #7

Merged
BackStacked merged 1 commit into
mainfrom
claude/graphql-backend-fa2c1c
Oct 14, 2026
Merged

BackStacked merged 1 commit into
mainfrom
claude/graphql-backend-fa2c1c

Conversation

@BackStacked

Copy link
Copy Markdown
Contributor

What and why

Before: a stolen refresh token worked from any device until it was used twice.

After: clients can send security signals with login and refresh (device: { deviceId, fingerprint, clientSessionId, info }). They are cleaned, size-capped and stored on the session. A refresh from a different deviceId is refused with INVALID_TOKEN, the session ends, and the event is audited as auth.device_mismatch. A changed fingerprint is only audited (auth.fingerprint_changed), because browser updates change it.

How: there is a new deviceBinding option, "enforce" (default), "flag" or "off". cleanDeviceSignals treats client input as untrusted. sessionsOf now returns device. The version goes to 1.2.0. 110 checks pass on the memory and Redis stores.

Type

  • Feature
  • Fix
  • Docs
  • Chore

Screenshots

n/a (library)

Checklist

  • npm run typecheck && npm test && npm run build
  • README, AGENTS.md, llms.txt and llms-full.txt updated
  • No raw tokens stored or logged

🤖 Generated with Claude Code

https://claude.ai/code/session_01BA5Vx77ihDsLiZpyg5duJV


Generated by Claude Code

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
@BackStacked
BackStacked merged commit 1ed4fdb into main Oct 14, 2026
1 check passed
@BackStacked
BackStacked deleted the claude/graphql-backend-fa2c1c branch October 14, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants