Skip to content

[M1.2c1] Persist validated agent credentials atomically - #32

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m1.2c1-agent-credentials
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m1.2c1-agent-credentials

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Implements the first part of M1.2c: node keys and credentials that remain coherent across enrollment and renewal. Depends on #31; this PR intentionally targets its branch.

The agent generates Ed25519 keys and signed CSRs, validates the key/certificate pair against the installation CA and exact tenant/node SPIFFE identity, and persists one atomic credential generation. Loading rejects symlinks, loose permissions, oversized files, mismatched identities and invalid certificates. The private key uses the redacting Secret wrapper and is exposed only at TLS and explicit persistence boundaries.

Validation: Go tests with the race detector, golangci-lint, TypeScript lint/typecheck and unit tests, protobuf lint/format. Regression tests cover forged identities, substituted keys/CAs, failed replacements, secret formatting and file permissions. No new dependencies, remote actions or database writes. Plan, specification and threat model updated.

  • M1.2c1 acceptance criteria and regression tests
  • No shell invocation or secret logging
  • Atomic persistence with 0600 files
  • Documentation updated
  • CI and maintainer review

M1.2c remains open for enrollment, streaming and reconnect/renewal scheduling. No merge requested.

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.2b2-agent-gateway branch from 24806b7 to 60615f9 Compare November 5, 2026 13:35
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.2c1-agent-credentials branch from a4ce5a7 to f043040 Compare November 5, 2026 13:36
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.2b2-agent-gateway branch from 60615f9 to 34bbf2a Compare November 5, 2026 14:23
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m1.2b2-agent-gateway to main November 5, 2026 14:24
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.2c1-agent-credentials branch from f043040 to 5465689 Compare November 5, 2026 14:25
@samuelmbabhazi
samuelmbabhazi merged commit 8a97e1f into main Nov 5, 2026
2 of 11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m1.2c1-agent-credentials branch November 5, 2026 14:26
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
Implements M1.2c2: the Go agent can enroll and rotate its Ed25519
key/certificate through the TLS gateway. Depends on #32 and targets its
branch.

Before sending a join token, a payload-free TLS probe verifies the
installation CA fingerprint, server chain, hostname and validity.
Enrollment then uses standard TLS verification against that pinned root.
The gateway now includes its public CA chain in its server handshake.
Returned credentials are bound to the same CA and exact
node/organization identity; renewal rotates both key and certificate.
Unary calls have a 30-second deadline and 64 KiB message limits. Remote
error text is sanitized to avoid token echoing.

Validation: real TLS/gRPC Go tests with race detection; wrong pin, rogue
CA, hostname mismatch, expired server, oversized request and token-echo
tests; golangci-lint; pnpm lint; real PostgreSQL/TLS integration suite.
Existing Go gRPC dependencies are now declared directly in the agent
module.

Security: the bootstrap-only `InsecureSkipVerify` is paired with a
mandatory custom verifier that performs chain, hostname, validity and
pin checks. It carries no application data. All RPCs use normal TLS
verification. Missing pins are allowed only in explicit development
mode, consistent with existing configuration.

- [x] M1.2c2 acceptance tests
- [x] No shell invocation, secret logging or extra database writes
- [x] Specification and threat model updated
- [ ] CI and maintainer review

The daemon connection loop and gateway streaming remain in M1.2c3/c4. No
merge requested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant