Repository navigation
feat(client): add the ans identity key resolver - #2300
Conversation
A resolver that fetches from an operator-trusted host must not let a 3xx send the request anywhere else. WithoutRedirects makes the client hand the 3xx back to the caller as a StatusError instead of following it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]>
The Agent Name Service SDK verifies ans:// identity claims, so its bumps are reviewed as trust-path changes rather than folded into the Go patch group. The rule is last so its group name wins over the patch grouping. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]>
An ans:// subject publishes no key. The key is the public key of the identity certificate the claim carries, trusted once the agent's transparency log attests the certificate's fingerprint for the agent the subject names. The resolver parses the canonical name, checks the certificate's URI SAN and validity, follows the _ans-badge TXT record to a log on the configured allow-list, fetches the agent's status token through the SSRF-guarded client without following redirects, verifies it with the pinned root keys (or the keys the log publishes, when unpinned mode is configured), and returns the certificate's key. Failures the publisher controls (the subject, the certificate, the DNS record) are plain errors the reconciler treats as final; only a failure of a trusted log while the caller is still waiting keeps its cause, so a publisher cannot keep an earlier result alive by breaking their own DNS. The DNS and log stages each get their own budget, and the attestation is memoized per subject, so a stack of claims attached by anyone costs one DNS lookup and one log fetch between them. The SDK dependency is limited to its models and verify/scitt packages, which link only fxamacker/cbor. The golden fixtures were captured from the Agent Name Service reference implementation's demo stack. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Terminal-error classification and cache scalability and lifetime behavior do not yet satisfy the documented resolver contract.
Review effort: Balanced
Findings: 5
Open (6)
Prevent concurrent per-subject cache-miss stampedes · New Honor configured status cache TTL · New Avoid full memo-cache scans on every insertion · New Mark terminal HTTP responses with ErrFinal · New Mark terminal /root-keys HTTP failures as final · New Record the reference commit in fixture.json · New
What changed in this PR
Adds ANS identity-key resolution using certificate validation, DNS badge discovery, and trusted transparency-log attestations.
Changes:
- Implements the configurable
ans://resolver, caching, and final-error semantics. - Adds redirect refusal to SSRF-safe fetching.
- Adds comprehensive fixtures/tests and pins ANS-related dependencies.
| File | Description |
|---|---|
utils/safefetch/fetch.go |
Adds redirect refusal. |
utils/safefetch/fetch_test.go |
Tests redirect behavior. |
tests/go.mod |
Updates CBOR dependency. |
tests/go.sum |
Updates dependency checksums. |
renovate.json |
Groups ANS SDK updates. |
reconciler/go.mod |
Updates CBOR dependency. |
reconciler/go.sum |
Updates dependency checksums. |
client/utils/identity/resolvers/resolvers.go |
Adds final-error contract. |
client/utils/identity/resolvers/resolvers_test.go |
Tests final-error wrapping. |
client/utils/identity/resolvers/ans/testdata/status-token.cbor |
Adds captured status token. |
client/utils/identity/resolvers/ans/testdata/root-keys.txt |
Adds captured root key. |
client/utils/identity/resolvers/ans/testdata/identity-cert.pem |
Adds captured certificate. |
client/utils/identity/resolvers/ans/testdata/fixture.json |
Describes captured fixture. |
client/utils/identity/resolvers/ans/name.go |
Parses canonical ANS names. |
client/utils/identity/resolvers/ans/name_test.go |
Tests ANS names. |
client/utils/identity/resolvers/ans/mint_test.go |
Generates synthetic fixtures. |
client/utils/identity/resolvers/ans/log.go |
Fetches and verifies log tokens. |
client/utils/identity/resolvers/ans/log_test.go |
Tests log verification and caching. |
client/utils/identity/resolvers/ans/golden_test.go |
Tests captured ANS fixtures. |
client/utils/identity/resolvers/ans/fixtures_test.go |
Provides test doubles. |
client/utils/identity/resolvers/ans/config.go |
Defines resolver configuration. |
client/utils/identity/resolvers/ans/config_test.go |
Tests configuration validation. |
client/utils/identity/resolvers/ans/certificate.go |
Validates identity certificates. |
client/utils/identity/resolvers/ans/certificate_test.go |
Tests certificate validation. |
client/utils/identity/resolvers/ans/badge.go |
Resolves and validates DNS badges. |
client/utils/identity/resolvers/ans/badge_test.go |
Tests badge handling. |
client/utils/identity/resolvers/ans/ans.go |
Implements the ANS resolver. |
client/utils/identity/resolvers/ans/ans_test.go |
Tests resolver behavior. |
client/go.mod |
Adds ANS SDK and CBOR dependencies. |
client/go.sum |
Adds dependency checksums. |
cli/go.mod |
Updates CBOR dependency. |
cli/go.sum |
Updates dependency checksums. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
muscariello
left a comment
There was a problem hiding this comment.
Clean resolver, and the URL gate and token checks hold up. I ran the tests with -race locally and read VerifyStatusTokenAt in the SDK. I agree with Copilot on the 5 s TTL floor and the missing fixture commit. The rest is inline: one decision (the SDK), two behaviours to settle before #2174, and small fixes.
|
|
||
| require ( | ||
| buf.build/gen/go/agntcy/oasf/protocolbuffers/go v1.36.12-20260928171943-6220fce8636b.2 | ||
| github.com/agentnameservice/ans-sdk-go v0.1.19 |
There was a problem hiding this comment.
This settles the open decision on #2170 (depend on ans-sdk-go or write it ourselves). I read VerifyStatusTokenAt and found nothing wrong; the question is whether we want a v0.1.x vendor SDK in the trust path. @ramizpolic, can you call this on #2170 before we merge?
There was a problem hiding this comment.
Okay from my end here, as long as we are covered by renovate and tests to cover the functionality, both of which are already present in the PR.
| if err != nil { | ||
| // Once the caller has given up, the failure is the caller's, not the log's. | ||
| if ctx.Err() != nil { | ||
| err = final(err) |
There was a problem hiding this comment.
"Failed after the caller gave up" is stored as a verdict. reconcileRecord runs each record under a 1-minute deadline and stores any non-transient failure, so a shutdown or deadline mid-lookup turns a verified claim into failed until the next run (1 h by default). I'd have the task skip storing when its context is done. The slow-DNS case this rule guards against can be handled on its own.
There was a problem hiding this comment.
Agreed. b75b45b drops the rule: a lookup that ends because the caller's context did is left unmarked, like any other failure to reach the network, so the task classifies it by its cause. For #2174 the task will skip storing when its own context is done (a shutdown), while a record deadline stays on the transient path under the grace from the next thread, so the slow-DNS case is bounded by the grace rather than turned into a verdict.
|
|
||
| txts, err := r.lookupTXT(ctx, recordName) | ||
| if err != nil { | ||
| return TrustedLog{}, final(fmt.Errorf("ans badge: lookup %s: %w", recordName, err)) |
There was a problem hiding this comment.
Every DNS error is final, including our own resolver being down. For other schemes a DNS failure other than not-found is transient. A kube-dns restart would flip every verified ans:// claim to failed for one interval. Suggest a short, configurable grace for ans in #2174 instead of final vs. the task's hard-coded 7 days.
There was a problem hiding this comment.
Agreed. b75b45b leaves DNS lookup errors unmarked, so the task classifies them as it does for dns: subjects ("no such host" is final, the rest transient); what the record says (none for the version, two of them, a URL outside the gate) stays a verdict. #2174 adds identity.ans.stale_grace, default 24h, in place of the task's seven days for ans:// claims: a publisher who breaks their own DNS can delay a revocation by at most that, and a kube-dns restart costs nothing.
| func (c *scittLogClient) Status(ctx context.Context, log TrustedLog) (*Status, error) { | ||
| body, err := c.fetch.Get(ctx, log.Origin+"/v1/agents/"+log.AgentID+"/status-token") | ||
| if err != nil { | ||
| return nil, fmt.Errorf("ans log: fetch status token: %w", err) |
There was a problem hiding this comment.
The description says 404, 410, 401 and 403 are final at the log, and that 3xx is not. Here none are marked. They end up final only because the reconciler's isTransient treats just 5xx/408/429 as transient, so a 3xx is also a failed verdict today. Please mark the terminal statuses Final here, add a 3xx test, and fix the description.
There was a problem hiding this comment.
Done in b75b45b: a 404, 410, 401, 403 or any answer that is not a 5xx, 408, 429 or a redirect is marked Final, for the status token and for /root-keys; redirects and transport failures are left for the task. Tests cover 301, 404, 403 and 429 on the token, 404 and 500 on the keys, and fetchError has its own table. The description now says a redirect becomes transient once #2174 updates isTransient.
| AgentID: payload.AgentID, | ||
| Name: payload.AnsName, | ||
| State: State(payload.Status), | ||
| ExpiresAt: time.Unix(payload.Exp, 0), |
There was a problem hiding this comment.
time.Unix(payload.Exp, 0) is never IsZero(), and the SDK rejects exp=0 as expired. So "zero means no expiry" and the IsZero check in recall are dead code. Remove them or fix the comment.
There was a problem hiding this comment.
Taken as you suggested in 339da05, with a test that a statement without an expiry is never reused.
| trusted: trusted, | ||
| pinned: pinned, | ||
| lookupTXT: net.DefaultResolver.LookupTXT, | ||
| fetch: safefetch.New(safefetch.WithTimeout(cfg.GetTimeout()), safefetch.WithMaxBytes(maxResponseBytes), safefetch.WithoutRedirects()), |
There was a problem hiding this comment.
safefetch refuses non-public addresses and has no override, so a log in a private network can't be used. Intended? If so, please say so in the config docs.
| return attestation{}, false | ||
| } | ||
|
|
||
| if att.status != nil && !att.status.ExpiresAt.IsZero() && now.After(att.status.ExpiresAt.Add(r.cfg.GetClockSkew())) { |
There was a problem hiding this comment.
Suggested change for the dead-code point above.
A correction to that comment: it is dead only for the shipped client. Status belongs to the public TrustedLogClient interface, so another client could return a zero ExpiresAt. With this change a zero value counts as already expired, which is harmless: the attestation is just never cached.
| if att.status != nil && !att.status.ExpiresAt.IsZero() && now.After(att.status.ExpiresAt.Add(r.cfg.GetClockSkew())) { | |
| if att.status != nil && now.After(att.status.ExpiresAt.Add(r.cfg.GetClockSkew())) { |
| // ExpiresAt is when the statement stops being valid; zero means it does | ||
| // not expire. |
There was a problem hiding this comment.
Matching doc change, so the comment says what the code does.
| // ExpiresAt is when the statement stops being valid; zero means it does | |
| // not expire. | |
| // ExpiresAt is when the statement stops being valid. The log's tokens | |
| // always carry one, so a zero value counts as already expired. |
…wers final A DNS lookup that fails and a trusted log that cannot be reached say nothing about the claim, yet the resolver marked both as verdicts, so a restart of the local resolver or a shutdown mid-run flipped every verified ans:// claim to failed until the next run. Both are now left for the task to classify by their cause, as for every other scheme. What the zone says and what the log states remain verdicts. A 404, 410, 401 or 403 from the log, or any other answer that is not a server-side failure, a timeout, rate limiting or a redirect, was left unmarked and ended up final only through the task's own list. It is now marked where the contract is declared. Addresses review on agntcy#2300. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
A status_cache_ttl under five seconds was silently raised to five at run time, so an operator who read the field as the most a revocation can be delayed got more than they set. The minimum is now part of validation, as MinStatusCacheTTL, and the configured value is used as it is. The expiry check on a kept statement also tested for a zero time that the log client never produces. A zero expiry now counts as already expired, so such a statement is never reused. Addresses review on agntcy#2300. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claims of one subject that arrived while its lookup was running each started their own, so a burst still cost a DNS lookup and a log fetch per claim; the memo only served the claims that came after. They now wait for the lookup in flight, each under its own context: a waiter whose caller gives up returns at once, and when the leading caller gives up, a waiter still waiting runs the lookup itself. Every insertion into the memo also scanned every entry, which is quadratic in the subjects verified within one lifetime. An expired entry is now dropped when a claim asks for it, and the rest are swept once per lifetime. Addresses review on agntcy#2300. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
The golden test said fixture.json records the reference commit the capture ran at. It never did once that field went, so the comment now says what the snapshot is and why it stands on its own. The config states that the SSRF-safe client refuses a log on a private address, which the resolver inherits by design. Addresses review on agntcy#2300. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Thanks @muscariello. Four commits address the inline threads, with a reply on each, and the description's failure-semantics section is rewritten to match. The two behaviours you asked to settle before #2174 are settled as you proposed: lookup failures are left to the task, which gets a short configurable grace for |
|
The SDK call is okay from my end, we already cover it via tests and renovate for tracking. |
| func final(err error) error { | ||
| return resolvers.Final(err) //nolint:wrapcheck // the mark is the wrapping | ||
| } |
There was a problem hiding this comment.
nit: is the reason here simply to pass lint checks for this method or we can use resolvers.Final instead of final here
There was a problem hiding this comment.
Lint only: resolvers.Final(err) returns an error from another package, so wrapcheck wanted a wrap around it, and the helper held the one exception. #2304 calls resolvers.Final directly and tells wrapcheck in .golangci.yml that Final is the wrapping.
| dnsCtx, cancelDNS := context.WithTimeout(ctx, r.cfg.GetTimeout()) | ||
| target, err := r.lookupBadge(dnsCtx, name) | ||
|
|
||
| cancelDNS() |
There was a problem hiding this comment.
nit: handle context cancellation explicitly
| dnsCtx, cancelDNS := context.WithTimeout(ctx, r.cfg.GetTimeout()) | |
| target, err := r.lookupBadge(dnsCtx, name) | |
| cancelDNS() | |
| dnsCtx, cancelDNS := context.WithTimeout(ctx, r.cfg.GetTimeout()) | |
| defer cancelDNS() | |
| target, err := r.lookupBadge(dnsCtx, name) |
There was a problem hiding this comment.
there are similar approaches on other places, its not an issue, but it is easier to handle if the contexts are not reused
There was a problem hiding this comment.
Taken in #2304: both stage budgets are released with defer.
* docs(resolvers): state the one rule for a final error The ErrFinal doc still told a resolver to mark a failure observed after the caller gave up as a verdict, the rule the ans resolver dropped in b75b45b. A resolver following it would store a failed result on every shutdown mid-lookup. The doc now states the one rule: a verdict is about what the resolver can judge; a failure to reach the network, the caller's own deadline included, is left unmarked. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * refactor(safefetch): let a StatusError say whether a retry may help The ans resolver and the reconciler's identity task each kept their own list of the HTTP statuses that say nothing about the resource (5xx, 408, 429, a redirect), so a change to one would have drifted from the other without a test failing. The rule now lives with the type that carries the code, as StatusError.Transient, and the resolver uses it; the task follows in the wiring change. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(ans): judge an answer that the badge name does not exist An authoritative answer that _ans-badge.<host> does not exist is what the zone says, not a failure to reach it, yet it was left for the task to classify, so the package's contract held only through the task's own rule for a not-found DNS error. It is now a verdict here, like a name that answers without a badge record. The badge-URL host echoed in an error is now bounded like every other text taken from DNS. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(ans): give a waiter that gave up its own cause A claim waiting on another claim's lookup of the same subject got the leader's error when both callers had given up, so its stored cause could name the leader's cancellation rather than its own deadline. A waiter now reports its own context's error whenever its context is done, and runs the lookup itself only while it is live. The in-flight tests move into a testing/synctest bubble: the waiter is parked before the leader gives up, so the take-over path is the one exercised, fake time replaces the wall-clock deadlines, and a revoked verdict is shown reaching every waiter from one log fetch. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * refactor(ans): take the review nits on agntcy#2300 The resolver called resolvers.Final through a local helper that existed only to hold one wrapcheck exception; the linter is now told that Final wraps, and the package calls it directly. The budgets of the two network stages are released with defer, as elsewhere, instead of by hand after each stage. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(identity): require a certificate on ans:// claims An ans:// subject, like a spiffe:// one, is proven by the certificate the claim carries rather than by a published key. identity.NeedsCertificate names both schemes and identity.Check applies the rule: those claims need a certificate, every other claim must not carry one, since the certificate sits outside the signed payload and could be grafted on from elsewhere. Client.claim now runs identity.Check after signing instead of repeating the rule, so a claim the reconciler would refuse is never pushed. The dirctl help, the proto comments and the tests cover ans:// alongside spiffe://. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]> * feat(reconciler): verify ans:// claims through the ans resolver The identity task gains an ans resolver, built when the new reconciler.identity.ans block is enabled and routed to by forSubject; while the block is off an ans:// claim fails as an unsupported scheme. The block carries the resolver's own settings (trusted logs, pinned or fetched root keys, lifetimes, timeout, clock skew) and is checked at startup: a record may carry an ans:// identity claim and an ans:// ownership claim, each taking two of the resolver's timeouts, and all of that must fit the record budget; and the resolver's memo of a subject must expire between runs. isTransient learns two things: a failure the resolver marked with resolvers.Final is never transient, whatever cause it carries; and an HTTP answer that says nothing about the resource is, judged by safefetch's StatusError.Transient so that the task and the resolver share one list. An ans:// result outlives lookups that get no answer (the publisher's DNS, the trusted log) for identity.ans.stale_grace, 24 hours by default, rather than the task's seven days, since the publisher's own DNS is among those lookups: a publisher who breaks their own DNS delays a revocation by at most that. The grace sits in the resolver set beside the scheme dispatch. A run stopped mid-lookup stores no failure for the claim it was on, for every scheme, and reports the interruption. The run summary logs its duration and how many results were kept through transient failures, the startup line names the trusted logs, the pinned keys and the grace, and unpinned mode is called out. The keys take a comma-separated value from the environment, in the reconciler and under dirctl daemon; the samples and Helm values carry the block, off by default. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]> * docs(dir): describe the ans identity scheme The identity page gains the ans:// subject: what the claim carries, the shape of the badge record, how the transparency log attests the certificate, what a verified result proves and does not prove, which failures are final and which are transient, how the log's keys are pinned or fetched, the time budget, the configuration keys and the log lines to watch. The CLI reference, the trust-model and Go SDK pages, the publishing skill, the reconciler README and the changelog follow. The word "ans" joins the codespell ignore list. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: kperry <[email protected]> * test(reconciler): cover a record whose annotations cannot be read The path that leaves stored results alone when the record itself cannot be pulled had no test, and the one line this change touched in it was the patch's only uncovered line. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * refactor(identity): name the subject schemes in one place Which scheme a subject is spelled in, whether its claims carry a certificate, which resolver finds its keys and how long a stored result survives lookups that get no answer were each decided by their own list of prefixes, in the client package and in the reconciler, with a test to catch them drifting apart. The client package now owns the schemes: Scheme, SchemeOf and Scheme.NeedsCertificate, with the certificate rule's error text built from the same table. The reconciler keeps one entry per scheme (resolver and grace) keyed by it, so adding a scheme is one line in each place that has something to say about it. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(ans): forget the memo between runs The resolver's memo of a subject's attestation outlived a run: an entry made late in one run was still fresh when the next began, so a revocation could wait a run longer than the documented status_cache_ttl, and the startup rule tying the lifetime to the interval only narrowed the gap. The resolver can now be told to Forget, the task tells every resolver that keeps answers when a run starts, and the lifetime is what it says: how long an answer is reused within a run. The interval rule goes. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(reconciler): let a zero stale_grace keep nothing An operator who wanted no grace for ans:// results could not ask for it: zero meant the 24-hour default, in the config loaders and again in the task, so the documented workaround was a value of one second. Zero now keeps nothing, and the default lives only where defaults belong, in the reconciler's and the daemon's viper defaults. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(ans): name a signing key that is not pinned, once per run A transparency log that rotates its key fails every ans:// claim it attests until the operator pins the new key, and that is the right outcome of pinning, but the only sign of it was a failed result per claim. The resolver now names the cause (ErrUnpinnedRootKey) under the verdict mark, and the identity task warns once per run until the key is pinned. root_keys already takes several keys; the docs now say to pin the next key beside the current one so a rotation has no gap, and a test shows a token signed by either pinned key verifies. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(dir): say what a stored result is about and what turning ans off does Two questions from review: a kept result outlives the claim that produced it, and turning the ans block off fails every ans:// result. Both are intended, and the page now says so: a result is about the record's declared subject, not one claim, and a scheme the task cannot verify does not keep its results. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(reconciler): keep the unpinned-key warning on one line The warning about a signing key root_keys does not hold logged the resolver's error as it came, and that text carries the key id the log's token named. CodeQL (go/log-injection) flagged it: a remote party's text with a line break in it could forge a log entry. The text is now kept on one line before it is logged. Signed-off-by: kperry <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Signed-off-by: kperry <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>


What
Adds the
ans://key resolver inclient/utils/identity/resolvers/ans, implementingresolvers.Resolveras #2173 describes. Anans://subject publishes no key: the key is the public key of the identity certificate the claim carries, trusted once the agent's transparency log attests the certificate's fingerprint for the agent the subject names.Resolve(ctx, subject, certificate):ans://v<major>.<minor>.<patch>.<lowercase host>, so one identity verifies under one subject only;identity.Signalready applies), the current time within its validity, and a key claims are verified with;_ans-badge.<host>TXT record, takes the one record for the subject's version (an exact match, else a versionless one; two candidates are an error), and accepts its URL only if it ishttps, names a host intrusted_log_hosts, and is exactly/v1/agents/{uuid}with a lowercase UUID;utils/safefetch(no redirects, 64 KiB cap) and verifies it with the configured keys;ACTIVE,WARNINGorDEPRECATED, and the certificate's SHA-256 fingerprint among its valid identity certificates;Once #2174 registers the resolver, a
verifiedresult for anans://claim means: the claim was signed by the key of the certificate it carries; that certificate names the subject, is within its validity, and its fingerprint is listed as a valid identity certificate in a status token signed by a trusted transparency log for an agent whose name is the subject and whose status allows use. The certificate's issuer chain is not checked, the DNS pointer is not trusted, and the receipt and tree head are not checked. In unpinned mode the log's signing keys are fetched over TLS from the trusted host, so the proof reduces to TLS plus the log's own statement.Failure semantics
The reconciler keeps a stored result for a while when a lookup fails for reasons that say nothing about the claim (
isTransient), and stores a verdict otherwise. The resolver declares which is which:resolverspackage:resolvers.Final(err)marks a failure as a verdict about the claim whatever its cause, anderrors.Is(err, resolvers.ErrFinal)tells a caller so before it looks at the cause. Causes stay readable througherrors.As. [Task]: Wire ANS resolver for verification #2174 adds that check as the first case of the reconciler'sisTransient./root-keysbody in unpinned mode, a token signed by a key not inroot_keysin pinned mode (fail closed; the error names the key id), and a 404, 410, 401, 403 or any other answer that is not a 5xx, 408, 429 or a redirect.isTransient. [Task]: Wire ANS resolver for verification #2174 also givesans://claims their own grace (identity.ans.stale_grace, default 24h) in place of the task's seven days, so a publisher who breaks their own DNS can delay a revocation by at most that grace, and makes the task skip storing a result when the task itself was interrupted.timeout, default 10s) derived from the caller's context, so a slow zone cannot shorten the log's window. A hung trusted log therefore costs at most two timeouts per distinct subject per run; the circuit breaker stays a follow-up.status_cache_ttl(default 30s, at least 5s, capped by the token's expiry), and claims that arrive while a subject's lookup is running wait for it, each under its own context. N claims for one subject, whoever attached them, in turn or at once, cost one DNS lookup and one log fetch between them. That TTL is the most a revocation can be delayed on top of the verification interval.Every error starts with
ans name:,ans certificate:,ans badge:orans log:, so stored results stay comparable; a claim whose caller gives up while another claim's lookup of the same subject is running getsans: waiting for the lookup of <subject>: <cause>.Dependency (the open decision on #2170)
github.com/agentnameservice/ans-sdk-gois pinned atv0.1.19inclient/go.mod. Only itsmodelsandverify/scittpackages are imported; they link the standard library andgithub.com/fxamacker/cbor/v2, which was already in the module graph (bumped 2.9.2 to 2.9.4 and promoted to a direct requirement for the test fixtures). The SDK'sverifypackage, which would linkmiekg/dns, is not imported: the ANS name and the badge record are parsed locally. A renovate rule groupsgithub.com/agentnameservice/**bumps into their own PR, to be reviewed as trust-path changes. Dependent modules only see the cbor bump.NewtakesWithLookupTXT,WithLogClient,WithFetcherandWithClockoptions, which the reconciler's tests use to drive the resolver with a fake DNS, a fake log and a moving clock.Configuration
ansresolver.Configis what #2174 wires underreconciler.identity.ans:trusted_log_hostsroot_keys/root-keysendpoint servesallow_unpinned_root_keysfalse/root-keysinstead; cannot be combined withroot_keysroot_keys_ttl10mstatus_cache_ttl30s5stimeout10sclock_skew30sNot in this PR
identity.ansblock, the certificate rule forans://, CLI and docs: [Task]: Wire ANS resolver for verification #2174. Until then the resolver is unreachable.Retry-After, metrics, receipt and tree-head verification: the follow-ups listed on [Epic]: ans:// identity verification in Directory #2170._ra-badgelegacy record, a custom DNS server and a CA file are dropped; the resolver uses the system resolver and roots like its siblings.Fixtures
testdata/is a snapshot taken on 2026-09-11 from a local build of the Agent Name Service reference implementation (github.com/agentnameservice/ans) running its demo stack; the capture commands are ingolden_test.go. The snapshot stands on its own: the golden tests pin the clock to the capture time and drive the real log client through a fake fetcher, pinned and unpinned, andmint_test.gomints equivalent material for every other test.Commits
feat(safefetch): add an option that refuses redirectschore(deps): group ans-sdk-go updates in renovatefeat(client): add the ans identity key resolver(package, tests, fixtures,go.modchanges)After the first review round:
fix(ans): leave lookup failures to the task and mark terminal log answers finalfix(ans): validate the status cache lifetime instead of flooring itperf(ans): share in-flight lookups and sweep the memo once per lifetimedocs(ans): describe the fixture snapshot and the refusal of private logsVerification
task lintover theclientandutilsmodules with the pinned golangci-lint 2.13.2: 0 issues.go test -race ./...inclientandutils: pass. The new package and theresolverspackage have 100% statement coverage.go mod tidy -go=1.27.1leaves every module unchanged.Part of #2170. Closes #2173.
🤖 Generated with Claude Code