Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request for origin matching #121

Open
phschafft opened this issue Jan 24, 2023 · 5 comments
Open

Feature request for origin matching #121

phschafft opened this issue Jan 24, 2023 · 5 comments

Comments

@phschafft
Copy link

It would be very nice to have a function similar to eq() performing same-origin matching. Such a feature could be used by other modules to calculate service boundaries, blacklisting, per-site settings etc.

It is defined in RFC 6454 Section 4 and Section 5.

@oalders
Copy link
Member

oalders commented Jan 27, 2023

Thanks, @phschafft. Are you volunteering or is this strictly a request?

@phschafft
Copy link
Author

Thanks, @phschafft. Are you volunteering or is this strictly a request?

First of all it is a request and/or to see if there is a consensus that it will be in best interest for the module.

I'm currently a bit busy, but if nobody else wants to take it I'm happy to have a look.

@oalders
Copy link
Member

oalders commented Jan 28, 2023

Nobody has objected to a patch for this, but we're short on people power, so we'd need a PR with some rigorous tests to accompany it.

@phschafft
Copy link
Author

Is there any specific request for a function name? Otherwise I would go with $uri->has_origin($origin). ($origin being a URI object in canonical form or a string that is auto converted via URI->new($origin)->canonical.)

I would avoid a getter (only implement matching), as per RFC 6454 Section 4:

  1. If the URI does not use a hierarchical element as a naming
    authority (see [RFC3986], Section 3.2) or if the URI is not an
    absolute URI, then generate a fresh globally unique identifier
    and return that value.

It is unclear/implementation specific what a "globally unique identifier"'s value is:
From RFC 6454 Section 2.3:

A globally unique identifier is a value that is different from all
other previously existing values. For example, a sufficiently long
random string is likely to be a globally unique identifier. If the
origin value never leaves the user agent, a monotonically increasing
counter local to the user agent can also serve as a globally unique
identifier.

If there are no objects and time allows I would have a look at this the next days.

@oalders
Copy link
Member

oalders commented Feb 15, 2023

This sounds like a good approach, @phschafft.

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

No branches or pull requests

2 participants