Skip to content

feat(security): encrypt summaries, author names and backups at rest - #56

Merged
haxurus merged 1 commit into
mainfrom
security/encrypt-at-rest
Oct 16, 2026
Merged

haxurus merged 1 commit into
mainfrom
security/encrypt-at-rest

Conversation

@haxurus

@haxurus haxurus commented Oct 16, 2026

Copy link
Copy Markdown
Owner

What and why

Discord Developer Terms §5(c) require encryption of API data at rest, and §9(b) deletion of all data when the app stops operating.

  • Event summary and MessageSnapshot.authorTag are now encrypted (AES-256-GCM, same key and format as the other fields). Existing plaintext rows are encrypted in batches when the bot starts; reads tolerate both formats.
  • History search: a snowflake matches actor/target/channel; free text is matched after decryption within the latest 5,000 events of the current filter (searchWindow is returned when the window is full).
  • ops/sentinel-deploy: pre-deploy dumps are streamed into age -R backup-recipients.txt, never written in clear; deploy aborts without age or a public key. Old unencrypted dumps are deleted after the first encrypted one. Requires manual setup on the VPS before installing the new script (DEPLOYMENT.md → Backups).
  • DEPLOYMENT.md: backup setup/restore and a shutdown procedure (section 11). Privacy page and README updated.

How it was tested

CI (typecheck, tests, migrations, sh -n on ops scripts).

🤖 Generated with Claude Code

- Event summaries and message snapshot author tags are encrypted with the
  existing AES-256-GCM key; legacy rows are encrypted in batches at startup.
- History search: IDs match actor/target/channel; free text is matched after
  decryption within the latest 5,000 events of the filter.
- Pre-deploy database backups are streamed into age, encrypted to a public
  key; the private key stays off the VPS. Unencrypted dumps are removed.
- DEPLOYMENT.md: backup key setup and restore; shutdown procedure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@haxurus
haxurus merged commit b1a295c into main Oct 16, 2026
5 checks passed
@haxurus
haxurus deleted the security/encrypt-at-rest branch October 16, 2026 19:34
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.

1 participant