Repository navigation
Description
Summary
A post-hoc adversary security review of merged PR #46 (D46: plugin layout and plugin trust), at head 40cf93a, gave the verdict BLOCK: needs a design change before the restructure. No release pipeline exists yet, so nothing can be exploited today. These are design gaps that the restructure (the plugin loader) and Step 6 (the release pipeline) would otherwise build in. #46 was merged without the adversary verdict required before a PR; this issue records that review.
Decide before or in the restructure PR
- D-a (F5). How the loader proves a plugin is in-tree: by where its module file sits under the gate-1-verified tendcf tree, not by distribution name or metadata. Supervisor renderers are found through a static import table, never through entry points.
- D-b (F4). Nix evaluation limits:
restrict-evalorpure-eval, no import-from-derivation, emptyallowed-uris, no network. Either a Guix sandbox, or a rule that foreign and site-shared inputs are YAML/JSON data only. - D-c (F1). What "separate environment" means concretely: a different machine, VM or throwaway container, under an identity that can't read the key or write the gate tooling. The key could also live on a hardware token or a separate signer.
- D-d (F2, F3). How what is signed is tied to what was reviewed.
Decided 2026-11-13: #48 (comment)
Findings
-
F1 HIGH: the rule that gates and signing run apart from plugins can't be enforced as written.
docs/architecture/plugin-layout.md:179-187says the gates and signing run in "a separate environment", butdocs/architecture/change-process.md:291puts thetargetskey on the builder. A plugin running in gate 2 could:- read the key file;
- tamper with the gate tool environment, for example with a
.pthfile; - rewrite goal files between gates 3-5 and signing (a time-of-check to time-of-use gap);
- persist on the builder.
- In-tree plugins ship inside the single
tendcfdistribution, so no environment that installs tendcf is "plugin-free". - The compiler and the gates share pyyaml, jsonschema and rfc8785 (
compiler/pyproject.toml:12-16,bin/schema_lint.py:4,bin/projector.py:4), so one compromised dependency defeats both. - The guide states the rule in the present tense.
Fixes:
- Make the boundary concrete (D-c).
- Make gate 2's only output goal-file bytes plus digests, passed one way, and sign exactly the digests that were checked.
- Build the gate environment from the source tree with a hash-locked dependency closure, without installing the
tendcfpackage. - Mark the rule "planned, Step 6" in the guide, the map and plugin-layout.md.
-
F2 HIGH: nothing ties what gets signed to what was reviewed.
- On operator hosts the only human check is the PR's preview diff (
plugin-layout.md:175-177, guide:243-245). The merge run compiles again and signs whatever comes out. A plugin can tell the PR run from the merge run, and compiles aren't checked for being hermetic. - Nothing requires site-private changes to go through a reviewed PR at all.
Fixes:
- Compare each host's goal-file digest at merge with the digest from the approved PR, or promote and sign the PR's own artifacts.
- Use branch protection on site-private.
- Make the compile hermetic.
- Until then, call the preview diff advisory.
- On operator hosts the only human check is the PR's preview diff (
-
F3 HIGH: a PR run executes code the PR chose, before review.
- Gate 1 checks
rev/treebut noturl(change-process.md:107-126, 265-271). - A site-private PR can repoint the tendcf pin at a fork, so "in-tree" (
plugin-layout.md:198-202) becomes whatever the attacker's tree contains. - Gate 2 runs it in the PR's CI, which is possibly the signing host.
Fixes:
- Run PR gate runs on throwaway runners with no key and no secrets.
- Treat these changes as privileged, needing the gate-5 ceremony marker: a changed
url, a tendcf pin that doesn't descend from the previous one, and a changed plugin set. - Optionally, allowlist the tendcf URL.
- Gate 1 checks
-
F4 MEDIUM-HIGH: frontend inputs are code.
- Nix and Guile recipes from site-shared and foreign sites run during compile.
compiler/nix2cf/cli.py:155-160runsnix-instantiate --eval --strict --jsonwith no restrict-eval or pure-eval, so recipes can read files, fetch over the network, or use import-from-derivation.
Fix: decide D-b and record it in plugin-layout §4 before the Nix frontend moves.
-
F5 MEDIUM: entry-point collisions and dependency confusion.
importlib.metadata.entry_points()drops a second distribution with the same name before listing entry points, so "a duplicate name is a compile error" (plugin-layout.md:189-202) never fires for a second distribution calledtendcf.- The PyPI names
tendcfandnix2cfwere unregistered on 2026-11-13. Placeholders are being registered; see the comment below. - A private entry-point group for supervisors could be shadowed.
- The order of activation rules 1-3 is undefined.
Fixes:
- Decide D-a.
- Define the activation algorithm: list every entry point without the by-name deduplication; refuse any duplicate name, and any non-tendcf entry point that uses a reserved name; then load only the named entry points.
- Release builds never resolve
tendcffrom an index.
-
F6 MEDIUM: "installing a package activates nothing" is false.
.pthfiles and sdist build backends run during install.- Checking a hash at load time against the installed RECORD file proves nothing.
- Plugins' dependency closures aren't pinned.
- The gate tools resolve their dependencies from PyPI each time they run.
Fixes:
- Reword rule 1 as "an unnamed plugin is not selected".
- Check hashes at install time from a hash-locked resolution, wheels only.
- Pin each plugin's dependency closure.
- Lock the gate tools' dependencies (
uv lock --script) and run them offline.
-
F7 MEDIUM: folding the compiler in removes the producer/checker independence.
- One tendcf commit can change both the compiler and its gates.
- Rolling the pin back also rolls back gate fixes.
- Nothing defines a rollback across a schema_version bump.
Fixes:
- Treat changes to
tools/,schema/or the projector in a tendcf bump, and any backwards pin move, as privileged. - Add CODEOWNERS for
schema/,tools/andpolicy/. - Define or forbid rollback across a bump.
- List this cost in change-process §9.
-
F8 LOW-MEDIUM: confidentiality is mentioned but not bounded.
- A plugin or recipe can copy host A's private data into a schema-valid string field of host B's goal file.
- Nothing in gates 3-5 looks for that.
Fixes:
- Say this in the trust section.
- Have the projection lint check for values from other hosts' slices.
- Say who can read the release store.
-
F9 LOW: some properties are stated flatly though nothing enforces them yet.
- Device-side validation, the activation loader and the gate separation are all unbuilt.
TENDCF_DIR(compiler/nix2cf/cli.py:62-77) lets the environment choose which projector is executed.
Fixes:
- Tag each claim "planned" where it is stated.
- Pin or refuse
TENDCF_DIRin release builds.
-
F10 LOW: activation leaves out importers and changes to the plugin set.
- No rule says which importer an operator may run.
- A changed plugin set is recorded but isn't a gate, so a "sleeper" plugin can be named now and change behaviour later.
Fixes:
- Apply the same naming and pinning rules to importers.
- In gate 5, compare the plugin set with the previous release's.
Not covered by #47
The seven items #47's scope is missing are posted as a comment there.
Related: #46, #47, tracker #1.
🤖 Generated with Claude Code
Activity
djbclark commentedon Nov 13, 2026
F5 part 2 is done: the PyPI names are now reserved with 0.0.0 placeholders (no code, README points here) at https://pypi.org/project/tendcf/ and https://pypi.org/project/nix2cf/. The rule that release builds never resolve
tendcffrom an index (D-a / F5 fix 3) still stands.🤖 Generated with Claude Code
djbclark commentedon Nov 13, 2026
Decisions D-a to D-d (djbclark, 2026-11-13)
These go into a docs PR that amends D46 and
docs/architecture/plugin-layout.md§4/§7. That PR gets Astra, Fable and adversary reviews before it opens. The restructure stays blocked on that PR and on #41/#42.D-a (F5): in-tree proof.
tendcf pluginmanagement #47:D-b (F4): frontend inputs are code.
djbclark: "I want people to be able to easily share configurations, but they should be security-scanned before running them, including doing so with the help of AI. We can have a soft requirement that access to AI be present whenever an external import is attempted."
allowed-urisand no network. The exact flags get tested in the docs PR.external_import.without_ai = require-human-ack(the default),warnorrefuse.D-c (F1): what "separate environment" means.
djbclark: "3, but we want to leave the unix user as a non-default option in the first real release."
Cost shown when deciding: the two-job split is about 1-2 agent-days of work plus about $0.03 per release (Linux 2-core at $0.006/min, GitHub docs checked 2026-11-13). The Unix user is about half a day and $0, but it leaves persistence and pre-signing tampering open.
D-d (F2, F3): binding what is signed to what was reviewed.
url, a pin that does not descend from the previous one, or a changed plugin set requires the gate-5 ceremony marker.🤖 Generated with Claude Code