Repository navigation
fix(didmailto): escape an email address the way a DID requires - #96
Conversation
New escaped the parts of the address with query escaping, which leaves "~" as it is and writes a space as "+". Neither character is allowed in a DID. Every character outside letters, digits, ".", "-" and "_" is now percent-encoded, and the result is checked by did.Parse. Email returns an error, where it used to panic, for a mailto DID that does not have exactly a domain and a local part. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Parsing a DID accepted any string that started with `did:`, so `did:web:` with nothing after it, or a DID with a space in it, counted as valid. Parsing now checks the string against the [DID syntax](https://www.w3.org/TR/did-core/#did-syntax): - **Method:** lower-case letters and digits. - **Identifier:** letters, digits, `.`, `-`, `_` and percent-escapes, in segments separated by colons, and not ending with a colon. A string with a path, query or fragment is a DID URL and is refused. Building a DID from a method and an identifier applies the same check and now returns an error. **This is a breaking change,** in two ways: - DIDs are decoded from tokens and DID documents through the same check, so a token or document carrying a malformed DID no longer decodes. - Code that builds a DID from a method and an identifier has to handle the new error. Outside this repo that is one place in hilt and one in libforge, which fil-forge/libforge#96 removes. The hard-coded DIDs in the other Forge repos all conform. The one place that could produce a DID that does not is the `did:mailto` constructor in libforge, fixed in fil-forge/libforge#96. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Updates ucantone and libforge to their current versions. No code here needed to change. What the new versions bring: - **Stricter DID parsing.** A DID is checked against the DID syntax when it is parsed or decoded, so a token or DID document carrying a malformed DID no longer decodes (fil-forge/ucantone#83). - **Stricter `did:web` resolution.** A `did:web` whose host is an IP address, or is not a well-formed host name, no longer resolves (fil-forge/ucantone#82). - **`did:mailto` escaping.** An email address with `~` or a space now produces a valid DID (fil-forge/libforge#96). This goes in ahead of #244, which moves the node to a `did:web` identity and needs the same versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Updates ucantone and libforge to their current versions, with the two changes hilt needs to build and pass on them. What the new versions bring: - **Stricter DID parsing.** A DID is checked against the DID syntax when it is parsed or decoded, so a token or DID document carrying a malformed DID no longer decodes (fil-forge/ucantone#83). - **Stricter `did:web` resolution.** A `did:web` whose host is an IP address, or is not a well-formed host name, no longer resolves (fil-forge/ucantone#82). - **`did:mailto` escaping.** An email address with `~` or a space now produces a valid DID (fil-forge/libforge#96). What changed here: - **The DID resolution test addresses its test server as `localhost`.** It used the server's `127.0.0.1` address, which no longer resolves. - **Building the DID of a tenant's wrapping key handles a new error.** Building a DID can now fail on a malformed identifier. This one is always the encoding of a key, so the error cannot occur. Not run: the integration tests, which need the local stack. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
A
did:mailtois built from an email address, and some characters that are legal in an address are not legal in a DID. The constructor left~unescaped and wrote a space as+, so an address containing either produced an invalid DID. fil-forge/ucantone#83 makes DID parsing enforce the DID syntax, after which such a DID would no longer decode from a token.user~name@example.combecomesdid:mailto:example.com:user%7Ename.~or a space. Other characters, such as+, were already encoded the same way.did:mailtoreturns an error. A DID with only a domain, or with extra segments, used to cause a panic.This passes on the current ucantone version and against #83, so it can merge first.
🤖 Generated with Claude Code