feat(did): add optional fetch timeout to the did:web resolver#129
feat(did): add optional fetch timeout to the did:web resolver#129EfeDurmaz16 wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughChangesdid:web fetch timeout
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/did/src/did-resolvers/web-did-resolver.ts`:
- Around line 70-78: Update getResolver() to validate timeout before calling
AbortSignal.timeout(), rejecting negative, non-integer, non-finite, and
non-number values explicitly rather than allowing them to become notFound DID
errors. Preserve valid timeout behavior and add tests covering each
invalid-value category.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8a295354-8cf0-4ada-af59-bed6ec27927b
📒 Files selected for processing (3)
.changeset/did-web-resolver-fetch-timeout.mdpackages/did/src/did-resolvers/web-did-resolver.test.tspackages/did/src/did-resolvers/web-did-resolver.ts
7503cd5 to
f288d45
Compare
|
@venables when you have a moment, would appreciate a review. Small backward-compatible hardening (optional fetch timeout on the did:web resolver) I hit while building an ACK-ID + x402 demo. CodeRabbit's note is addressed; CI is waiting on a maintainer 'approve and run' for the fork branch. |
What
Adds an optional
timeout(ms) toDidWebResolverOptions/getResolverforthe
did:webresolver. When set, the resolver passesAbortSignal.timeout(timeout)to the underlying fetch.Why
Resolving a
did:webDID fetches the host named in the DID. TodayfetchDidDocumentAtUrlcallsfetch(url, { mode: "cors" })with noAbortSignal, so an unresponsive or slow host hangs the resolverindefinitely. The resolver's own header comment says it exists for "additional
checks and more control for fetching and resolution", so a bounded fetch fits
its purpose. This is resource-exhaustion hardening, not an SSRF fix (did:web
inherently fetches the domain named in the DID).
Change
timeout?: numberonDidWebResolverOptionsgetResolver->resolve->fetchDidDocumentAtUrlTests
Three new tests in
web-did-resolver.test.ts: the resolver builds the signalfrom the configured timeout (
AbortSignal.timeoutis called with the value),passes no signal when the option is omitted, and surfaces an aborted/timed-out
fetch as the standard
notFoundresolution error.pnpm --filter @agentcommercekit/did test-> 73 passing. Changeset included(minor). A response-size cap is a natural follow-up but needs body streaming,
so it is out of scope here.
AI assistance disclosure
Per the repository AI policy: implemented and tested by gpt 5.6-sol and fable 5, then reviewed and understood by me. I can explain the implementation and its trade-offs without AI aid. Tests, typecheck, and formatting pass locally against the package suite.
Summary by CodeRabbit
did:webresolution requests.