-
-
Notifications
You must be signed in to change notification settings - Fork 679
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
Don't redirect to HTTPS for API #2416
Comments
Situation at the moment:
Section titles to better understand the context of the requirements above:
I find it quite complicated to write a requirement "If you use If we find it worth to be mentioned, I think it should be done in 9.2.2. |
I don't think that 9.1.1, 9.2.2 or 9.3.1 intends to disallow listening on Even if you are certain that all your software is properly communicating using |
I agree it decreases the likelihood, but at the same time it must be clear, that it does not fix the issue. If a third party app communicates over |
The points to achieve:
|
Ok, I think we need to focus this on API calls specifically here. It seems unlikely but not impossible that you would use Cookies with an API so I don't think we can limit to just tokens in headers. Since this would apply for non-browser clients which would not necessarily comply with Secure flag and HSTS. Overall, I would propose:
(Level 3) Thoughts @Sjord @elarlang @randomstuff |
It is a wider topic than API. For example, redirects using OAuth or some SSO and containing secrets or sensitive information. |
For what it's worth, I have seen that :) |
How would you expand the proposal then? |
Got stuck with providing alternative proposal. We can say, that the service getting the request from SSO or whatever other request is an API and the proposed request is valid. The requirement is also negative requirement, but when I tried to make it positive, it's hard to keep the main problem in the focus, say probably we can leave it like that. |
Any better? 13.1.8 - Verify that API endpoints, including those used in SSO processes, will only respond to HTTPS requests and that an HTTP endpoint is not available, even for redirection. This is to avoid API clients accidentally sending data over plaintext HTTP but this not being discovered due to an automatic redirect. |
Is is clear enough that we are talking about HTTP-based APIs (in contrast to some other RPC mechanism)? Would we need something like:
or
Is it clear that the "always use HTTPS" requirements do not apply to HTTP-over-IPC (such as HTTP over Unix Domain Socket)? Is it clear that "HTTP endpoint" is about the actual virtual + port + path (+ HTTP method)? i.e. if my API is
|
Ok so how about: 13.1.8 - Verify that HTTPS-based API endpoints, including those used in SSO processes, will only successfully respond to HTTPS requests. The endpoint should respond to plaintext HTTP requests with either an error or no response, and never with a redirect to the HTTPS endpoint. This is to avoid clients accidentally sending data over plaintext HTTP, but this not being discovered due to an automatic redirect. or even 13.1.8 - Verify that HTTPS-based endpoints will only successfully respond to HTTPS requests. The endpoint should respond to plaintext HTTP requests with either an error or no response, and never with a redirect to the HTTPS endpoint. This is to avoid clients accidentally sending data over plaintext HTTP, but this not being discovered due to an automatic redirect. |
Opened #2432 based on discussion with Elar |
I know this is merged but this text is a little awkward.
This is redundant.
This alone can be problematic. The better call it to not respond at all:
Verify that HTTPS-based endpoints do not respond to HTTP requests. This drops the negative requirement of not redirecting, drops the "error message" part, and simplifies the language. |
|
Could you reword it to be worded as a positive requirement and also include the text that explains why? |
Something along these lines? Verify that only user-facing endpoints (intended for manual web-browser access) automatically redirect from HTTP to HTTPS, while other services or endpoints do not implement transparent redirects. |
@elarlang what do you think about this proposal? |
The proposed part is ok, but I think the requirement needs an explanatory part to be clear about why it exists or what problem it addresses. |
So how about this: "Verify that only user-facing endpoints (intended for manual web-browser access) automatically redirect from HTTP to HTTPS, while other services or endpoints do not implement transparent redirects. If a client is erroneously sending unencrypted HTTP requests but the requests are being automatically redirected to HTTPS, this leakage of sensitive data may go undiscovered." |
Can we change the second part to something like:
If the additional sentence starts with an "if" it feels like a separate condition in the requirement, not a start of the explanation part. |
@elarlang what do you think? |
I'm ok with this. Ping @Sjord |
Drafted #2529 to resolve. @set-reminder @tghosth to mark as ready for review in 1 week if we don't get further input |
I think it makes sense to merge it in. If there are something to improve, we can do another commit/PR, but I don't like those hanging PR's to collect conflicts to solve. |
Your API Shouldn't Redirect HTTP to HTTPS
The argument is that when a client uses 'http://api.example.org', it should fail instead of silently be insecure.
I propose to add a requirement that specifies what behavior a site should have when the HTTP version is accessed, whether it should redirect or return an error.
The text was updated successfully, but these errors were encountered: