Repository navigation
feat(security-kit): device signals and server security helpers (0.1.0) - #1
Merged
Merged
Conversation
Shared, /browser and /server entries with zero dependencies: device signal collection and validation, session binding and checks, client IP behind proxies, security and CORS headers, log redaction. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5Py9guKQFcFPmdme7bRjo
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.
Requested by Himanshu · project thread
What and why
Before: the repo was empty, and device signals were about to live separately inside the client and the api.
After: one zero-dependency package, used on both sides.
.(runs everywhere):DeviceSignalstypes, thex-mgpl-signalsheader,encodeSignals/decodeSignals(validated, size-capped, never throws),randomId,sha256Hex,constantTimeEqual, base64url./browser:createSignalCollector()collects a device id (localStorage), a tab id (sessionStorage), a coarse fingerprint and device info, and gives request headers. Framework-agnostic; storage and environment are pluggable (async storage works, e.g. React Native)./server:readSignals,bindSignals(stores SHA-256 of ids, never raw ids),checkSignals→same | changed | other-device | missing | unbound,decide()policy;clientIpbehind trusted proxies;securityHeaders,corsPolicy;redact,maskEmail,maskPhone.How: the shared and browser parts use only Web Crypto,
TextEncoderandbtoa/atob.npm run typecheckalso compiles them without Node.js types, and CI checks that the built main and/browserbundles import no Node.js modules. The README lists exactly what is collected (no canvas, audio, WebGL or font probing).The client and api switch to this package after the JWT/session PRs from the backend thread merge.
Type
Checklist
main)npm run typecheckpassesnpm testpasses (32 checks),npm run build+scripts/check-dist.mjspass🤖 Generated with Claude Code
https://claude.ai/code/session_01L5Py9guKQFcFPmdme7bRjo
Generated by Claude Code