Repository navigation
🛡️ Sentinel: [LOW] nightly backup drops the Jellyfin webhook secret - #370
Merged
Merged
Conversation
The backup's promise is 'no tokens inside' (it is what makes the 0640 BACKUP_GROUP_READABLE mode safe to offer), but _strip_secrets only blanked token columns; the webhook's shared secret is an app_state row and was copied verbatim. Delete that row in the copy (secure_delete is already on); a restore leaves the route off until the admin's next look at the setup card makes a new secret. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014GBDVBSiv59ZWfET13xFYp
4 tasks done
Merged
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.
Problem
connection.backup_modes()and the 1.2 CHANGELOG say the nightly backup carries no tokens; that's why the 0640BACKUP_GROUP_READABLEmode is safe to offer.scheduler._strip_secretsonly blanks token columns (users.plex_token,sessions.*). The Jellyfin webhook's shared secret (app_statekeyjellyfin_hook_secret, the only credential onPOST /api/jellyfin/webhook) is a row, so it was copied into every backup unchanged.Evidence: on the app's migrated database (
app_db()), with the secret set and a backup copy run through_strip_secrets, the row was still there ([('S3CRET-…',)]) and its bytes were in the file.Severity LOW: anyone who can read a backup (the app's group when 0640, or a copy taken off the share) can send authenticated webhook posts. A post is only a hint that triggers a rate-limited re-read with the API key. Nothing is written unless Jellyfin confirms a recent play. So the only harm is breaking the stated invariant, plus a small amount of extra traffic to Jellyfin.
Change
_SECRET_STATE_KEYS = ("jellyfin_hook_secret",)inscheduler.py;_strip_secretsdeletes thoseapp_staterows in the copy.secure_deleteis already on, so the bytes are overwritten.app_stateis untouched.Measured effect / proof
Same reproduction after the change:
after strip: [],raw bytes contain secret: False.Tests
tests/test_backup_perms.pyadds anapp_statetable with the secret and one ordinary row to its hand-made live DB:13 passed, 2 failed(the Jellyfin webhook secret is not in the backup…,...nor its bytes)16 passed, 0 failed. This includes a drift guard:jellyfin_hook.SECRET_KEY in scheduler._SECRET_STATE_KEYS, so renaming the key can't make the strip silently miss it.Full battery: 356/357 green. The one failure is
test_enrichment_status_perf.py, which fails the same way on untouched main in this sandbox (SQLite 3.45.1 picks another plan) and passes in CI.Risk & edge cases
app_state: skipped (if "app_state" in tables).Duplicate check
Searched: PRs for
strip_secrets,webhook secret,jellyfin secret backup(only #265, the original Jellyfin feature);git log --oneline -300(backup commits ce4ff43 / f5abf99 cover columns only); open PRs and branches right before pushing (#366–#369, unrelated).Generated by Claude Code