Repository navigation
A did:web issuer that cannot be resolved is no longer a bad signature - #78
Merged
Merged
Conversation
…ESOLVED When a did:web issuer's DID document could not be fetched, a 404 or an unreachable host, `proof.signature` failed with `INVALID_SIGNATURE`: the same verdict a tampered credential gets. The classifier already reports `DID_WEB_UNRESOLVED` for an `HTTPError` whose `requestUrl` is the issuer's DID document, but the did:web driver verifier-core wires threw plain `Error`s, so that branch never fired. - `didWebDriverWithHttpGet` now rejects with a `DidDocumentFetchError`, named `HTTPError` and carrying `requestUrl` (and `status` for a non-2xx answer), for a non-2xx status and for anything `httpGetService.get` throws. The fetcher's fixed message is kept and its error becomes `cause`, so no network error text reaches a problem detail. - A fetch failure for a key that is not the issuer's, or for a presentation's own proof, now reports `HTTP_ERROR`. - A DID document with the wrong `id` and an allow-list refusal are unchanged. - Tests: driver cases with a stubbed `fetch`, classifier cases pinning the issuer match, and offline acceptance cases through `createVerifier` with a real signature, including a tampered credential on a resolvable did:web issuer that still reports `INVALID_SIGNATURE`. - CHANGELOG Fixed entry; README `HTTP_ERROR` row says it covers a key that is not the issuer's. Closes #65 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #76 — review and merge that first.
Closes #65.
When a did:web issuer's DID document could not be fetched (a 404, or an unreachable host),
proof.signaturefailed withINVALID_SIGNATURE, which is the same verdict a tampered credential gets. The README's error taxonomy already promisedDID_WEB_UNRESOLVEDfor this case, andclassifySignatureErroralready reports it for anHTTPErrorwhoserequestUrlis the issuer's DID document. The problem was that the did:web driver verifier-core wires (didWebDriverWithHttpGet) threw plainErrors, so that branch never fired.What changed
didWebDriverWithHttpGetnow rejects with aDidDocumentFetchError, namedHTTPErrorand carryingrequestUrl(plusstatusfor a non-2xx answer). It does this for a non-2xx status and for anythinghttpGetService.getthrows (transport failure, timeout, size cap, URL-policy refusal). It keeps the fetcher's fixed message and attaches the original error ascause, so no network error text reaches a problem detail.HTTP_ERROR.INVALID_SIGNATUREDID_WEB_UNRESOLVEDINVALID_SIGNATUREDID_WEB_UNRESOLVEDINVALID_SIGNATUREHTTP_ERRORINVALID_SIGNATURETests
fetch: a 404, and a fetch that throws. The second asserts that the fixed message is kept, that noENOTFOUNDtext appears, and that the cause chain is preserved.test/did-web-unresolved.spec.ts:createVerifiercases with a real Ed25519Signature2020 signature (404 and fetch failure →DID_WEB_UNRESOLVED);INVALID_SIGNATURE.Validation
pnpm run build: passes.pnpm run test(lint + vitest): passes, with 1003 tests.tsc -p tsconfig.dev.json: the same 6 pre-existing errors as on the base branch, and none new.verifiableCredentials/v2/ed25519/didWeb/badDidWeb.jsonverified withcreateVerifier()defaults now givesDID_WEB_UNRESOLVED("…could not be retrieved from https://digitalcredentials.github.io/dcc-did-web-bad/did.json").test:browser(Playwright) was not run.Not in this PR
id, and an allow-list refusal, still reportINVALID_SIGNATURE.STATUS_LIST_SIGNATURE_ERROR.🤖 Generated with Claude Code