-
Notifications
You must be signed in to change notification settings - Fork 173
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
refactor HTTP header verification #795
Comments
So I had a look at the code more, and this is my current understanding of the flow:
Observations:
So maybe we just need to:
|
Chatting with @lexnv and mulling over this more, there are a couple of ambiguities that stand out to me at the moment in the code, and I'm not clear enough on the intention of it to want to commit to anything here:
So, are we focusing solely on handling CORS requests with this I think if we are clear on what the goals are, it'll make it clearer what changes we should make to make it all consistent :) So let's shelve this until @niklasad1 is around and have a chat about it then! |
This issue will be closed by #842. We have decided to replace the CORS validation with tower middleware for HTTP purposes. In doing so, JSONRPSee will validate only the header and origin to keep functionality parity. And a huge chunk of code can be removed from JSONRPSee and maintained upstream in tower. |
I'm struggling to understand
ALWAYS_ALLOWED_HEADERS
; I think that we allow any headers specified in AllowHeaders plus any inALWAYS_ALLOWED_HEADERS
.I guess we have this list so that if the user doesn't allow any headers themselves via the access control stuff, standard requests will still work?
Some headers are also not completely black and white as to whether they are accepted or not. Eg with CORS, we'll always need to return "Content-Type" in the "Access-Control-Allowed-Headers" response, because otherwise I think the user couldn't set that to "application/json" without CORS disallowing it (see https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_request_header#additional_restrictions).
Also there is an
Access-Control-Allow-Origin
header in the list, which is what the server would respond with, so perhaps this doesn't need to be there?Also a client can send an
Access-Control-Request-Method
header in a preflight request, and so perhaps that should be there?Originally posted by @jsdw in #781 (comment)
The text was updated successfully, but these errors were encountered: