Notari: how the gate works, and where its boundary is
Notari runs in CI, outside the agent's reach, and has two modes. Scan, the default, needs
no keys and no config: every pull request diff is checked for leaked secrets, edits to the gate's
own surfaces, and sensitive surfaces, and the evidence is posted as a status check. Boundary
adds a human-signed perimeter and contract, so the same run also measures where the change went
and issues a Change Passport, gate-signed when CI holds a gate key, that anyone can re-verify later. There is no model anywhere
in either verdict, so it cannot be prompt-injected, and every box below corresponds to a command,
a file, or a module that exists in the repository today.
Abridged from docs/scan-workflow.yml, which also carries the checkout step,
checkout-path, and the permissions block. No keys to generate, no contract to sign,
nothing to configure. pull_request_target runs it from the base branch, the pull
request is checked out into a data-only directory, and the token is never written into
that tree. Make notari/scan a required status check and a BLOCK cannot merge.
→
2AI agentuntrusted
Writes the diff, opens the PR
Claude Code, Codex, Cursor, Copilot, or a human in a hurry. The scan reads nothing from the
pull request but its diff: a contract or perimeter file added, edited, or deleted in the PR
changes nothing, because notari scan never opens one.
What it cannot do from inside this lane:
Remove the scan, because pull_request_target runs the
workflow from the base branch, not from the pull request.
Hide a secret behind a rename or a binary, because the inventory keeps both ends of a
rename and scans added, renamed, and copied files in full.
Turn a BLOCK into a green check by editing the workflow or the action manifest, because
that edit is itself a BLOCK.
→
3CIoutside the agent's reach
notari scan
The diff from the merge-base to the PR head, the same diff GitHub shows, through
the verify engine with a synthetic every-path contract, so the evidence rules are exactly
the boundary mode's:
Secrets: added, renamed, and copied files in full, and the new lines of modified files,
against the 26 vendor patterns and 6 inline shapes in secrets.py. A vendor
match is a BLOCK; a loose shape such as DB_PASSWORD = "..." is a
review.
Gate tamper: any edit under .github/workflows/, .github/actions/,
action.yml or action.yaml, the perimeter files, or the approver
key directory is a BLOCK (the GATE_TAMPER_GLOBS list in
perimeter.py).
Sensitive surfaces: CI config, dependency lockfiles, test files, agent instruction files,
and git configuration such as .gitattributes are listed for review, with
submodule pointers and symlinks.
The inventory keeps both ends of a rename, binaries, and mode-only changes.
The passport carries mode: scan and says plainly that no boundary was declared.
Exit 0 on PASS or NEEDS_REVIEW, 1 on BLOCK, 2 when no verdict could be produced, never a
silent pass.
Mode 2, the signed boundary (opt in with mode: boundary)
1Humanonce per task
Sign the boundary
notari begin "add rate limiting" --scope src/auth/** --approved-by alice --key approver.pem --expires-in 7 --repo owner/repo
Writes .notari/contract.json plus a detached .sig: the approved task,
the allowed paths, the base commit, and a contract id. --scope is required, so
the boundary is a conscious choice; --scope '**' is the explicit "anything the
perimeter permits" opt-out, and an unrestricted contract is flagged on the passport.
--repo binds the approval to one repository so a signed contract cannot be replayed
elsewhere, and --expires-in gives it a human-set deadline rather than a heuristic.
The standing perimeter of forbidden surfaces is signed separately and once, with
notari guard. The approver's private key never has to leave that machine.
→
2AI agentuntrusted
Writes the diff, opens the PR
Claude Code, Codex, Cursor, Copilot, or a human in a hurry. Notari assumes nothing about
intent here, because the check does not depend on it.
What it cannot do from inside this lane:
Edit the workflow that judges it, because pull_request_target runs the trusted
workflow from the base branch, not from the pull request.
Forge the contract or the perimeter, because both carry Ed25519 signatures it has no key for.
Weaken a strict verdict with a waiver, because .notari/exceptions.json is ignored
entirely under --strict.
→
3CIoutside the agent's reach
notari verify --strict
Deterministic, in this order, every run:
Build the authoritative changed-path inventory from
git diff --name-status -z --find-renames, keeping both ends of a rename
and including binary and mode-only changes.
Match every changed path against the signed scope.
Scan each added, renamed, or copied file in full, and the new lines of each modified file,
for the 26 vendor patterns plus 6 inline-credential shapes in secrets.py.
Classify the perimeter's review surfaces, by default CI files, lockfiles, and git
configuration such as .gitattributes that can control diff visibility.
Apply logged exceptions, which strict mode discards.
Compose the verdict and chain a verification.run event into the audit log.
Same diff, same contract, same perimeter, same keys, same verdict, explainable line by line.
The only clock it consults is the expiry a human set.
PASS
No secrets, nothing forbidden, no review surface; in boundary mode, in scope as well. Exits 0, the build goes green.
NEEDS_REVIEW
Something a human should look at (a loose secret shape, a lockfile, a submodule bump, a symlink). Exits 0 by default; set block-on-review, on in docs/secure-workflow.yml, to fail the build.
BLOCK
A vendor-format secret, a gate-tamper edit, or in boundary mode an out-of-bounds path. Exits 1, CI fails.
What you are left holding
The Change Passport
verify writes passport.json for tooling and passport.md for
the pull request. The markdown footer cites the verification.run audit MAC, so the
document traces back to the tamper-evident chain instead of asking you to trust it.
→
Anyone can re-check it
notari verify-passport passport.json
Checks the gate's Ed25519 signature on the passport against a trusted gate public key
(--gate-key), months later and on a different machine, so a
flipped verdict or a forged PASS fails. It needs the gate key CI signed with, and it does not
re-run the diff.
→
Explain it, then hand the fix to the agent
notari explain --fix-prompt
notari explain shows what is wrong and the exact git command to undo
it; --fix-prompt emits only a compact prompt for the coding
agent that lists the reverts and splits needed and tells it not to weaken, bypass, or edit
the gate to get past it. Works on scan and boundary passports alike.
How it keeps your work safe
The boundary is signed, not configured
Scope and perimeter carry Ed25519 signatures, so an agent that edits the config it
is judged by changes nothing about the verdict.
contract.py · perimeter.py
No model in the decision path
The verdict is compiled rules over a diff, so there is no prompt to inject and no
judgment to talk out of its position.
policy.py · verify.py
The record is tamper-evident
Every decision chains into an HMAC-linked audit log, including everything allowed
while the gate was paused, so an off-window is still on the record.
audit.py · pause.py
The judge sits outside the defendant
CI runs the workflow from the base branch, so the pull request cannot rewrite the
check that is about to read it.
action.yml · docs/secure-workflow.yml
Approvals cannot be replayed
A contract is bound to one repository and carries an expiry, so yesterday's yes
cannot be reused on another repo or three months later.
contract.py
Secrets are caught beyond the diff text
26 vendor patterns plus 6 inline-credential shapes are matched against every added,
renamed, or copied file in full and the new lines of every modified file, so a pure rename or a
BOM-marked UTF-16 file cannot hide one.
secrets.py
What it does not do, stated plainly because a security claim without limits is marketing
It does not judge whether the code is correct, safe, or good.
It does not see system calls, only the diff and the gated tool calls.
It does not see what an interpreter does once it is already running.
It does not see network bytes leaving the machine.
The optional local hook is defense in depth, not a hard boundary.
The commit-status source is spoof-detectable, not yet spoof-resistant.
Eleven of twelve documented bypass shapes BLOCK against a freshly signed perimeter, and the
twelfth is the known line-split secret limit, which is published rather than hidden. Run them
yourself with bash examples/bypass_probes.sh, and read
docs/SECURITY-MODEL.md before trusting any one-line claim here.