Repository navigation
feat(identitybroker): add validated startup foundation for the agent identity broker - #2442
Merged
Merged
Conversation
…identity broker Add internal/identitybroker, the in-process core of the agent identity broker from the agent identity design (docs/drafts/agent-identity). New(config, definitions, signer) validates and keeps independently owned copies of: - configuration: SPIFFE trust domain, the single audience (the broker's), and a credential lifetime of at most one hour, an interim cap the design does not set; - an ECDSA P-256 (ES256) crypto.Signer, the smallest algorithm JWT-SVID permits; - already-loaded definition records: source, name, revision, and provenance with SHA-256 source and definition digests. Identical duplicate records collapse; conflicting ones are rejected. New rejects the whole set on any invalid record; DefinitionRecord.Validate lets the definition loader skip bad records first, as the design requires. Definition(ref) returns a copy. Errors wrap one of four sentinels. Signer and records come only from tests until mecak8s startup and the definition loader exist. The package imports only the standard library, enforced by a new depguard rule that also denies os, net, log, syscall, crypto/tls, and plugin, so file, network, and logging access stay in adapters. Co-authored-by: Mecatl <[email protected]>
jhrozek
approved these changes
Oct 20, 2026
This was referenced Oct 20, 2026
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/identitybroker, the in-process core of the agent identity broker from the agent identity design. This is the startup foundation every later identity change builds on: the broker's configuration, signing key, and known agent definitions, validated before anything registers.identitybroker.New(config, definitions, signer)validates and keeps independent copies of:crypto.Signer;DefinitionRecord.Validatelets the future definition loader skip bad records.Definition(ref)returns a copy.internal-identitybrokerdepguard rule keeps the package standard-library only and deniesos,net,log,syscall,crypto/tls, andplugin.Nothing calls the package yet. For now, the signer and definition records come only from tests; mecak8s startup and the definition loader supply them in later changes.
Closes #2445
Issue relationship
Relates to #2121
Type of change
Test plan
Baseline checks
task lint): root module clean, includinginternal/identitybrokerand the new depguard rule. The run stops at a pre-existing gosec G703 finding inenvironment/microvm/launch_ownership_darwin.go:754, which is darwin-only and untouched here.task test): covered by the race suite below.task test:race):internal/identitybrokerpasses. Failures incmd/mecated,cmd/mecatui, andenvironment/microvm/gitexecreproduce on unmodifiedmain(8ae7d901b) on the same macOS machine and are unrelated to this change. Oneenvironment/microvmtiming test failed once and passed on rerun.go run ./cmd/mecademo): tool call, permission ask and approval, and result shown.task docs): no Markdown changes.task site:build)task api:check)task api:update+engine/CHANGELOG.mdChanges
internal/identitybroker/broker.goNew,Broker,Definition, signer checks, the definition snapshot, and error sentinelsinternal/identitybroker/config.goConfigand its validationinternal/identitybroker/definition.goDefinitionRef,Digest,Provenance,DefinitionRecord, andValidateinternal/identitybroker/broker_test.go.golangci.ymlinternal-identitybrokerdepguard ruleUser-facing change
None.
Special notes for reviewers
Decisions the design leaves open or doesn't spell out:
Newis strict. One invalid record rejects the whole set. The design says the broker serves the definitions that loaded and skips the ones that fail; that filtering is the loader's job, throughDefinitionRecord.Validate.globalandsystemdefinitions. Repository definitions never enter it; mecak8s reports them at registration.*ecdsa.PrivateKeyis copied; any othercrypto.Signer, such as a KMS handle, is kept as supplied.API compatibility: no remote-observable change. The package is internal, not wired into any server, and adds no protobuf, gRPC, HTTP, or engine API surface. No major or feature-identifier change.