Skip to content

Commit 4b736d7

Browse files
authored
Merge pull request #12 from thinksyncs/feat/formal-assurance
feat(formal): add binding assurance models
2 parents 005f5f6 + 7146f8c commit 4b736d7

15 files changed

Lines changed: 1617 additions & 116 deletions

README.md

Lines changed: 82 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,45 @@
11
# Agents Secure Binding
22

3-
## Status
4-
5-
Draft status: repository security-hardening draft.
6-
7-
Current source of truth: `docs/SSOT.md`, Draft v0.5-review2.
8-
9-
Standards status: this is not an IETF consensus document and does not define a
10-
new TLS handshake, TLS extension, attestation evidence format, identity
11-
provider, or application protocol.
12-
13-
Evaluation boundary: the v0.4 evaluation is useful implementation evidence for
14-
the checked fail-closed verifier behavior. It is not a formal proof and should
15-
not be cited as validation of TLS, attestation formats, or all deployments. The
16-
latest recorded remote implementation checkpoint is commit
17-
`b493d2c3733cd0fa5c35035175f5f9d3466f92f7`: GitHub Actions `CI` run
18-
`28431874162` and `Security Red Team` run `28431874166` both completed
19-
successfully on 2026-06-30 UTC.
20-
21-
## What This Is / Is Not
22-
23-
Agents Secure Binding implements one experimental Direct-Agent binding profile
24-
based on the core acceptance rules. It is not the draft itself, and it does not
25-
claim to implement every binding profile.
3+
Agents Secure Binding is a verifier-side acceptance profile and implementation
4+
repository for binding an Agent identity to the session, context, attestation
5+
facts, and local policy under which it is accepted.
266

277
A verifier accepts an Agent only when a verified authority grant,
288
holder-of-key proof, accepted TLS or exported-authenticator session, freshness
299
and replay state, any required attestation result, and verifier-local policy
3010
all describe the same intended interaction.
3111

32-
This repository contains profile text, implementation helpers, tests, vectors,
33-
and derived notes for that acceptance rule.
34-
35-
The Direct-Agent runtime implementation is centered on `pkg/clients`,
36-
`pkg/atls`, and `pkg/atls/identitypolicy`. The `pkg/atls` name is a legacy
37-
implementation package name from the inherited codebase; it does not mean this
38-
repository defines attested TLS or a TLS extension. The legacy-named `pkg/agtp`
39-
package is retained as an experimental reference-adapter surface for JWT/JWS,
40-
CWT/COSE, and gateway-route policy experiments; it is not the core verifier
41-
dependency.
42-
43-
This profile is not:
12+
The primary failure class is context diversion: accepting cryptographically
13+
valid material for a different service, tenant, Agent, task, delegation, or
14+
authority boundary than the verifier intended.
4415

45-
- a TLS extension;
46-
- an attestation evidence format;
47-
- an identity provider;
48-
- a holder-side presentation format;
49-
- a registry, control plane, gateway, or application protocol;
50-
- a replacement for AGTP, A2A, Cocos, TLS, OAuth/OIDC, or remote attestation
51-
standards;
52-
- new cryptography.
16+
## Acceptance Contract
5317

54-
Application protocols can carry the profile material, but they do not by
55-
themselves supply the verifier-side acceptance rule.
18+
The verifier evaluates one ordered contract:
5619

57-
Wallets are optional presentation or signing components, not trust roots or
58-
sources of expected policy. Gateway-routed mode is out of scope for this
59-
Direct-Agent implementation surface.
20+
1. Authenticate the authority grant and its policy scope.
21+
2. Verify holder-of-key proof over the exact grant and accepted session.
22+
3. Check freshness, nonce, and replay state.
23+
4. Bind any required attestation result to the same session.
24+
5. Compare authenticated observed values with verifier-local expected policy.
25+
6. Commit one-shot replay state before returning the accepted identity.
6026

61-
Review boundary:
27+
The core implementation is centered on `pkg/clients`, `pkg/atls`, and
28+
`pkg/atls/identitypolicy`. `pkg/agtp` contains reference adapters for JWT/JWS,
29+
CWT/COSE, and gateway-route policy experiments.
6230

63-
- TLS 1.3, certificate-path validation, exporter computation, and key-schedule
64-
security are delegated to the deployment TLS stack. This repository consumes
65-
an already accepted TLS connection.
66-
- Attestation evidence formats and appraisal policy are delegated to the
67-
concrete binding profile or deployment appraisal profile. This repository
68-
checks the accepted binder value when that profile supplies one.
69-
- The red-team evidence supports the tested fail-closed verifier behavior. It
70-
is not a formal proof and does not validate every deployment topology.
71-
- Legacy package names such as `pkg/atls` and `pkg/agtp` are implementation
72-
compatibility names. They do not define the protocol trust model.
73-
74-
## Start Here
31+
## Repository Map
7532

