Skip to content

feat(security-kit): device signals and server security helpers (0.1.0) - #1

Merged
BackStacked merged 1 commit into
mainfrom
claude/security-kit-hdle6s
Oct 14, 2026
Merged

BackStacked merged 1 commit into
mainfrom
claude/security-kit-hdle6s

Conversation

@BackStacked

Copy link
Copy Markdown
Contributor

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): DeviceSignals types, the x-mgpl-signals header, 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; clientIp behind trusted proxies; securityHeaders, corsPolicy; redact, maskEmail, maskPhone.

How: the shared and browser parts use only Web Crypto, TextEncoder and btoa/atob. npm run typecheck also compiles them without Node.js types, and CI checks that the built main and /browser bundles 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

  • Feature
  • Docs

Checklist

  • On a branch (not main)
  • npm run typecheck passes
  • npm test passes (32 checks), npm run build + scripts/check-dist.mjs pass
  • Docs: README, AGENTS.md, CLAUDE.md, llms.txt, llms-full.txt
  • No real patient data, contact details or signatures

🤖 Generated with Claude Code

https://claude.ai/code/session_01L5Py9guKQFcFPmdme7bRjo


Generated by Claude Code

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
@BackStacked BackStacked self-assigned this Oct 14, 2026
@BackStacked
BackStacked merged commit 4269887 into main Oct 14, 2026
1 check passed
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