Repository navigation
refactor(dir): prepare feat/identity-add for the ans scheme (ANS-1) - #2211
Closed
kperry-godaddy wants to merge 7 commits into
Closed
kperry-godaddy wants to merge 7 commits into
kperry-godaddy wants to merge 7 commits into
Conversation
… removes the protos feat/identity-add dropped the managed go_package entry for agntcy/dir/naming/v1 while the naming protos and their generated Go code are still present, so buf generate cannot determine a Go import path for them and task gen fails on every branch built on it. The entry comes back until the protos are removed together with naming.v1. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]>
A claim signed with a plain key, the command's own first example, failed flag validation because --key and --cert were declared required together. --key is required on its own; --cert is optional, applies to spiffe:// subjects only and needs the key it certifies. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…w the task in the samples Neither the reconciler loader nor the daemon loader bound identity.enabled or identity.interval, and no shipped configuration file mentions the task, so viper's AutomaticEnv never resolved RECONCILER_IDENTITY_* or DIRECTORY_DAEMON_RECONCILER_IDENTITY_*: the keys took effect only when a configuration file happened to contain them, and the task could not be enabled from the environment at all. Both loaders bind the two keys, with the task off by default and the reconciler defaulting the interval to the task's own default. The compose environment, the daemon configuration and the Helm values show the block commented out. It stays off because the task does not yet read record annotations and marks every claim failed at this base. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e reconciler lint findings server.New and Service.registerTasks each built the identity claim verification dependencies inline: the SPIFFE trust bundles and the resolver registry for dns, https and did subjects. That block now lives in one helper per composition root, newIngestor in the server and newIdentityTask in the reconciler, each with its own table-driven test. The extraction is behaviour-preserving: the same constructors run in the same order with the same error text, and the unchanged callers only gain an early return on the helper's error. The identity reconciler task's two claim walkers were duplicates of each other apart from the referrer type, the proto type and the role. A generic reconcileClaim now carries the shared walk, decode, verify and upsert flow for both, with the two exported verify functions passed as values; the per-kind log and error text is preserved verbatim, and a table-driven test covers both roles, undecodable referrers and walk and upsert failures. This clears every finding of the pinned golangci-lint in the reconciler module: gocognit (32) and nestif (6) on registerTasks and the dupl pair in tasks/identity/task.go. In the server module it clears the maintidx finding on New; the remaining findings there are pre-existing in files this change does not touch. No functional change. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…cate expiry NewSpiffeSigner loads its key and certificate through loadKeyAndCertificate, which holds the checks every certificate-backed signer needs: the key must match the certificate's public key, the certificate must fit in 16 KiB of DER, the key type must be one claims can be signed with, and the certificate's validity window must contain the current time. Each of these is a behaviour change for SPIFFE signers: a mismatched key, an oversized certificate, an unsupported key type such as P-521, or an expired or not-yet-valid certificate is refused at load instead of producing a claim that never verifies. A verifier applies the same 16 KiB bound to the certificate embedded in a SPIFFE claim before decoding and parsing it. CheckSigningKey exposes the key allowlist signers and verifiers share; NewKeySigner applies it at load, so an unsupported key is refused before any claim is signed instead of failing at the first Sign call. jwsAlgorithmFor accepts RSA keys of 2048 to 8192 bits only: smaller moduli are too weak to sign claims and larger ones make verification a denial-of-service vector. Because VerifyJWS derives the algorithm through the same function, RSA keys outside that range and embedded certificates over 16 KiB no longer verify for any scheme. SpiffeSigner implements the exported CertificateExpiry interface, and after a certificate-backed claim is pushed the claim command prints when the claim stops verifying and that it must be pushed again once the certificate is renewed, with the remaining lifetime rounded to minutes so short-lived SVIDs read correctly. A plain key signer prints nothing. No existing test relied on inputs the loader now refuses; the SPIFFE test helper only loses its named returns. Lint debt in the edited files is cleared: named returns and an unwrapped signer error in sign, and the string-pointer helper that new(expr) replaces. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
sigstore/sigstore is imported directly by the reconciler's name task but was listed as indirect; three requirements the tests module no longer uses remain listed. Both are pre-existing tidy drift on feat/identity-add, isolated here so the ans scheme's dependency diffs carry only their own modules. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]>
This was referenced Sep 29, 2026
CI lints whole modules and stops at the first red one. With ./reconciler clean, it now stops at ./utils on a staticcheck finding in the scheme gate of safefetch.Get (QF1001, De Morgan's law). The condition is rewritten without the negated conjunction; behaviour is unchanged, and a table test pins the gate: https and, when allowed, http pass through to the dialer, every other scheme is rejected before any network activity. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
kperry-godaddy
force-pushed
the
ans1-identity-prep
branch
from
September 30, 2026 15:03
08e2de8 to
fb14d11
Compare
muscariello
self-requested a review
October 2, 2026 17:19
Contributor
Author
|
Closing: superseded by the identity rework on |
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.
ANS-1 of the #2170 series: this is #2171, one commit per item, plus the one-line fix that lets
task genrun on this branch. Nothing here is specific to theansscheme; every commit stands on its own againstfeat/identity-add.fix(proto): restore the naming/v1 go_package override until #2126 removes the protosproto/buf.gen.yamllost the managedgo_packageentry foragntcy/dir/naming/v1while the naming protos are still present, sobuf generatefails and CI's Verify job (and everything downstream of it) is red on this branch.fix(cli): accept a key-only identity claim--keyand--certwere marked required together, so the command's own first example failed flag validation.--keyis required on its own;--certstays optional.fix(config): bind the identity task keys from the environment and show the task in the samplesidentity.enabledandidentity.intervalwere bound in neither the reconciler nor the daemon, soRECONCILER_IDENTITY_*and the daemon's equivalents were inert unless the key appeared in the file. The samples show the task as a liveenabled: falseblock. Item 2 asks for a sample that enables it; that waits for theGetRecordsannotation preload raised on #2125, because at this base the task marks every claim failed on its first run. The server binary has no identity key with an environment form at this base (spiffe_trust_domainsis a map), so its binding lands with theanskeys in #2174.refactor(server,reconciler): extract the identity wiring and clear the reconciler lint findingsserver.NewandregisterTasksfailed the pinned linter (maintainability, cognitive complexity, nesting); the identity wiring moves intonewIngestorandnewIdentityTask. The duplicated identity/ownership reconcile loops share one helper. No behaviour change.refactor(api): share the certificate-signer loader and report certificate expiryCheckSigningKey, with RSA bounded to 2048–8192 bits), validity window.SpiffeSignergainsNotAfter()(exported asCertificateExpiry) and the CLI prints when a certificate-backed claim stops verifying. The SPIFFE verifier bounds the embedded certificate before decoding. Behaviour changes, please confirm:NewSpiffeSignerrejects a mismatched key, an oversized or expired certificate and an unsupported key type;NewKeySignerrejects unsupported key types at load time instead of at signing; and becauseCheckSigningKeyis the same allowlistVerifyJWSderives the algorithm from, RSA keys outside 2048–8192 bits and embedded certificates over 16 KiB no longer verify for any scheme.chore(deps): tidy the reconciler and tests modulessigstore/sigstorebecomes a direct requirement of the reconciler (it is imported directly); three stale indirect requirements leave the tests module. Pre-existing churn, isolated here so theansPRs' dependency diffs are exactly their own modules.fix(utils): simplify the safefetch scheme check for the pinned linterreconcilerisutils, where a staticcheck finding (QF1001) in the scheme gate ofsafefetch.Getstopped the run; it came in with the base branch. The condition is rewritten with De Morgan's law, behaviour unchanged, and a table test pins the gate: https and, when allowed, http reach the dialer; every other scheme is rejected first.Verification
CI on this branch skips Build and Test until Verify and Lint are green. Verify is green from this PR's first commit. Lint runs whole modules in the order reconciler, utils, server, client, tests, api, cli and stops at the first red one; this PR clears reconciler and utils, and the 25 findings left in server and api are #2125's, requested there. Until they land, the results below are from the pinned toolchain locally.
task gen: passes with no generated diff (fails on the base).task deps:tidy: no diff in any module.cli0 issues,reconciler0 issues (4 on the base),utils0 issues (1 on the base).api2, both pre-existing: theverifyClaimnesting that the registry PR restructures, and a whitespace nit inreferrer_test.go, which this PR does not touch.server23, all pre-existing in files this PR does not touch;server.go's own maintainability finding is cleared. The 25 inserverandapiare listed on feat(identity): record identity/ownership verifiable claims #2125 (note).go test -race ./...inapi,cli,reconciler,server: 72 packages, all passing.loadKeyAndCertificate,CheckSigningKey,jwsAlgorithmFor,NewSpiffeSigner,NotAfter,expiryNotice,loadSigner,bindIdentityEnv,registerReconcilerDefaults,newIngestor,reconcileClaimand its two wrappers) except one unreachable error return innewIdentityTask(94.7%) and the two-line expiry print insiderunClaim, which needs a live client.🤖 Generated with Claude Code