Skip to content

Deal with localhost on implicit values - #478

Merged
apasel422 merged 5 commits into
mainfrom
implicit-localhost
Aug 13, 2026
Merged

Deal with localhost on implicit values#478
apasel422 merged 5 commits into
mainfrom
implicit-localhost

Conversation

@martinthomson

@martinthomson martinthomson commented Aug 11, 2026

Copy link
Copy Markdown
Member

(This sat on a branch for a whole month. Mostly because I'm not sure if this is the right sort of check, because it expands in a very awkward way.)

I've expanded the scope of this a little to include literal IP addresses as well, after I realized that we weren't able to catch a bunch of problematic names through their use of IP addresses. This is because of awkward things like [::1], but also the wide array of ways of spelling loopback as an IPv4 address. There are also a bunch of non-unique IP addresses that could end up being used to poison things.

The check in code is pretty small, but it's not necessarily obvious.

The knock-on effect was that it didn't make sense to use SyntaxError for the case where implicit inputs are on loopback. I switched all of the error markings to NotAllowed instead.

Closes #456.


Preview | Diff

I've expanded the scope of this a little to include literal IP addresses
as well, after I realized that we weren't able to catch a bunch of
problematic names through their use of IP addresses.  This is because of
awkward things like `[::1]`, but also the wide array of ways of spelling
loopback as an IPv4 address.  There are also a bunch of non-unique IP
addresses that could end up being used to poison things.

The check in code is pretty small, but it's not necessarily obvious.

The knock-on effect was that it didn't make sense to use SyntaxError for
the case where implicit inputs are on loopback.  I switched all of the
error markings to NotAllowed instead.

Closes #456.

@apasel422 apasel422 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a couple of new test cases to https://github.com/w3c/attribution/blob/main/impl/e2e-tests/save-impression-localhost.json and https://github.com/w3c/attribution/blob/main/impl/e2e-tests/measure-conversion-localhost.json reflecting the new behavior? Ideally these would cover the implicit inputs in general, and specifically the IP address and .localhost suffix stuff.

Comment thread api.bs Outdated
Comment thread api.bs Outdated
martinthomson and others added 2 commits August 13, 2026 09:44
Co-authored-by: Andrew Paseltiner <apaseltiner@google.com>
This covers just the basics: IP addresses (not just localhost, but any
IP address) and "foo.localhost.".  I've also added a test for the
perverse case of a bare hexadecimal IPv4 address.

Also ensure that the exception is converted to a promise.
@apasel422
apasel422 merged commit 91ef174 into main Aug 13, 2026
3 checks passed
@apasel422
apasel422 deleted the implicit-localhost branch August 13, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent treatment of localhost

2 participants