Skip to content

fix(install): run SeaweedFS KEK recovery container as root - #4612

Merged
aldy505 merged 2 commits into
getsentry:masterfrom
pcbeingused333:fix/seaweedfs-kek-recovery-run-as-root
Nov 9, 2026
Merged

aldy505 merged 2 commits into
getsentry:masterfrom
pcbeingused333:fix/seaweedfs-kek-recovery-run-as-root

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4577

Cause

install/migrate-seaweedfs-kek.sh recovers a wrapped legacy filer KEK by running scripts/recover_seaweedfs_kek.py in sentry-self-hosted-local with --volumes-from the temporary SeaweedFS container. The script reads /data/.mini_kek_passphrase, which weed creates as root with mode 0600. Since the sentry image runs as a non-root user, the read fails with PermissionError and the install aborts (before the marker is written or Postgres is touched, so a re-run is safe). It only shows up when upgrading from before 26.8.0 and the stored KEK is wrapped; a plain-hex KEK skips this path.

Fix

Add --user 0 to that one-shot container, which only reads the volume and prints the key.

Test

New _unit-test/migrate-seaweedfs-kek-test.sh stubs the container engine and asserts that the recovery run is started with --user 0. It fails on main and passes with the change.


This PR was prepared with AI assistance (Claude Code) and the change reviewed against the issue's reproduction.

The recovery step reads /data/.mini_kek_passphrase through --volumes-from.
weed writes that file as root with mode 0600, and the sentry-self-hosted-local
image now runs as a non-root user, so the read fails with PermissionError when
upgrading from before 26.8.0 with a wrapped filer KEK.

Run the one-shot, read-only container with --user 0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@aminvakil aminvakil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this.

This does not need a unit test as well.

@aldy505
aldy505 merged commit 3ea592d into getsentry:master Nov 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

install.sh 26.10.0: SeaweedFS KEK migration fails with PermissionError on /data/.mini_kek_passphrase (sentry image is non-root now)

3 participants