-
Notifications
You must be signed in to change notification settings - Fork 3
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
Confirm if Akita payment pointer resolution is spec compliant #60
Comments
Our current implementation actually does support If we could extract the redirect URL and validate that it matches the payment pointer format before following the URL, that would be better. After doing some reading, it seems that the Fetch API does not expose the redirection Location in the response header for clients (a measure to avoid leaking info in XSS attacks) - source 1, source 2. So, it seems we can't use a manual redirect to check the endpoint before initiating a new request. It might be possible to expose Additionally, we should be verifying that the response body contains Since we're doing all the payment pointer validation client-side, there are some challenges with guaranteeing that the provided payment pointer is valid. I'm not sure there's a way for us to properly validate the payment pointer client-side, but we can do all these checks to try to get pretty close. |
@vezwork ping for your thoughts 🙂 |
I think I understand the problem. The Fetch API does not give the location on a Is there a way to check if a redirect is HTTPS without knowing the redirect location? |
It is possible to obtain the FINAL url that resolves after redirects using https://developer.mozilla.org/en-US/docs/Web/API/Response/url, but if there is more than one redirect in the redirect chain, then we won't know if some of the redirects were over HTTP and not HTTPS. The payment pointer spec is slightly ambiguous, it says that "Payment Pointers MUST resolve to an https URL as defined in RFC7230." Is there a way to use fetch where we don't allow redirecting to non-HTTPS endpoints? CORS may do this by default... |
Some confirmation of our assumption that every redirect url in the chain must be HTTPS...but not entirely sure if the originating URL must be HTTPS as well?
Source: https://forum.interledger.org/t/redirected-payment-pointers/809/3 |
This stackoverflow answer seems to indicate that CORS causes an error on request from HTTPS origin to HTTP origin: https://stackoverflow.com/a/37068063/5425899 |
The originating URL must also be HTTPS, because we expect the url to start with either As per Mixed Content documentation, content served via HTTP on an HTTPS site is blocked by browsers
So, it seems that if any intermediate redirections involve an HTTP url, the fetch request will be blocked by the browser. We will need to handle the Blocked Loading of Mixed Content error. TODOs
|
Not a priority for this milestone, but it would be good to validate the response body for the expected fields defined in the spec. Opened issue #83 to note this. |
According to the W3 spec on blocking Fetch when mixed content is encountered:
Although the default It seems we may not be able to catch when mixed content occurs, since it's just a warning that's displayed in the console. From Mozilla mixed content docs:
Currently, we consider a payment pointer invalid if the fetch response does not return |
As per the payment pointer spec https://paymentpointers.org/syntax-resolution/#requirements:
If a website is using a vanity payment pointer (payment pointer redirects to another payment pointer), then a request to the payment pointer will respond with a redirect, i.e.
3XX
response. Right now, we only check that a200 OK
is returned to validate that the payment pointer is working. We need to add handling to accept the3XX
response, send a new request with the redirect endpoint, and confirm that a200 OK
is returned.Relevant links
The text was updated successfully, but these errors were encountered: