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
posture: scheduler-driven runs need project-trust decoupled from the posture ladder #359
Part of the dark-factory epic (stacklok/stacklok-epics#297). Surfaced by titlani#40's security review (CWE-1427 / OWASP LLM01+LLM06).
Gap.--posture auto (mandatory for unattended/scheduler-driven runs — strict cancels on the first mutating call with no approver) also sets TrustProject = true via the posture ladder's TrustProject floor, and AGENTS.md/CLAUDE.md prompt discovery is not trust-gated at all. For a scheduler-cloned repository this means whoever can push to the cloned ref controls the agent's system instructions, project-tier permission ALLOWS, and .claude/rules — in a dark factory that is partly the agents themselves. The scheduler wants auto's approval semantics WITHOUT ingesting repo-resident instruction/permission material.
What.
A pin that decouples the two: e.g. --no-project-trust (or --project-trust=off) usable alongside --posture auto, suppressing project-tier permconfig/.claude-rules/agent-defs/soul ingestion.
Decide (and document) whether AGENTS.md/CLAUDE.md prompt assembly should honor the same pin, given it is currently un-gated.
Flag help + posture docs updated; the scheduler invocation profile doc (mecatequi-ci) recommends it for cloned-repo runs.
Also surfaced, smaller: Summary.final_text is verbatim unbounded model text on one line — a mecatl-side clamp (documented cap) would structurally bound the log-line size schedulers must scan (titlani#40 handles it consumer-side meanwhile).
Consumer-side view from titlani: consider a positive grant on mecatequi rather than a suppressor
Context: titlani#40 is the consumer that surfaced this, and its kubernetes arm (titlani#51, green, awaiting merge) is ready to adopt whatever shape lands here. Before we wire it, one observation about the flag's polarity — raising it now while #364 is still open.
The flag this issue asks for already exists on three of the four roots
--trust-project is defined on mecated, mecatui, and mecak8s, in each case default OFF and documented as the safe stance:
mecated: "Default OFF (the safe stance): an untrusted repo's permission grants are ignored."
mecatui: "Default OFF (the safe stance, unified with mecated): an untrusted repo's permission grants and project soul are ignored."
mecak8s: "Default OFF (the safe stance); an alias for --posture=trusted."
mecatequi has no such flag. On that root the only route to TrustProject is the posture ladder — and a scheduler-driven run must pass --posture auto, since strict cancels on the first mutating call with no approver. So on the one headless binary a scheduler actually invokes, project trust is neither opt-in nor opt-out: it is an unavoidable consequence of the only posture that works.
That looks like the actual defect. Not "we need a way to turn trust off," but "mecatequi never got the positive grant its siblings have, so the ladder became the sole path and carried ingestion with it."
The shape this suggests
Give mecatequi--trust-project (default OFF), matching the three existing roots.
Stop applyPosture raising TrustProject on the headless roots (mecatequi, mecak8s), so approval semantics and ingestion stop being bundled there.
--no-project-trust then has nothing to suppress and can be dropped (or kept briefly as a deprecated alias).
Net effect for a scheduler: it opts in for a repository it trusts, and a freshly-cloned third-party repo contributes no steering unless someone deliberately says otherwise.
Where this interacts with ADR 0092's best finding
#364 correctly identifies that TrustProject carries two unrelated meanings: project-tier ingestion, and enabling the read-only subagent shell (build.go's nil-ing of the sandboxed runner). A scheduler wants the second while declining the first — which is exactly why #364 chose a separate NoProjectIngest knob rather than collapsing onto TrustProject.
That finding survives, and in fact argues for finishing the split rather than working around it: a naive --trust-project=false on mecatequi would also cost us the read-only subagent shell we want to keep. So the clean end state is two independent positive capabilities — project-tier ingestion, and the subagent shell — instead of one overloaded boolean plus a suppressor and a conjunction (TrustProject && !NoProjectIngest) with its own precedence rules to reason about.
Worth noting the concept is already inconsistent across roots: on mecated "trust" means ALLOW rules; on mecatui ALLOW rules plus project soul; on mecak8s it is documented as an alias for --posture=trusted — conflating the two dimensions in the opposite direction from this issue. A fifth variant widens that spread.
The counter-argument, and why it points at per-root defaults
The real cost of inverting is interactive regression: making ingestion opt-in everywhere would silently stop reading a developer's own CLAUDE.md in mecatui/mecated, and the failure mode is quiet — the agent simply gets less useful, with no error to notice. That argument is sound, but it applies only to the interactive roots. mecatequi and mecak8s are headless and are precisely this issue's use case, so per-root defaults get the safety without changing any interactive session's behaviour.
The AGENTS.md gap is real work either way
Per this issue's own analysis, AGENTS.md/CLAUDE.md discovery is currently gated by no trust flag on any root — the highest-value injection point is ungated today. That needs fixing regardless of polarity. Our suggestion is only that it land as "instruction ingestion follows the positive trust grant" rather than as a new negative knob.
Why the consumer cares, given it is one argv token either way
The default decides what a forgotten flag costs. Under trust-by-ladder, omitting the suppressor on an untrusted clone is a silent privilege escalation: repository content becomes agent instructions, project ALLOW rules auto-approve tool calls, and the run holds a per-run bearer plus a provider key with 443 egress. Under an opt-in grant, omitting the flag merely yields a less-steered agent. A scheduler will dispatch a great many runs against repositories of varying provenance, and that asymmetry is the whole of our interest here.
Happy to take either shape — this is a polarity/default question, not a blocker on our side. --mcp-server-insecure-http (#358, shipped in #360) is already emitted by titlani's kubernetes arm, and the same plumbing will carry whichever trust flag lands. Also flagging that #364 currently reports CONFLICTING, in case that is news.
🤖 Filed from Claude Code on behalf of the titlani#40 work.
Status update on the implementation (PR #364), including a design correction the live e2e caught.
Where things stand
PR #364 first landed the --no-project-trust suppressor (ADR 0092), then — after the titlani review in the comments here argued that shape is fail-open (a forgotten flag on an untrusted clone silently trusts the repo) — was redesigned to a fail-safe opt-in shape (ADR 0094, which supersedes 0092): the overloaded TrustProject is split into two positive grants.
Ingestion axis (ProjectIngestionGranted): admits the repo's project-tier steering. Opt-in on headless roots (only explicit --trust-project); the posture ladder still grants it on interactive roots at auto/yolo (no interactive regression). mecatequi gained --trust-project (default OFF), matching the other roots.
Subagent-shell axis (SubagentShellGranted): intended to decouple the read-only worktree shell from ingestion.
The fail-safe headless default works as designed: mecatequi --posture auto on an untrusted clone now yields approvals + no repo steering, and a forgotten flag degrades to a less-steered agent rather than a hijacked one.
The correction (found by the live e2e)
I keyed the subagent-shell grant off posture >= auto alone. That's wrong in both directions, because the read-only subagent shell is more dangerous than the main agent's Bash in one specific way: it runs git worktree add, which performs a checkout that can execute an attacker-controlled .gitattributes filter driver in the repo's .git (the issue-#40 fork-time RCE). The main agent's Bash does not do that.
So the shell grant needs workspace trust vouching for the .gitand posture authorization — not posture alone:
Over-trust: headless --posture auto on an untrusted clone would now run git worktree add on a hostile .git — re-opening the exact fork-time RCE the gate exists to close (the opposite of fail-safe).
Under-trust: interactive --trust-project --posture strict (operator trusts the repo, wants approvals) used to get a working read-only subagent shell; the posture-only rule silently removed it. The live e2e's dirtyfork family (which runs --trust-project, no --posture → strict) caught this.
Fix: revert the shell axis back to cfg.TrustProject (main's behavior — the shell follows workspace trust, as it always has), and keep only the ingestion split. The dangerous git operation stays gated on explicit trust; the bot case stays fail-safe on ingestion; the interactive trusted case keeps its shell.
Making that correction now, then pushing and re-running the live e2e. Will update here once it's green.
Glad the two-axis shape landed, and the e2e catch is the right one — git worktree add performs a checkout in a repo whose .git we may not vouch for, which the main agent's Bash does not, so gating it on posture alone was wrong in both directions. Reverting the shell axis to cfg.TrustProject is the right correction.
Three things worth confirming before the correction pushes. The first looks like the same under-trust class as the dirtyfork finding, one root over.
1. Interactive --posture auto may silently lose the shell
The pushed diff has TrustProject: f.trustProject — TrustProject is now purely the flag — while applyPosture raises the new grants (ProjectIngestionGranted / SubagentShellGranted). Once the shell axis reads cfg.TrustProject again, the question is whether applyPosture still raises cfg.TrustProject on interactive roots.
If the new fields replaced that raise, then mecatui / mecated --posture autowithout--trust-project resolves TrustProject=false and loses the read-only subagent shell — where main grants it, because the ladder raised TrustProject there. That is the identical shape to the dirtyfork regression, and that e2e family would not catch it: those cases pass--trust-project.
Cheapest guard: an interactive-root e2e case with --posture auto and no--trust-project, asserting the shell is present.
2. The correction re-loses the capability ADR 0092 was written to protect
ADR 0092's stated reason for a separate knob was that TrustProject=false also nils the read-only subagent shell, "which a scheduler on --posture auto wants to keep." After the revert, a headless bot over an untrusted clone passes no --trust-project and therefore gets no subagent shell.
That is the honest trade — a .git you do not vouch for cannot be safely worktree added — but it is worth landing in ADR 0094 as a deliberate, named capability loss rather than an implicit consequence. 0092 argued the opposite, so a future reader hits a contradiction between two ADRs with nothing recording which way it was resolved and why.
3. "INDEPENDENT" stops being true, in two places that say so
The AGENTS.md line and ADR 0094 both describe the two axes as independent. After the revert, on headless roots ingestion and shell both key off --trust-project — coincident by construction. Worth restating explicitly, both so the docs match the code and so a later cleanup does not "simplify" the split away and reintroduce the original coupling.
A precision note on the threat model
A filter driver needs its command defined in git config (filter.<name>.smudge); .gitattributes only names it, and git clone does not import the remote's config. So a freshly cloned repo is not exposed by that particular route — the RCE needs an attacker-controlled .git/config, or hooks / core.hooksPath / core.fsmonitor.
That sharpens the gate rather than weakening it, and raises a follow-on: if .git is attacker-controlled then every git invocation in that repo is dangerous, not only worktree add. mecatl runs fork-time git elsewhere (per the env-scrub note in AGENTS.md) — worth confirming those invocations sit behind the same trust check, otherwise the gate covers the shell while a sibling path stays open.
Consumer note
This shape makes scheduler runs bimodal: for a repository the operator vouches for, titlani passes --trust-project and the run gets steering plus shell; for a third-party clone it gets neither. That is the correct default and we will take it. It needs a per-repo trust knob on our side, which we will file against the final field names once #364 lands rather than guess at them now.
🤖 Filed from Claude Code on behalf of the titlani#40 work.
Final status: PR #364 is green, including both e2e-live jobs, and the trust model has converged after the live-e2e/titlani review.
Final design (ADR 0095)
There is now one effective positive workspace-trust decision: TrustProject.
Interactive roots preserve current behavior: the trusted/auto/yolo posture ladder may raise the trust floor, so a developer's own repo keeps its steering + read-only child shell.
Headless roots never receive trust from the posture ladder. Only explicit --trust-project, user-global trustedWorkspaces:, or an undrifted remembered trust decision can admit the repo.
Every successful trust source intentionally admits both project-tier steering (through projectIngestionAdmitted) and the read-only worktree shell.
An untrusted headless auto/yolo run gets neither steering nor the child shell. This is the deliberate fail-safe capability loss: the repo's .git is not vouched.
mecatequi now has --trust-project default OFF. The temporary --no-project-trust flag/YAML key are removed. Declared/remembered trust now behaves like explicit trust and admits both steering + shell.
--print-posture uses the same root-aware projection as Build; posture narration runs after the authoritative trust fold; all read-only fork/workspace git paths were audited as trust-gated, hardened, or force-copy/no-git. ADR 0095 is Accepted; ADR 0094 and ADR 0092 are Superseded.
All local and PR gates pass, including both live OpenRouter suites. Independent spec/security/architecture/QA/standards review found no blockers.
Activity
JAORMX commentedon Aug 5, 2026
Consumer-side view from titlani: consider a positive grant on
mecatequirather than a suppressorContext: titlani#40 is the consumer that surfaced this, and its kubernetes arm (titlani#51, green, awaiting merge) is ready to adopt whatever shape lands here. Before we wire it, one observation about the flag's polarity — raising it now while #364 is still open.
The flag this issue asks for already exists on three of the four roots
--trust-projectis defined onmecated,mecatui, andmecak8s, in each case default OFF and documented as the safe stance:mecated: "Default OFF (the safe stance): an untrusted repo's permission grants are ignored."mecatui: "Default OFF (the safe stance, unified with mecated): an untrusted repo's permission grants and project soul are ignored."mecak8s: "Default OFF (the safe stance); an alias for--posture=trusted."mecatequihas no such flag. On that root the only route toTrustProjectis the posture ladder — and a scheduler-driven run must pass--posture auto, sincestrictcancels on the first mutating call with no approver. So on the one headless binary a scheduler actually invokes, project trust is neither opt-in nor opt-out: it is an unavoidable consequence of the only posture that works.That looks like the actual defect. Not "we need a way to turn trust off," but "
mecatequinever got the positive grant its siblings have, so the ladder became the sole path and carried ingestion with it."The shape this suggests
mecatequi--trust-project(default OFF), matching the three existing roots.applyPostureraisingTrustProjecton the headless roots (mecatequi,mecak8s), so approval semantics and ingestion stop being bundled there.--no-project-trustthen has nothing to suppress and can be dropped (or kept briefly as a deprecated alias).Net effect for a scheduler: it opts in for a repository it trusts, and a freshly-cloned third-party repo contributes no steering unless someone deliberately says otherwise.
Where this interacts with ADR 0092's best finding
#364 correctly identifies that
TrustProjectcarries two unrelated meanings: project-tier ingestion, and enabling the read-only subagent shell (build.go's nil-ing of the sandboxed runner). A scheduler wants the second while declining the first — which is exactly why #364 chose a separateNoProjectIngestknob rather than collapsing ontoTrustProject.That finding survives, and in fact argues for finishing the split rather than working around it: a naive
--trust-project=falseonmecatequiwould also cost us the read-only subagent shell we want to keep. So the clean end state is two independent positive capabilities — project-tier ingestion, and the subagent shell — instead of one overloaded boolean plus a suppressor and a conjunction (TrustProject && !NoProjectIngest) with its own precedence rules to reason about.Worth noting the concept is already inconsistent across roots: on
mecated"trust" means ALLOW rules; onmecatuiALLOW rules plus project soul; onmecak8sit is documented as an alias for--posture=trusted— conflating the two dimensions in the opposite direction from this issue. A fifth variant widens that spread.The counter-argument, and why it points at per-root defaults
The real cost of inverting is interactive regression: making ingestion opt-in everywhere would silently stop reading a developer's own
CLAUDE.mdinmecatui/mecated, and the failure mode is quiet — the agent simply gets less useful, with no error to notice. That argument is sound, but it applies only to the interactive roots.mecatequiandmecak8sare headless and are precisely this issue's use case, so per-root defaults get the safety without changing any interactive session's behaviour.The
AGENTS.mdgap is real work either wayPer this issue's own analysis,
AGENTS.md/CLAUDE.mddiscovery is currently gated by no trust flag on any root — the highest-value injection point is ungated today. That needs fixing regardless of polarity. Our suggestion is only that it land as "instruction ingestion follows the positive trust grant" rather than as a new negative knob.Why the consumer cares, given it is one argv token either way
The default decides what a forgotten flag costs. Under trust-by-ladder, omitting the suppressor on an untrusted clone is a silent privilege escalation: repository content becomes agent instructions, project ALLOW rules auto-approve tool calls, and the run holds a per-run bearer plus a provider key with 443 egress. Under an opt-in grant, omitting the flag merely yields a less-steered agent. A scheduler will dispatch a great many runs against repositories of varying provenance, and that asymmetry is the whole of our interest here.
Happy to take either shape — this is a polarity/default question, not a blocker on our side.
--mcp-server-insecure-http(#358, shipped in #360) is already emitted by titlani's kubernetes arm, and the same plumbing will carry whichever trust flag lands. Also flagging that #364 currently reportsCONFLICTING, in case that is news.🤖 Filed from Claude Code on behalf of the titlani#40 work.
feat(posture): opt-in project ingestion on headless roots, two-axis t…
docs(posture): ADR 0094 opt-in project ingestion; supersede ADR 0092 (#…
ci: retrigger golangci-lint with fresh staticcheck cache (#359)
JAORMX commentedon Aug 5, 2026
Status update on the implementation (PR #364), including a design correction the live e2e caught.
Where things stand
PR #364 first landed the
--no-project-trustsuppressor (ADR 0092), then — after the titlani review in the comments here argued that shape is fail-open (a forgotten flag on an untrusted clone silently trusts the repo) — was redesigned to a fail-safe opt-in shape (ADR 0094, which supersedes 0092): the overloadedTrustProjectis split into two positive grants.ProjectIngestionGranted): admits the repo's project-tier steering. Opt-in on headless roots (only explicit--trust-project); the posture ladder still grants it on interactive roots at auto/yolo (no interactive regression).mecatequigained--trust-project(default OFF), matching the other roots.SubagentShellGranted): intended to decouple the read-only worktree shell from ingestion.The fail-safe headless default works as designed:
mecatequi --posture autoon an untrusted clone now yields approvals + no repo steering, and a forgotten flag degrades to a less-steered agent rather than a hijacked one.The correction (found by the live e2e)
I keyed the subagent-shell grant off
posture >= autoalone. That's wrong in both directions, because the read-only subagent shell is more dangerous than the main agent's Bash in one specific way: it runsgit worktree add, which performs a checkout that can execute an attacker-controlled.gitattributesfilter driver in the repo's.git(the issue-#40 fork-time RCE). The main agent's Bash does not do that.So the shell grant needs workspace trust vouching for the
.gitand posture authorization — not posture alone:--posture autoon an untrusted clone would now rungit worktree addon a hostile.git— re-opening the exact fork-time RCE the gate exists to close (the opposite of fail-safe).--trust-project --posture strict(operator trusts the repo, wants approvals) used to get a working read-only subagent shell; the posture-only rule silently removed it. The live e2e'sdirtyforkfamily (which runs--trust-project, no--posture→ strict) caught this.Fix: revert the shell axis back to
cfg.TrustProject(main's behavior — the shell follows workspace trust, as it always has), and keep only the ingestion split. The dangerous git operation stays gated on explicit trust; the bot case stays fail-safe on ingestion; the interactive trusted case keeps its shell.Making that correction now, then pushing and re-running the live e2e. Will update here once it's green.
JAORMX commentedon Aug 5, 2026
Glad the two-axis shape landed, and the e2e catch is the right one —
git worktree addperforms a checkout in a repo whose.gitwe may not vouch for, which the main agent's Bash does not, so gating it on posture alone was wrong in both directions. Reverting the shell axis tocfg.TrustProjectis the right correction.Three things worth confirming before the correction pushes. The first looks like the same under-trust class as the
dirtyforkfinding, one root over.1. Interactive
--posture automay silently lose the shellThe pushed diff has
TrustProject: f.trustProject—TrustProjectis now purely the flag — whileapplyPostureraises the new grants (ProjectIngestionGranted/SubagentShellGranted). Once the shell axis readscfg.TrustProjectagain, the question is whetherapplyPosturestill raisescfg.TrustProjecton interactive roots.If the new fields replaced that raise, then
mecatui/mecated --posture autowithout--trust-projectresolvesTrustProject=falseand loses the read-only subagent shell — wheremaingrants it, because the ladder raisedTrustProjectthere. That is the identical shape to thedirtyforkregression, and that e2e family would not catch it: those cases pass--trust-project.Cheapest guard: an interactive-root e2e case with
--posture autoand no--trust-project, asserting the shell is present.2. The correction re-loses the capability ADR 0092 was written to protect
ADR 0092's stated reason for a separate knob was that
TrustProject=falsealso nils the read-only subagent shell, "which a scheduler on--posture autowants to keep." After the revert, a headless bot over an untrusted clone passes no--trust-projectand therefore gets no subagent shell.That is the honest trade — a
.gityou do not vouch for cannot be safelyworktree added — but it is worth landing in ADR 0094 as a deliberate, named capability loss rather than an implicit consequence. 0092 argued the opposite, so a future reader hits a contradiction between two ADRs with nothing recording which way it was resolved and why.3. "INDEPENDENT" stops being true, in two places that say so
The
AGENTS.mdline and ADR 0094 both describe the two axes as independent. After the revert, on headless roots ingestion and shell both key off--trust-project— coincident by construction. Worth restating explicitly, both so the docs match the code and so a later cleanup does not "simplify" the split away and reintroduce the original coupling.A precision note on the threat model
A filter driver needs its command defined in git config (
filter.<name>.smudge);.gitattributesonly names it, andgit clonedoes not import the remote's config. So a freshly cloned repo is not exposed by that particular route — the RCE needs an attacker-controlled.git/config, or hooks /core.hooksPath/core.fsmonitor.That sharpens the gate rather than weakening it, and raises a follow-on: if
.gitis attacker-controlled then every git invocation in that repo is dangerous, not onlyworktree add. mecatl runs fork-time git elsewhere (per the env-scrub note inAGENTS.md) — worth confirming those invocations sit behind the same trust check, otherwise the gate covers the shell while a sibling path stays open.Consumer note
This shape makes scheduler runs bimodal: for a repository the operator vouches for, titlani passes
--trust-projectand the run gets steering plus shell; for a third-party clone it gets neither. That is the correct default and we will take it. It needs a per-repo trust knob on our side, which we will file against the final field names once #364 lands rather than guess at them now.🤖 Filed from Claude Code on behalf of the titlani#40 work.
fix(posture): gate subagent shell on workspace trust, make TrustProje…
fix(posture): converge on one root-aware workspace trust decision (#359)
JAORMX commentedon Aug 5, 2026
Final status: PR #364 is green, including both
e2e-livejobs, and the trust model has converged after the live-e2e/titlani review.Final design (ADR 0095)
There is now one effective positive workspace-trust decision:
TrustProject.--trust-project, user-globaltrustedWorkspaces:, or an undrifted remembered trust decision can admit the repo.projectIngestionAdmitted) and the read-only worktree shell..gitis not vouched.mecatequinow has--trust-projectdefault OFF. The temporary--no-project-trustflag/YAML key are removed. Declared/remembered trust now behaves like explicit trust and admits both steering + shell.--print-postureuses the same root-aware projection asBuild; posture narration runs after the authoritative trust fold; all read-only fork/workspace git paths were audited as trust-gated, hardened, or force-copy/no-git. ADR 0095 is Accepted; ADR 0094 and ADR 0092 are Superseded.All local and PR gates pass, including both live OpenRouter suites. Independent spec/security/architecture/QA/standards review found no blockers.
PR: #364
docs(adr): make 0095 the single authoritative #359 trust ADR (#359)
fix(posture): root-aware project trust for headless scheduler runs (#359