Skip to content

[M1.4b2] Agent confirmation verifier and confirmed volume removal - #150

Merged
samuelmbabhazi merged 4 commits into
mainfrom
feat/m1.4b2-confirmation-verifier
Nov 5, 2026
Merged

samuelmbabhazi merged 4 commits into
mainfrom
feat/m1.4b2-confirmation-verifier

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Closes #135 (with #149).

What changed

M1.4b2: the agent verifies confirmation tokens and removes volumes only with one.

  • agent/internal/confirm. A Go verifier as strict as the control plane's parser (SPEC 3.6):
    • the exact header, the exact claim set in canonical order (re-encoded and byte-compared, with HTML escaping off), unknown fields disallowed;
    • strict unpadded base64url, a 64-byte signature, at most 2 KiB.
    • It then checks the Ed25519 signature with the public key received at enrollment, that org is the agent's own organization, that action and target match, that iat is at most 60 s ahead and that the token is unexpired.
    • Finally it spends the jti in the journal's used_confirmations table.
    • Every failure gives the single ErrRejected.
  • remove_volume handler:
    • the plan rejects malformed names and tokens without touching any state;
    • step 1, confirm, verifies and spends a volume.remove token for exactly that volume. It is not retryable: after an uncertain crash, the operator needs a new confirmation;
    • step 2, remove, is idempotent, removes the volume only if it carries sk.managed=true and treats an already-missing volume as done.
  • Wiring. The agent builds the verifier from the bundle's confirmation key and organization, and registers the handler.
  • Docs. SPEC 3.6 describes agent verification. The PLAN ticks M1.4b. The control plane will issue volume.remove confirmations once volumes are resources (M5).

How it was tested

  • Cross-language vector. A token signed by Node.js with a fixed test key, exactly as the control plane signs, verifies in Go. A replay is refused.
  • Binding. Other target, other action, other organization, expired, and issued in the future: all rejected.
  • Malformed and forged tokens, 12 cases: alg: none, a reordered header, padding, an extra claim, an unknown claim, whitespace, a longer lifetime, a truncated signature, a signature from another key, oversize. All rejected.
  • Fuzz target: no altered token verifies.
  • Handler: no removal with a rejected confirmation; the confirmed removal of a managed volume works; an unmanaged volume is refused; malformed tokens and traversal names never reach the daemon.
  • The test tokens are marked gitleaks:allow: they are signed with a fixed, public test seed (0x07…), so they are not secrets.
  • go test -race ./agent/..., golangci-lint (0 issues) and the local gate pass.

Security considerations

  • Destructive volume removal now needs a single-use token bound to the organization, action and volume.
  • The verifier is fail-closed with a uniform error.

@samuelmbabhazi
samuelmbabhazi merged commit b10f0d1 into main Nov 5, 2026
1 of 10 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m1.4b2-confirmation-verifier branch November 5, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M1.4b] Docker adapter for networks, images and volumes, with confirmation verification

1 participant