Skip to content

secrets: setup-secrets runs as unsandboxed root, and the lockdown of unlisted files skips dotfiles #25

Closed

Description

@bobberb

Severity: low

Two things in modules/secrets/secrets.nix:

  • The setup-secrets unit (#L172) runs as root with no systemd hardening, although it only needs to chown and chmod inside the secrets directory.
  • The pass that locks down files not declared in nix-bitcoin.secrets (#L220-L227) enumerates them with printf '%s\n' *. That glob does not match dotfiles, so a stray dotfile in the secrets directory keeps whatever owner and mode it had. The list is also passed to chown/chmod unquoted and with no --, so a file name starting with - is read as an option and one containing glob characters is expanded again.

Suggested fix: secrets.nix parts of ostermayer/nix-bitcoin@d22c5da and ostermayer/nix-bitcoin@c021a3e.

Split out of #16 (item 1.6). Confirmed by reading the code at the linked lines on master (234953e), not exploit-tested.

Activity

  1. added a commit that references this issue on Oct 16, 2026
    344a8e7
  2. added
    area: modules
    type: security
    on Oct 16, 2026
  3. added a commit that references this issue on Oct 17, 2026
    5050289
  4. added a commit that references this issue on Oct 23, 2026
    871973c
  5. added a commit that references this issue on Oct 25, 2026
    c4dec55
  6. added 2 commits that reference this issue on Oct 25, 2026
    1a0d2eb
    1465ade
  7. added a commit that references this issue on Oct 26, 2026
    4807721
  8. added a commit that references this issue on Nov 8, 2026
    e739a52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modulestype: security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions