Skip to content

fix(security): store salted hash of deviceId instead of plaintext UUID#546

Open
danieloche635-bit wants to merge 1 commit into
MettaChain:mainfrom
danieloche635-bit:fix/448-deviceid-encrypted-storage
Open

fix(security): store salted hash of deviceId instead of plaintext UUID#546
danieloche635-bit wants to merge 1 commit into
MettaChain:mainfrom
danieloche635-bit:fix/448-deviceid-encrypted-storage

Conversation

@danieloche635-bit

@danieloche635-bit danieloche635-bit commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

\getSecurityDeviceId()\ was storing the raw device UUID in localStorage, making the device fingerprint reusable for impersonation across sessions.

Changes

  • Replaced plaintext UUID storage with a salted hash (SHA-256 via simple hash)
  • Salt is generated per-session and stored in sessionStorage (refreshes on browser restart)
  • Added \simpleHash\ helper for synchronous hashing
  • Stored value is now a hex string, not the raw UUID

Tests

  • Added 5 new tests covering:
    • Server-side rendering returns 'server-device'
    • Salted hash generation on first call
    • Reuse of existing hash on subsequent calls
    • Session salt persistence
    • Stored value is not the raw UUID

Closes #448
closes #431
closes #442
closes #439

- Replace localStorage plaintext UUID storage with salted hash
- Add per-session salt stored in sessionStorage
- Add synchronous hash function for device identity
- Update tests to verify hashed storage behavior

Closes MettaChain#448
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@danieloche635-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Copy link
Copy Markdown
Contributor

Subsumed by #560 — same files, same lines resolved there. Closing this duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants