feat: tests for IPIP-548 Ipfs-Uri header - #301
Open
lidel wants to merge 3 commits into
Open
Conversation
Contributor
|
Results against Kubo master: Important See the action summary for full results. This PR cannot be merged until there is a Kubo PR that uses tests from this branch and passes CI. Link related PRs (boxo, kubo) in the PR description. Summary
|
Contributor
|
Results against Kubo latest: Summary
|
This was referenced Aug 21, 2026
lidel
marked this pull request as draft
August 21, 2026 02:43
lidel
added a commit
to ipfs/boxo
that referenced
this pull request
Aug 21, 2026
Implement the Ipfs-Uri response header from ipfs/specs#548: a canonical ipfs:// or ipns:// URI for the requested content path, safe in an HTTP field value for any UnixFS file name. - authority in canonical form: base32 CIDv1, base36 IPNS name keeping its multicodec, lowercase A-label DNSLink; header omitted when the root cannot be normalized - every path segment percent-encoded over the RFC 3986 unreserved set with uppercase hex; "." and ".." emitted as %2E / %2E%2E - sent on deserialized, redirect, and error responses up to 8192 bytes, and exposed via default Access-Control-Expose-Headers - X-Ipfs-Path no longer sent by default; restore via Config.DeprecatedXIpfsPath + Headers.WithDeprecatedXIpfsPath, still omitted for bytes invalid in a field value - CI runs gateway-conformance from ipfs/gateway-conformance#301 until a release with the IPIP-548 tests ships
lidel
force-pushed
the
ipip-548-ipfs-uri
branch
from
August 21, 2026 02:56
3e5aa8d to
d51d978
Compare
lidel
added a commit
to ipfs/boxo
that referenced
this pull request
Aug 21, 2026
Implement the Ipfs-Uri response header from ipfs/specs#548: a canonical ipfs:// or ipns:// URI for the requested content path, safe in an HTTP field value for any UnixFS file name. - authority in canonical form: base32 CIDv1, base36 IPNS name keeping its multicodec, lowercase A-label DNSLink; header omitted when the root cannot be normalized - every path segment percent-encoded over the RFC 3986 unreserved set with uppercase hex; "." and ".." emitted as %2E / %2E%2E - sent on deserialized, redirect, and error responses up to 8192 bytes, and exposed via default Access-Control-Expose-Headers - X-Ipfs-Path no longer sent by default; restore via Config.DeprecatedXIpfsPath + Headers.WithDeprecatedXIpfsPath, still omitted for bytes invalid in a field value - CI runs gateway-conformance from ipfs/gateway-conformance#301 until a release with the IPIP-548 tests ships
lidel
marked this pull request as ready for review
August 21, 2026 03:37
lidel
force-pushed
the
ipip-548-ipfs-uri
branch
from
August 22, 2026 12:33
d51d978 to
82ee9fa
Compare
lidel
added a commit
to ipfs/boxo
that referenced
this pull request
Aug 22, 2026
Implement the Ipfs-Uri response header from ipfs/specs#548: a canonical ipfs:// or ipns:// URI for the requested content path, safe in an HTTP field value for any UnixFS file name. - authority in canonical form: base32 CIDv1, base36 IPNS name keeping its multicodec, lowercase A-label DNSLink; header omitted when the root cannot be normalized - every path segment percent-encoded over the RFC 3986 unreserved set with uppercase hex; "." and ".." emitted as %2E / %2E%2E - sent on deserialized, redirect, and error responses up to 8192 bytes, and exposed via default Access-Control-Expose-Headers - X-Ipfs-Path no longer sent by default; restore via Config.DeprecatedXIpfsPath + Headers.WithDeprecatedXIpfsPath, still omitted for bytes invalid in a field value - CI runs gateway-conformance from ipfs/gateway-conformance#301 until a release with the IPIP-548 tests ships
Cover the Ipfs-Uri response header from ipfs/specs#548 and the deprecation of X-Ipfs-Path, one request per failure class: - canonical percent-encoded segments: delimiters, platform-encoder gaps (!'()*~), 4-byte UTF-8; full byte-level vectors live in the IPIP-0548 fixtures table - request-spelling independence over dir-with-percent-encoded-filename.car: raw sub-delims and lowercase hex must yield the same canonical value - decode-once normalization (%2F, %2E, dot segments), nested trailing slashes, query exclusion on alternate formats, redirects - a hand-built fixture with a link literally named "a/b.txt" proves such an entry is not path-addressable: %2F always decodes to a separator, so the nested b.txt wins under every request spelling - authority normalization: CIDv0 and legacy base58 peer IDs - X-Ipfs-Path must be omitted for non-ASCII paths and unchanged when present for ASCII-safe ones; existing expectations move to Ipfs-Uri, raw block tests drop the header expectation, CORS expects Ipfs-Uri exposed - DNSLink hosts get an ipns:// assertion in the dnslink suite
lidel
force-pushed
the
ipip-548-ipfs-uri
branch
from
August 22, 2026 12:35
82ee9fa to
149f396
Compare
lidel
added a commit
to ipfs/boxo
that referenced
this pull request
Aug 22, 2026
Implement the Ipfs-Uri response header from ipfs/specs#548: a canonical ipfs:// or ipns:// URI for the requested content path, safe in an HTTP field value for any UnixFS file name. - authority in canonical form: base32 CIDv1, base36 IPNS name keeping its multicodec, lowercase A-label DNSLink; header omitted when the root cannot be normalized - every path segment percent-encoded over the RFC 3986 unreserved set with uppercase hex; "." and ".." emitted as %2E / %2E%2E - sent on deserialized, redirect, and error responses up to 8192 bytes, and exposed via default Access-Control-Expose-Headers - X-Ipfs-Path no longer sent by default; restore via Config.DeprecatedXIpfsPath + Headers.WithDeprecatedXIpfsPath, still omitted for bytes invalid in a field value - CI runs gateway-conformance from ipfs/gateway-conformance#301 until a release with the IPIP-548 tests ships
Per IPIP-548, only dotted DNSLink names can be an ipns:// authority: a name with no dot can point at different content on each network. Add a positive and a negative test over new dir_listing dnslink entries: example.local yields ipns://example.local/, and examplenodot never yields an Ipfs-Uri header, no matter how the gateway answers. Refs ipfs/helia-verified-fetch#376 (comment)
lidel
added a commit
to ipfs/boxo
that referenced
this pull request
Aug 23, 2026
Use the conformance tests from ipfs/gateway-conformance#301 at its latest commit, which adds the dot-less DNSLink Ipfs-Uri tests.
achingbrain
reviewed
Aug 24, 2026
|
|
||
| ```sh | ||
| ipfs version | ||
| # ipfs version 0.44.0-dev |
Member
There was a problem hiding this comment.
Better with a release version?
Suggested change
| # ipfs version 0.44.0-dev | |
| # ipfs version 0.43.0 |
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.
Need
X-Ipfs-Pathcannot carry every UnixFS file name: bytes outside visible ASCII are invalid in HTTP field values1, so clients get garbled or silently mangled values, and nothing in the suite caught a gateway sending them. ipfs/specs#548 deprecates the header in favor ofIpfs-Uri, which the suite did not cover at all.This PR
TestGatewayIpfsUri*: canonicalipfs:///ipns://serialization over a newdir-with-tricky-filenames.carfixture (spaces,%,#?, names in nine non-Latin scripts), authority normalization (CIDv0, base58 peer IDs), and one canonical value no matter how the request spells the path (raw sub-delims, lowercase hex) over the existingdir-with-percent-encoded-filename.carTestGatewayIpfsUriLegacyXIpfsPathNotBrokenfails gateways that returnX-Ipfs-Pathfor paths that cannot survive a field valueX-Ipfs-Pathexpectations move toIpfs-Uri; CORS tests expect it exposedDepends on ipfs/specs#548. Verified against kubo built on the matching boxo branch.
Lmk if this is good as-is, or should be simplified to smaller set of fixtures.
In the past we kept it small due to maintenance burden, but refactoring is cheap these days, so we can afford full coverage, I think.
This needs to be released as a major version bump.
Tests
Kubo tests will fail in comments below until we bump kubo to boxo from ipfs/boxo#1209
Kubo PR that is green:
Footnotes
RFC 9110, section 5.5: field values are limited to HTAB, SP, and visible ASCII; other bytes are invalid or replaced in transit. ↩