Skip to content

Restrict cached sync device token to owning user on Linux/macOS - #25

Merged
jpol34 merged 1 commit into
mainfrom
harden-sync-device-token-perms
Sep 16, 2026
Merged

jpol34 merged 1 commit into
mainfrom
harden-sync-device-token-perms

Conversation

@jpol34

@jpol34 jpol34 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • The synced-device auth token cached at ~/.strongbox/device-token was written with default file permissions, unlike the sync server's own bootstrap token, which is already locked to user-only.
  • On a shared Linux/macOS box, another local account could read this file and impersonate the device against the sync server (full read/write/delete of that server's secrets, per the current single-server-per-person design).
  • Restricts the file to UserRead|UserWrite on Linux/macOS after write, mirroring Get-StrongboxSyncBootstrapToken.ps1.

Found during a security review of the new sync server feature (server-side token hashing/auth/crypto were reviewed and are sound - this was the one client-side gap).

Test plan

  • Added a Pester case asserting the cached token's Unix file mode after Initialize-StrongboxSync, skipped on Windows (CI runs windows-latest only, so this only exercises manually on Linux/macOS today - verified logic against the existing bootstrap-token pattern).
  • Invoke-Pester -Path Tests/Strongbox.Tests.ps1 - 43 passed, 1 skipped (the new Linux/macOS-only test, skipped on this Windows machine), 0 failed.

The device token is bearer auth for every sync request, but was cached
with default permissions unlike the server's own bootstrap token
(already restricted to user-only). On a shared box another local user
could read ~/.strongbox/device-token and impersonate the device.
@jpol34
jpol34 merged commit 6658a5c into main Sep 16, 2026
1 check passed
@jpol34
jpol34 deleted the harden-sync-device-token-perms branch September 16, 2026 22:45
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