Skip to content

Walls: jobs see an allow-list of /etc, not all of it #243

Closed

Description

@scuttletoby

Recommendation

Stop showing fleet jobs the host's whole /etc. Give them a short allow-list of /etc entries instead, and check from inside the sandbox that this is all they see. Then "a job cannot read that secret" is true because the file is not there, not because a parser guessed right.

Why

Today fork-fleet-job-paths.txt lists /etc, so the launcher binds all of it into every job. The etc-secrets wall then reads /etc (and /usr) and tries to guess which readable files hold a secret: it copies four config languages (shell, systemd unit, systemd env-file, fish/csh/pam_env) with regexes and shlex, and follows pointers like *_FILE and *_COMMAND.

That can never be a proof. A *_COMMAND value is a program: which file it reads depends on bash and on every program it calls. Every review round of #240 found one more form the copy reads differently from the real parser, and that supply does not run out. So #240 merges with etc-secrets described as what it is: a lint that looks for secrets in the common places (#240 round 4).

What to build (option D)

  1. Allow-list. Replace the /etc line in fork-fleet-job-paths.txt with the entries builds need, for example: passwd, group, nsswitch.conf, hosts, ssl/certs, ssl/openssl.cnf, ca-certificates, pki, alternatives, ld.so.cache, ld.so.conf, ld.so.conf.d, localtime, timezone, os-release, java-*-openjdk, maven, gitconfig, mime.types, fonts, login.defs, protocols, services. A project adds more through the existing ALLOW_PATHS. The launcher already binds single paths and skips missing ones. Login files, units, /etc/default, fstab, cron and every backup tool's folder are then simply not in the job's file system.
  2. Check by looking. The existing in-sandbox probe (it runs as the runner user with the real unit settings) lists the job's /etc and FAILs on any entry that is not on the list. It also tries to read a canary file the host keeps outside the list (and one readable only by group or ACL), and FAILs if the read works.
  3. Walls rule: "no whole /etc in the paths list". The mounts wall (linux and wsl2) FAILs if the launcher's paths holds /etc itself.
  4. Older kit: its paths file still lists /etc. The every-start check must FAIL on that with "re-run the installer", and never start a runner with the old view.
  5. Delete the pointer-following code in fork-fleet-walls/linux: command_secret, word_paths, inline_script, specifier expansion for secrets, the env-file and login-file readers, and the mount-table reader. About 600 lines and many tests go.
  6. Keep a small lint for what jobs still see outside /etc: /usr (mainly /usr/local scripts and /usr unit files) and ALLOW_PATHS. Token shapes, secret file names, and a plain rule: a line whose raw text holds a secret word must be one exact simple form, else FAIL.
  7. Keep from fleet walls: the seven #226 follow-ups (fail closed) #240: all of job-units (unit_lines, drop-in order, BOM, continuation), the launcher tripwires, public_only, the folder-owner checks, token shapes, and "any error = FAIL".
  8. Reviews: this is launcher code, so two independent Opus high reviewers. Each asks the state question below.

The risk moves to builds: a build may miss an /etc file. That error is loud (the build fails and names the file) and safe. Run the real CI jobs once and add what is missing. Today a wrong guess is silent and unsafe.

What happens when this runs again, stops half-way, or meets old or empty state?

  • Runs again: the view is built fresh at every start from the paths file, nothing stored. Same view each time.
  • Stops half-way: systemd starts the unit with all its settings or not at all.
  • Older kit: its paths file lists /etc; the check FAILs ("re-run the installer") before any runner starts.
  • Hand-made host: its odd /etc files no longer matter, which is the point.
  • Missing entry on a host: skipped by the launcher, and the probe confirms what the job really sees.

Open forms today: closed by design, not by more parsing

Each form below makes etc-secrets PASS on a test root while a job could read the secret. They are known and listed in the etc_secrets_wall docstring. Do not fix them one by one in the parser; option D removes them, because the files are no longer in the job's view.

  1. BORG_PASSCOMMAND="cat <readable file>": borg's own standard name. PASSCOMMAND is one word and matches no secret word.
  2. A password in /etc/cron.d/* or /etc/crontab.
  3. A password in a script under /usr/local/bin (this one stays in the small /usr lint, item 6).
  4. A password on a unit's ExecStart= line.
  5. A readable password file that nothing points at.
  6. A secret under a name with no secret word.
  7. EnvironmentFile= and /etc/default/* are read with shell regexes, not systemd's env-file parser: blanks around =, unquoted values with blanks, backslash escapes, quotes in the middle of a value, continued lines.
  8. Login files are read with the same regexes: =/etc/restic/"pw", =/etc/restic/p\w, a value continued with \, a newline inside quotes.
  9. A newline in sh -c 'true<newline>cd etc/restic<newline>cat pw' hides the cd.
  10. A quoted value over several lines in a login file (export RESTIC_PASSWORD="Hunter2-correct<newline>horse").
  11. Unit settings that change the unit's view of files: BindPaths=, BindReadOnlyPaths=, RootDirectory=, RootImage=, TemporaryFileSystem=, MountImages=.
  12. Percent-encoding in a login file: curl -s file:///etc/restic/p%77.
  13. A folder read recursively: grep -rh . /etc/restic with the secret in a subfolder.
  14. A % specifier inside an Environment= NAME (RESTIC_PASS%iWORD_FILE=...).
  15. others_read looks only at the "other" bits; a file the job user can read through its group or an ACL counts as private (item 2's canary read covers this).

Closed in #240 round 4: a # inside a word of a *_COMMAND (shlex read it as a comment).

Details and test inputs: the round-3 re-check comments on #240. Design audit by the fork orchestrator, 2026-11-16 (options A to D; D recommended).

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 16, 2026

    @scuttletoby
    OwnerAuthor

    From the #240 round-4 re-check (lens240q4), open forms and wording to add to this list:

    • A plain-text file named .gpg/.age passes (trusted by name); this now also covers cat ~/x#y.gpg.
    • A readable script run as a *_COMMAND program is not read.
    • User units resolve %t/%E/%S to system folders.
    • This issue's list (9 items) is shorter than the etc_secrets_wall docstring's; keep them the same.
    • fork-fleet-walls.py:9 ("exit 0 only when every wall holds") and fork-fleet.md:235 ("Fleet jobs read no secrets") should say etc-secrets is a lint, not a proof.
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions