You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3743330
Browse filesBrowse the repository at this point in the historyBrowse files
fix(kits): fail closed when a selected readonly mount file is missing
The oci-engine root startup fell back to the root-owned
/usr/local/lib/acq/oci-engine copy when the backend had selected a path on the
read-only mount but the file was missing. Those copies came from /home/agent at
create time, so they are not host-authoritative across restarts. The grant
script did the same for its storage helper.
- Startup now classifies the two tokens together. Both on the mount: run them,
or refuse (stderr error, exit 1) if either file is missing. Both /home/agent:
the explicit legacy case, root-owned copy as before. Anything else, including
a mixed pair or `..`: refuse. The earlier mounted-path-missing fallback is
removed.
- oci-engine-grant-devs.sh refuses a missing selected mount helper and any path
outside the mount or the root-owned directory; no silent fallback.
- scripts/verify fails when readonly was honored but a mount file is missing, or
when only one file is on the mount.
- Docs: table of token cases, why a non-zero exit is safe (Quickstart reports a
failing startup command as a warning), the pairing with Quickstart#637, and the
mount-enforcement assumption.
- Tests: offline fixtures for each case, with mutation checks.
Co-authored-by: OpenCode Agent <[email protected]>
kit mechanism, but root phases do not execute or source those mutable copies.
100
101
The root command wrappers publish the install script into
101
102
`/usr/local/lib/acq/oci-engine/`; the startup script and sourced helper run from
102
-
the read-only mount when the consumer honors `readonly`, else from root-owned
103
-
copies published there. Neither runs from the mutable staging copies.
103
+
the read-only mount when the consumer honors `readonly` (failing closed if the
104
+
file is missing), else from root-owned copies published there for a consumer
105
+
that ignores `readonly`. Neither runs from the mutable staging copies.
104
106
-**Least-privilege registry resolution.**`short-name-mode` defaults to
105
107
**`enforcing`**, not `permissive`. Because there is a single search registry
106
108
(`docker.io`), unqualified names still resolve deterministically to Docker Hub
@@ -122,13 +124,39 @@ The root `startup` step runs two kit files: `oci-engine-grant-devs.sh` and the
122
124
honors the flag (acq `msb`, quickstart ADR-0035) runs them from a
123
125
host-authoritative read-only mount, so a guest user with `sudo` cannot edit what
124
126
root executes on each start. A consumer that ignores the flag copies them under
125
-
`/home/agent` as before, and the step then runs the root-owned copy that
126
-
`oci-engine-install.sh` published. The step accepts a path only if it is under
127
-
`/var/lib/acq/host/kit-files/` (the read-only mount), checks the script and the
128
-
helper independently, and substitutes the root-owned copy for anything else, so
129
-
it never runs an `/home/agent` path. `oci-engine-grant-devs.sh` repeats that
130
-
check on the helper it sources. If neither the mount nor the root-owned copy has
131
-
the script, the step prints a warning and `scripts/verify` fails.
127
+
`/home/agent` as before (the *legacy* case), and the step then runs the
128
+
root-owned copy that `oci-engine-install.sh` published.
129
+
130
+
The step **fails closed**. It classifies the two tokens together:
131
+
132
+
| Tokens | Behavior |
133
+
|---|---|
134
+
| Both under `/var/lib/acq/host/kit-files/`| Run exactly those files. If either file is missing: error on stderr, run nothing as root, exit 1. It does **not** fall back to the root-owned copy, which came from `/home/agent` at create time and is not host-authoritative across restarts. |
135
+
| Both under `/home/agent/`| Legacy: run the root-owned copy that install published. If install published nothing, warn and exit 0, as before. |
136
+
| Anything else (one mounted and one not, `..`, an unknown prefix, an empty token) | Refuse: error on stderr, exit 1. |
137
+
138
+
`oci-engine-grant-devs.sh` applies the same rule to the helper it sources: a
139
+
missing selected mount helper is a refusal, not a fallback. A refusal costs only
140
+
the device grant and storage re-evaluation for that boot. Quickstart reports a
141
+
failing startup command as a warning and continues; it never treats it as an
142
+
escalation. `scripts/verify` fails in that state.
143
+
144
+
Pairing with Quickstart: GSA-TTS/agentic-coding-quickstart#637 makes the
145
+
decision to use the read-only mount a host-side record, so a guest cannot force
146
+
the legacy downgrade by tampering with a guest probe. When staging a read-only
147
+
file fails on the host, the consumer falls back to a guest copy for that file and
148
+
leaves its `/home/agent` token in argv. If both files fall back, that is the
149
+
legacy row above. If only one does, the pair is mixed (one mount token, one
150
+
`/home/agent` token) and the step refuses, so one failed host copy costs the
151
+
device grant and storage re-evaluation for that boot. The consumer's create-time
152
+
startup script derives its rewrite table without checking whether staging
153
+
succeeded, so it can name a mount file that was never staged; the step refuses
154
+
that case too.
155
+
156
+
The mount is enforced by the backend. A guest user with `sudo` who can unmount or
157
+
bind-mount over `/var/lib/acq/host/kit-files` is outside what token validation
158
+
can defend against; the read-only property rests on the backend's mount
159
+
enforcement.
132
160
133
161
The install step still trusts `/home/agent` at create time (it publishes the
134
162
staged copies into the root-owned directory, before the agent's first session).
# No agent-home copy means the consumer honored `readonly` and selected the
250
+
# mount for the startup tokens. A missing mount file then makes the startup
251
+
# command refuse (fail closed) instead of falling back to a root-owned copy.
252
+
bad "readonly was honored (no agent-home copy) but a selected mount file is missing: the startup step refuses, so device grant and storage re-evaluation do NOT run"
bad "startup grant script is neither on the read-only mount nor published root-owned: device grant would silently not run (install failed, or mount absent)"
255
+
bad "startup grant script is neither on the read-only mount nor published root-owned: device grant would not run (install failed, or mount absent)"
echo "oci-engine: WARNING: no trusted startup script (not on the read-only mount, not published under $trusted); device grant and storage re-evaluation NOT applied." >&2
208
-
exit 0
224
+
if [ "$g" = legacy ] && [ "$h" = legacy ]; then
225
+
if [ -f "$trusted/oci-engine-grant-devs.sh" ]; then
226
+
exec sh "$trusted/oci-engine-grant-devs.sh" "$trusted/oci-engine-storage-driver.sh"
227
+
fi
228
+
echo "oci-engine: WARNING: no root-owned startup script under $trusted (install did not publish it); device grant and storage re-evaluation NOT applied." >&2
229
+
exit 0
230
+
fi
231
+
refuse "unrecognized or mixed startup tokens ($g, $h)"
0 commit comments