# Prompt-injection defences

The [Fable follow-up](2026-11-19-injection-defences-follow-up.md) supersedes
the diagnostic, browser-preview and scanner details below.

Paul approved this work on 2026-11-19 after Fable's review of
oficina/equipo main 449e9c14. Implementation starts from main abed8933.
Authority comes from a person's tap or a standing project setting they chose,
combined with deterministic checks. Model text cannot grant authority.

## Merge (H1)

The checks executor takes gate definitions from BaseSHA and runs them against
candidate source. Pin .amadan/ci, .amadan/ci.d, Makefiles and a base-declared
list of supporting gate files. Candidate changes cannot select the gate.
Missing or unreadable base evidence fails closed. Hosted CI that executes
candidate definitions cannot substitute for base-run checks.

The base must contain `.equipo/gates.json` version 1 with an explicit `files`
list of gate dependencies. Missing contracts or declared files report
`base_gate_unavailable`; a contract added by the candidate cannot certify that
candidate. Existing projects need an owner-approved bootstrap commit before
base-run checks can certify later work. Mac worker results remain diagnostic
until their executor can enforce immutable base gates, and cannot grant
standing auto-merge authority.

Both checked and unchecked decisions evaluate change criteria. For checked
work, the additional human decision is limited to edits to gate files or a
truncated Review diff. Existing execution, review, sandbox, hold and project
policy checks still apply. The owner can enable “Auto-merge even when CI files
change” for the project to allow those cases with passing base-run checks.
The setting starts off. Review receives the diff as quoted data that cannot
close its own framing. Older runners cannot certify the new guarantees.

## Previews (H2)

Use the paired private devbox preview host by default, without a tap. Public
Carloku temporary previews require the owner's “Publish previews publicly”
project setting, initially off. Recheck current authority at publish time.
Every export receives a fixed _headers Content-Security-Policy restricting
connections, scripts, images, forms and frames to the required local surface.
Scan exports for secrets using trusted scanner definitions before any publish.
A finding or unavailable scanner refuses publication with a clear status card.

CARLOS must accept Content-Security-Policy through its static-header parser.
The inspected platform main (0acb2767) and installed CLI v0.35.5 reject these
headers during archive packing, before publication. Equipo reports that the host
needs an update. A separate tested platform patch is required; this task deploys
nothing. Restart reconciliation only advertises previews with the new runner-owned
security stamp, which is written after policy installation and the secret scan.

## Person text and prompts (M5, M4)

Research pre-approval uses composer-origin messages only. Notebook person
entries must preserve a whole composer sentence, including any negation.
A tapped generated choice is never treated as the person's prose. Historical
notebook entries have no original composer reference. Their text, IDs and times
are preserved, but their source becomes an agent note on upgrade. Old runner
reports cannot restore their person attribution.
CI tails, Review findings and coordinator brief material enter Engineering
prompts as quoted data with source labels. Person words remain separate.
Correct the stale claim that every merge needs a fresh tap.

## Settings and verification

Add the two settings to the existing Settings shell and project roster style
under “What Equipo can do on its own”. Owners edit them with current-roster
checks inside the transaction, revision conflicts and an audit event. Keep the
storage extensible, but expose only these two actions. Revoked owners confer
no continuing authority. Add migration and protocol numbers after main only
where the contract changes require them.

Write failing tests before fixes, then break each guard and observe its test
fail before restoring it. Run targeted tests and the requested budget, dead
reference, lane and copy release gates. Record mutations and CI in ../report.md.
New UI copy receives the delegated Astra pass authorised by Paul; no copy
review server. Push both branches without merging or deploying.

The hosted-runner spec receives H3 offline sandbox and mirror boundaries,
M4 quoting, M8 checkpoint provenance and controller-bound certification, and
the five authority rules on design-hosted-runners in a separate commit.