7633
- `docs/SSOT.md`: normative repository source for profile behavior, dimensions,
7734
verification order, and compatibility notes.
7835
- `docs/threat-model.md`: explanatory relay, replay, diversion, wrong-Agent,
7936
gateway-route, downgrade, and privacy threat model.
8037
- `docs/live-red-team-report.md`: current live-style red-team evidence and
8138
evaluation boundaries.
39+
- `formal/`: ProVerif and TLA+ models, recorded results, and
40+
model-to-implementation traceability.
41+
- `pkg/clients`, `pkg/atls`, and `pkg/atls/identitypolicy`: Direct-Agent
42+
acceptance implementation.
8243
- `PUBLICATION_TODO.md`: publication blockers, inherited runtime risk
8344
classification, module identity choice, and CI/red-team checkpoint status.
8445

@@ -89,9 +50,8 @@ profile-authenticated Agent identity unless the verified grant, proof, accepted
8950
session, freshness state, replay state, any required attestation result, and
9051
local policy identify the same intended interaction.
9152

92-
This profile uses D0 through D6 as acceptance dimensions. These labels are for
93-
policy separation and diagnostics. They are not OSI layers, wire-format layers,
94-
or a trust hierarchy.
53+
This profile uses D0 through D6 as acceptance dimensions for policy separation
54+
and diagnostics.
9555

9656
| Dimension | Verification target | Main failure class |
9757
| --- | --- | --- |
@@ -119,9 +79,9 @@ them deterministically and do not repair peer-provided aliases, display labels,
11979
URI variants, natural-language phrases, or model interpretations in the final
12080
acceptance path.
12181

122-
## Evaluation Status
82+
## Evaluation Evidence
12383

124-
Covered in the current v0.4 evidence:
84+
The current v0.4 evidence covers:
12585

12686
- focused local checks and unit-level coverage;
12787
- positive and negative profile vectors;
@@ -132,24 +92,35 @@ Covered in the current v0.4 evidence:
13292
early-data pre-binding rejection, malformed token corpora, bounded fuzz smoke
13393
for compact JWT/JWS parsing, and deterministic acceptance invariants;
13494
- route-assertion policy tests and a local HTTP route-assertion harness for the
135-
documented gateway boundary, with no runtime gateway mode.
95+
documented gateway boundary.
13696

13797
For accepted TLS sessions, the AGTP observed-identity path derives
13898
`tls_exporter_sha256` from the accepted `tls.ConnectionState`. Fixed exporter
13999
bytes are used only in synthetic unit fixtures.
140100

141-
Not yet validated as a broad deployment security claim:
101+
The latest recorded remote implementation checkpoint is commit
102+
`444b81d2484214b2247b31013b372f73937808c7`. GitHub Actions `CI` run
103+
`28434430030` and `Security Red Team` run `28434430103` both completed
104+
successfully on 2026-06-30 UTC.
105+
106+
See `docs/live-red-team-report.md` for the evidence matrix.
107+
108+
## Formal Assurance
109+
110+
The repository includes two complementary formal models:
142111

143-
- end-to-end application 0-RTT payload behavior beyond the dependency-free
144-
QUIC/TLS early-data harness;
145-
- broader gRPC deployment pooling beyond the local reuse harness;
146-
- runtime gateway wiring beyond the route-assertion HTTP harness;
147-
- longer fuzz/property campaigns beyond the bounded token-parser smoke target
148-
and the current 60-second local fuzz pass;
149-
- hardware-backed confidential-VM attestation replay coverage.
112+
- `formal/proverif/binding_acceptance.pv` checks signing-key secrecy,
113+
correspondence from acceptance to an authority-issued grant and exact Agent
114+
binding, and injective Agent-binding correspondence. ProVerif 2.05 reported
115+
all five selected queries as true.
116+
- `formal/tla/DurableGate.tla` checks a generic durable-state target contract
117+
for replay, revocation, leases, audit delivery, restart, failure handling,
118+
and logical time. TLC generated 7,692,655 states and found 1,555,674 distinct
119+
states without an invariant violation in the recorded finite configuration.
150120

