Skip to content

fix: copy Rustic secrets through a holder volume - #5201

Merged
kmendell merged 4 commits into
mainfrom
fix/issue-5194
Dec 1, 2026
Merged

kmendell merged 4 commits into
mainfrom
fix/issue-5194

Conversation

@kmendell

@kmendell kmendell commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Checklist

  • This PR is not opened from my fork's main branch
  • All new user-facing strings are translated via Paraglide (m.*())

What This PR Implements

System backups fail on some Docker 29 releases with openat data/arcane.db: read-only file system. Since #5085, Arcane copies the Rustic secrets into the Rustic container with docker cp before starting it. A system backup mounts the data directory read-only at /data and mounts the staged database over /data/arcane.db. The affected Docker releases open existing mount targets for writing during docker cp, so the copy fails on the read-only mount. The daemon bug was fixed upstream in September 2026. Docker 29.10.1 is not affected.

This change copies the secrets into a mount-free holder container. The Rustic container borrows the holder's volume read-only, so Arcane never copies into a container that has nested mounts.

Fixes #5194

Changes Made

  • backend/pkg/rustic/run.go: create a holder container from the Rustic image with only an anonymous volume at the secrets directory, copy the secrets into it, and attach that volume to the Rustic container read-only through VolumesFrom.
  • backend/pkg/rustic/run.go: move container removal into a remove helper used for both the holder and the Rustic container. The holder is removed last, after Rustic stops using its volume.
  • backend/pkg/volumes/helper.go: HelperHost gains a VolumesFrom field, passed through to HostConfig.

Secrets still stay out of the container environment and command.

Testing Done

  • Reproduced the error on Docker 29.7.2 (docker-in-docker). docker cp into a container with the system backup's mount layout fails with openat data/arcane.db: read-only file system.
  • Ran the patched rustic.Run on the same daemon with the system backup's mount layout:
    • init succeeded.
    • backup /data succeeded and captured the staged database.
    • dump latest:/data/arcane.db returned the staged database.
    • A wrong password was rejected with the credentials handling error.
    • No containers or secrets volumes were left behind.
  • go test passes for pkg/volumes, internal/backup, and internal/system/children/backup/.... pkg/rustic has no test files.
  • just lint backend: 0 issues.
  • just lint all fails at the frontend svelte-check step with 542 "Cannot find module" errors for generated Paraglide files in this worktree. No frontend files changed.

Not verified: a full system backup through the Arcane UI, UGOS, and Podman.

AI Tool Used (if applicable)

Change produced by anthropic/claude-fable-5-2 in harness Pi.

Additional Context

Disclaimer Greptiles Reviews use AI, make sure to check over its work.

To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike

To have Greptile Re-Review the changes, mention greptileai.

Confidence Score: 5/5 Tier: plusRetriggerView in Greptile

The PR appears safe to merge; the ownership check addresses the previous data-loss finding.

Summary

Moves Rustic secrets into a named, labeled volume populated through a separate holder container.

  • Rustic gets its secret files from a separate read-only volume.
  • Startup cleanup removes leftover Rustic secrets volumes.
  • Only global admins can access Rustic secrets volumes.

Reviewed by code inspection; no tests were run during this review.

Reviews (4) · Last reviewed commit: "fix: only remove owned Rustic secrets vo..." · Reviewed by Greptile

- Docker 29 cannot copy files into a container that has a read-only mount, which broke system backups
- Create a mount-free holder container, copy the secrets into its volume, and mount that volume into the Rustic container read-only via VolumesFrom
- Move container removal into a shared `remove` helper so the holder is removed after the Rustic container
- Add `VolumesFrom` to `volumes.HelperHost` and pass it through `HostConfig`

Fixes #5194
@kmendell
kmendell requested a review from a team December 1, 2026 21:03
Comment thread backend/pkg/rustic/run.go Resolved
- Backup passwords and S3 keys sat in plain text where any volume reader could list and read them
- Copy Rustic secrets into a per-run volume (arcane-rustic-secrets-<uuid>) instead of a holder's anonymous volume
- Mount the secrets volume read-only into the Rustic helper and remove it after the run
- Return 403 for arcane-rustic-secrets-* volumes unless the caller is a global admin
- Remove the now-unused VolumesFrom field from the helper host config
Comment thread backend/pkg/rustic/run.go
"slices"
"strings"
"time"
"uuid"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import "uuid" is not a valid import path. It sits in the standard-library group, but there is no standard-library uuid package. The UUID library lives at a full module path such as github.com/google/uuid. The file will fail to compile with package uuid is not in std, and uuid.New().String() on line 84 will not resolve.

Fix by importing the third-party package in the third-party import group:

import "github.com/google/uuid"

Use whichever uuid module the repository already depends on.

Suggested change
"uuid"
"github.com/google/uuid"

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment thread backend/pkg/rustic/run.go Resolved
- A crash or failed cleanup can leave a Rustic run's plain-text secrets volume behind
- Orphan cleanup now lists volumes matching the Rustic secrets prefix and removes them
- Removal failures are logged and skipped so the remaining volumes are still cleaned up
Comment thread backend/internal/volume/helpers.go Resolved
- Orphan cleanup removed any volume whose name contained the Rustic secrets prefix, since Docker's name filter matches substrings.
- Require Arcane's helper labels on a volume before removing it.
@kmendell
kmendell merged commit 40bd9c5 into main Dec 1, 2026
23 checks passed
@kmendell
kmendell deleted the fix/issue-5194 branch December 1, 2026 23:57
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.

System backup fails on v3.2.1 while copying Rustic secrets: arcane.db on read-only filesystem

1 participant