-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: rewrite all the things #35
Conversation
index.html
Outdated
Security consideration | ||
</h2> | ||
<p> | ||
As this specification is reliant on <a>URLs</a>, implementers need to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@annevk, just a 👍 if this is ok with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends, are these URLs exposed to users? Which parts of the URL are exposed to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are never exposed to the user, presumedly (but I couldn't be 100% sure it would never happen - but people do crazy things). I was going to make a note of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they're not exposed than most of the security considerations don't really apply I think. What did you think would apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like you said, if they were ever displayed then I was concerned the considerations would apply. I'll just say that.
index.html
Outdated
payments, or credit transfers). The <a href="https://w3.org">W3C</a> | ||
expects these payment methods will be implemented in a wide variety of | ||
third party payment handlers. The W3C identifies these payment methods | ||
with (short) strings (individual referred to as a <dfn>standardized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/individual/individually
index.html
Outdated
<ol class="algorithm"> | ||
<li>Let <var>url</var> be the result of trying to <a data-lt= | ||
"URL Parser">parse</a> <var>potential URL</var>. If failure, | ||
<a>throw</a> a <code>TypeError</code> exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make the If statement a new step. url would be failure in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If url is failure, then throw a TypeError."
index.html
Outdated
"URL Parser">parse</a> <var>potential URL</var>. If failure, | ||
<a>throw</a> a <code>TypeError</code> exception. | ||
</li> | ||
<li>If <a>scheme</a> is not "https", <a>throw</a> a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If url's scheme ..."
index.html
Outdated
<li>If <a>scheme</a> is not "https", <a>throw</a> a | ||
<code>TypeError</code> exception. | ||
</li> | ||
<li>If <a>query</a> is not null or <a>fragment</a> is not null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, need to specify where the query and fragment come from.
index.html
Outdated
<li>Let <em>urlA</em> be the result from the <a>URL parser</a> when | ||
parsing <em>A</em> with no <a>base URL</a>. | ||
<ol class="algorithm"> | ||
<li>Try to <a>parse</a> <var>A</var> and let <var>urlA</var> be the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this reference the URL parser again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a>parse</a>
links to URL Parser. Is that what you mean? I can be more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. You used "URL parser" as well earlier. Seems weird to use different referencing terms within the same document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see what you mean. I'll mirror more what you have in the URL spec.
index.html
Outdated
<em>null</em> terminate the algorithm with a result of <em>no | ||
match</em> and discard <em>B</em> from further matching. | ||
<li>Try to <a>validate</a> <var>urlA</var> and <var>urlB</var>. If | ||
either throws, return false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong since validate takes strings, not URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point.
index.html
Outdated
<li>Let <var>url</var> be the result of trying to <a data-lt= | ||
"URL Parser">parse</a> <var>potential URL</var>. | ||
</li> | ||
<li>If failure, <a>throw</a> a <code>TypeError</code> exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If url is failure"
index.html
Outdated
</li> | ||
<li>If running <a>potentially trustworthy URL</a> with <var>url</var> | ||
returns <code>"Not Trustworthy"</code>, <a>throw</a> a | ||
<code>SecurityError</code> exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different exception really necessary? You'll have to write some tests to make sure it's thrown before a non-null query...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will just use TypeError here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also noted about the test order)
index.html
Outdated
match</em> and discard <em>B</em> from further matching. | ||
<li> | ||
<a>Serialize</a> <var>urlA</var> and <var>urlB</var> and attempt to | ||
<a>validate</a> each. If either throws, return false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping you'd abstract validate a bit somehow instead. Parse -> serialize -> parse seems really hacky.
index.html
Outdated
</h2> | ||
<p> | ||
For W3C strings, user agents MUST use exact string matching. | ||
For <a>standardized payment method identifier</a>, user agents MUST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifiers*
index.html
Outdated
rendered or passed around by end-users. However, in the off-chance that | ||
they are, implementers need to be aware of the <a data-cite= | ||
"!URL#security-considerations">security considerations</a> from the | ||
[[!URL]] specification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely you should know whether they ever are? This seems a little weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Can definitely write this "as the world is today" - where there are no known instances of these URLs being rendered. Will fix.
Note that "I was hoping you'd abstract validate a bit somehow instead. Parse -> serialize -> parse seems really hacky." got lost due to a commit. One of the downsides of not addressing all comments in a single commit. |
index.html
Outdated
</li> | ||
<li>If failure, <a>throw</a> a <code>TypeError</code> exception. | ||
</li> | ||
<li>If running <a>potentially trustworthy URL</a> with <var>url</var> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really want to allow about:blank, about:srcdoc, wss: URLs, file: URLs, etc.? (All are potentially trustworthy.)
Do you want to allow usernames or passwords in the URL?
What is wrong with queries?
We probably need to synchronize https://w3c.github.io/payment-method-manifest/#fetch-payment-method-manifests step 2 with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still of the opinion that we should:
- restrict this to "https" (because Payment Manifest is the only serious consumer of the end points)
- Recommend "best practice" to developers to use paths and avoid query, fragments, username, and password.
That would mean that any URL with a https://
scheme is a valid PMI-URL - and would make everything super simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path and query seem equivalent to me: if you allow one you should allow the other.
I don't think we want to add another resource to the platform hidden behind HTTP auth, so I'd suggest disallowing username and password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's ban username and password. @zkoch has opinions about query/path - but hopefully the above can convince him to allow query.
I'll make preemptive changes to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query strings just feel more complicated to me and much easier for developers to get wrong. The whole goal was to give us the flexibility of URLs (to enable things like method manifests) but also make it as tightly scoped as possible to prevent developer error.
There's a lot of discussion on this at #9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zkoch for the pointer.
As Anne states at the end of #9, the overloading of this URL as an identifier AND a resource could become a real issue.
@domenic, crazy thought... but what if, to enable payment manifests, a developer instead had to serve the link relationship (instead of bobpay):
So, https://merchant.com/checkout
:
Link: <https://bobpay.com/manifest>; rel="payment-method-manifest"; pmi="https://bobpay.com"
Link: <https://alicepay.com/pay-manifest>; rel="payment-method-manifest"; pmi="https://alicepay.com"
Then, so long as Link
and referenced PMI are same origin, then "https://bobpay.com/manifest" can be fetched.
This also has the benefit of allowing prefetching of the manifests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Added additional Link:
above, to show how you could have multiple payment methods.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the developer know where the manifest file is?
This puts the burden on 1 million developers instead of 1 time on the origin. Or am I missing something?
Ian
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the Link proposal. @zkoch, I think your feeling about queries is off-base. They are equivalent to paths (and indeed, some server software uses them instead of paths). If we want to disallow paths and queries, that's fine, but we should not disallow just queries.
index.html
Outdated
let <em>B</em> be the second payment method identifier string. | ||
<ol class="algorithm"> | ||
<li>Let <var>urlA</var> be the result of running the <a>URL | ||
parser</a> on <var>inputA</var>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally since you don't want to get access to the blob URL store you probably want to use the basic URL parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think we should drop this section entirely. To compare two PMI URLs, you need to have first gone through the validation steps to get urlA
and urlB
. If we make that an invariant, then URL spec's "equals" algorithm can just be used without needing any of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds great to me; let's get rid of it.
The larger point about using the basic URL parser throughout this spec stands though.
index.html
Outdated
</p> | ||
<ol class="algorithm"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm would be better operating on parsed URLs, not on strings. Most places that call it seem to serialize the parsed URL before calling it, which is pretty pointless since it's just going to parse it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently not the case in the Payment Request spec. In the "Process payment methods:", I was going to call "validate" just before step 4.2.2:
Let serializedData be the result of JSON-serializing paymentMethod.data into a string, if the data member of paymentMethod is present, or null if it is not. Rethrow any exceptions.
I can call the URL Parser in the Payment Request spec (re-throwing any errors), and then pass the URL into validate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try to take another look at the callers tomorrow. What I remember is that all the callers in this document had to go through parse+serialize+parse. But maybe taking URLs as input is better anyway, not sure yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, after removing the matching algorithm, I see your perspective. But, I think that it's still a better algorithm if it's more "strongly typed", i.e. operates on URLs.
I have a separate issue which is that I think it should return true or false, instead of returning true or throwing a TypeError. E.g. in the payment-method-manifest spec we aren't in a context where throwing makes sense, so we'd have to "catch" the exception, even though we're not even in a JavaScript context where exceptions are sensible to talk about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I'll make the change to only return true/false and move the exception handling to the PR spec.
index.html
Outdated
The <a href="https://w3.org">W3C</a> expects to publish a small number | ||
of payment method specifications that define abstractions across | ||
similar payment methods (such as credit card payments, tokenized | ||
payments, or credit transfers). The <a href="https://w3.org">W3C</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably only the first "W3C" should be linked
index.html
Outdated
</h2> | ||
<p> | ||
For W3C strings, user agents MUST use exact string matching. | ||
For a<a>standardized payment method identifiers</a>, user agents MUST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space; mismatched pluralness
index.html
Outdated
For W3C strings, user agents MUST use exact string matching. | ||
For a<a>standardized payment method identifiers</a>, user agents MUST | ||
compare strings in a <a data-cite= | ||
"HTML#case-sensitive">case-sensitive</a> manner (code point for code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @annevk we should probably move this to Infra (no action item for now on this document though)
index.html
Outdated
The URLs relied upon by this specification are only expected to be used | ||
by APIs, or internally by the user agent. As such, there is no | ||
expectation that URLs defined in this specification would ever be | ||
rendered or passed around by end-users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is quite accurate, given the existence of https://w3c.github.io/payment-method-manifest/... It's not very clear in general, and it's not clear what it has to do with security considerations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does payment manifest somehow expose these URLs to end users?
FWIW, I don't mind removing this section in its entirety, or just stating: "There are no known privacy or security issues to be considered at this time. This is subject to change as this specification evolves." or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't end users end up seeing something like "Pay with https://android.google.com/pay"?
I'd be OK with removing it too.
index.html
Outdated
method specific data for those methods they claim to accept. This | ||
allows the API to abstract away the details of specific payment methods | ||
and to add new ones over time without changing the <abbr title= | ||
"application programming interface">API</abbr>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the first use of API in the document should get this treatment, not one middle-way through the document. Although IMO it's not necessary at all.
@domenic wrote:
I think the answer is "no." However, I wonder if there are some use cases for them (e.g., local testing of a payment method?) We've not really discussed those, and I think the intended use cases are for published payment method manifest files.
Again, I think the answer is "no" but there might be use cases we've not considered.
I don't recall the rationale exactly, but I think it had to do with simplicity. These are good questions. Ian |
This is ready for final review. |
<p> | ||
The syntax of W3C strings used as payment method identifiers is | ||
constrained by this regular expression: | ||
User agents MUST NOT enforce validity or well-formedness of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit confusing to me at first read. All we're trying to say is "methods either match (great) or they don't (ignored)." It took me a bit to understand what this meant. Example might help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding as a separate bug: #37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit I commented on, otherwise LGTM
Preview | Diff