151-
See `docs/live-red-team-report.md` for the evidence matrix and
152-
`PUBLICATION_TODO.md` for release blockers.
121+
`formal/MODEL_MAP.md` identifies the current implementation surface for the
122+
binding model and the remaining implementation boundary for the durable-state
123+
model.
153124

154125
## Implementation Provenance
155126

@@ -159,9 +130,6 @@ manager, agent, HAL, proxy, OCI, and helper code from
159130
profile-specific documentation, tests, vectors, and security-profile helpers
160131
for Agents Secure Binding.
161132

162-
Cocos remains implementation provenance and experience. It is not the normative
163-
scope of this security profile.
164-
165133
The repository keeps the Apache-2.0 license and retained upstream notices. See
166134
`ATTRIBUTION.md`.
167135

@@ -197,9 +165,6 @@ Product security gate:
197165
make product-security-gate
198166
```
199167

200-
Some client and red-team tests open local loopback listeners. Restricted
201-
sandboxes may need a less constrained local environment for those tests.
202-
203168
## Security Reporting
204169

205170
Report suspected vulnerabilities through GitHub private vulnerability reporting
@@ -216,3 +181,37 @@ maintainer.
216181

217182
This repository currently keeps the original Apache-2.0 license and retained
218183
upstream notices. See `ATTRIBUTION.md`.
184+
185+
## Caveats and Scope Boundaries
186+
187+
- The core verifier-side acceptance profile is frozen for review. The current
188+
standards-facing baseline should change only for submission errors,
189+
reviewer-requested fixes, factual corrections, broken references, or
190+
requirements ambiguity.
191+
- This repository is a non-normative implementation and evidence repository
192+
for one experimental Direct-Agent binding profile. It is not an IETF
193+
consensus document and does not define a TLS handshake or extension,
194+
attestation evidence format, identity provider, holder-side presentation
195+
format, registry, control plane, gateway, or application protocol.
196+
- TLS 1.3, certificate-path validation, exporter computation, and key-schedule
197+
security remain the responsibility of the deployment TLS stack. Attestation
198+
formats and appraisal policy remain the responsibility of the selected
199+
binding and deployment profiles.
200+
- Gateway-routed runtime wiring is outside the current Direct-Agent
201+
implementation. Wallets can provide presentation or signing functions, but
202+
are not trust roots or sources of verifier-local expected policy.
203+
- The v0.4 evaluation is evidence for the tested fail-closed verifier behavior,
204+
not a formal proof or validation of every deployment. Broader application
205+
0-RTT behavior, production gRPC pooling, runtime gateway wiring, longer
206+
fuzz/property campaigns, and hardware-backed confidential-VM attestation
207+
replay remain outside the recorded evaluation.
208+
- The ProVerif model uses symbolic cryptography and does not prove TLS, X.509,
209+
JWT parsing, certificate handling, or equivalence with compiled Go code. The
210+
TLA+ result is bounded evidence for a generic target state machine; the
211+
current Go tree does not implement its complete durable snapshot, revocation,
212+
lease, audit-outbox, or logical-time contract.
213+
- `pkg/atls` and `pkg/agtp` are legacy compatibility names and do not define the
214+
protocol trust model. Cocos is implementation provenance rather than the
215+
normative scope of the profile.
216+
- Some client and red-team tests open local loopback listeners and may require
217+
a less restricted test environment.

formal/MODEL_MAP.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Model-to-implementation map
2+
3+
This map is traceability evidence. It is not a machine-checked proof that the
4+
Go implementation refines either model.
5+
6+
## Core binding acceptance
7+
8+
| Model term | Current implementation surface |
9+
| --- | --- |
10+
| `grant_payload`, `grant_issued` | `clients.VerifyIdentityGrantJWT` produces an authenticated `identitypolicy.VerifiedGrant` from locally accepted issuer, audience, method, and key policy |
11+
| `binding_payload`, `agent_bound` | `clients.VerifySessionBindingJWT` produces an authenticated `identitypolicy.VerifiedSessionBindingStatement` |
12+
| Grant-to-holder authorization | `identitypolicy.ValidateSessionBindingStatement` checks grant hash, audience, confirmation or authorized endpoint key, signer separation, and lifetime |
13+
| Exporter, request context, and attestation binder | `identitypolicy.Binding`; `atls.IdentityBindingFromConnectionState` derives accepted-session values |
14+
| Exact local semantic policy | `identitypolicy.Policy.ValidateAssertion` compares verified observed values with verifier-local expected values |
15+
| One-shot nonce use | `identitypolicy.MarkSessionBindingUsed` and the caller-supplied `identitypolicy.ReplayCache` |
16+
| `accepted` | Successful `clients.VerifySessionIdentityJWT`, after grant and session-proof verification, local policy comparison, and replay marking |
17+
18+
The ProVerif model idealizes signatures, hashing, and fresh session inputs. It
19+
does not model the JWT parser, Go error paths, certificate validation, replay
20+
store failure, time arithmetic, or the concrete TLS exporter implementation.
21+
22+
## Durable gate target
23+
24+
`tla/DurableGate.tla` has no current implementation mapping in this repository.
25+
The public Go tree exposes in-process and SETNX-style replay-cache adapters, but
26+
it does not implement the model's single durable snapshot containing
27+
revocations, leases, an audit outbox, and a persistent logical-time floor.
28+
29+
The TLA+ result therefore supports review of a possible application-level
30+
contract only. It must not be cited as evidence that current Go packages have
31+
durable crash-recovery or revocation semantics.

formal/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Formal assurance
2+
3+
This directory contains non-normative formal models supporting narrow security
4+
claims. The repository source of truth remains `docs/SSOT.md`.
5+
6+
The models are deliberately separated by their relationship to the Go tree:
7+
8+
- `proverif/binding_acceptance.pv` models the current core binding acceptance
9+
contract at a symbolic protocol level. `MODEL_MAP.md` records the intended
10+
correspondence to current packages.
11+
- `tla/DurableGate.tla` is a generic target contract for an application that
12+
adds durable replay, revocation, lease, audit-outbox, crash-recovery, and
13+
logical-time state. The current Go tree does not implement that complete
14+
state machine.
15+
16+
Passing a model proves only the queries or invariants stated in that model
17+
under its assumptions. It does not prove TLS, X.509, JWT parsing, filesystem
18+
semantics, the Go implementation, or semantic correctness of an Agent's work.
19+
20+
Application-specific workflows and privacy experiments are intentionally not
21+
part of this directory.

formal/proverif/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Core binding ProVerif model
2+
3+
`binding_acceptance.pv` models a narrow symbolic contract:
4+
5+
- an authority-signed grant authorizes one Agent key, audience, semantic value
6+
tuple, and grant identifier;
7+
- the Agent signs the exact grant digest, exporter, nonce, request context, and
8+
attestation binder for one modeled session; and
9+
- acceptance corresponds to both prior events, with an injective
10+
Agent-binding correspondence across fresh modeled sessions.
11+
12+
Run the model with ProVerif 2.05:
13+
14+
```sh
15+
sh formal/proverif/run.sh
16+
```
17+
18+
The runner uses `proverif` from `PATH`, or `opam exec -- proverif`.
19+
20+
## Interpretation boundary
21+
22+
The model uses ideal symbolic signatures and hashing and gives the public
23+
network to an active attacker. The exact D3 through D6 policy values are
24+
abstracted as one `required_values` term. Fresh exporter, nonce, request
25+
context, and attestation binder values are selected for each modeled session.
26+
27+
This checks use of those values by the symbolic protocol. It does not verify:
28+
29+
- TLS, exported authenticators, X.509, or an attestation format;
30+
- JWT/JWS parsing, JSON handling, or algorithm selection;
31+
- time, certificate validity, or key lifecycle;
32+
- replay-cache durability, crash recovery, or multi-replica behavior; or
33+
- correspondence between the model and compiled Go code.
34+
35+
See `../MODEL_MAP.md` for implementation traceability and `RESULTS.md` for the
36+
recorded tool result.

formal/proverif/RESULTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Recorded ProVerif result
2+
3+
The public model was checked locally on 2026-07-30 with ProVerif 2.05:
4+
5+
```sh
6+
sh formal/proverif/run.sh
7+
```
8+
9+
ProVerif reported all five selected queries as true:
10+
11+
```text
12+
RESULT not attacker(authority_key[]) is true.
13+
RESULT not attacker(agent_a_key[]) is true.
14+
RESULT not attacker(agent_b_key[]) is true.
15+
RESULT event(accepted(...)) ==> event(grant_issued(...)) && event(agent_bound(...)) is true.
16+
RESULT inj-event(accepted(...)) ==> inj-event(agent_bound(...)) is true.
17+
```
18+
19+
The result establishes secrecy of the three modeled signing keys,
20+
correspondence from acceptance to both an authority-issued grant and an exact
21+
Agent binding, and injective correspondence from acceptance to that binding
22+
event, under the model's symbolic assumptions. It does not establish
23+
implementation equivalence, durable-state behavior, certificate parsing, or
24+
application-specific privacy properties.

0 commit comments

Comments
 (0)