-
-
Notifications
You must be signed in to change notification settings - Fork 675
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. |
Current requirement:
@jmanico - Can you clarify, what is the problem to solve or improve from the current requirement? You seem to propose new versions, but without taking into account, why the requirement was created and which messages it must send. If there no clear mistake in the current one or clear proposal for improvement, I prefer to leave it as it is. If we want to move forward with this one, I would like to get highlighted add-on:
|
I only want to fix this sentence which has an awkward ending. "Responding with an automatic redirect to the HTTPS endpoint may lead to clients accidentally sending data over non-encrypted HTTP, but this is not being discovered." Especially, "but this is not being discovered", is a bit strange language. But after hearing you and Josh's comments I do not want to change the details, just wordsmith it so it flows better. |
I proposed to widen it to be more general than API, but now it is too wide. So the question is, should we have one requirement to say, in which conditions is allowed to make redirect from
This is taken out of context. It was written to point out the word "keep". |
Oh yes OK, I understand. :bow |
How about:
Cookies should be irrelevant because they should be marked secure only. |
I am not sure this is a criteria. Not only the confidentiality, but also the integrity of the connection should be protected. If a trading bot requests http://publicstockmarket.example/NASDAQ.json the request does not contain any sensitive information, but if the response is manipulated by a MitM attacker that is still a problem. |
We can not fix the MiTM issue with this requirement, see #2416 (comment) We can only set the condition when redirect from |
@elarlang @jmanico are you good with this fix: #2416 (comment) ? |
I'm ok with that. |
What I am saying is that in my example, publicstockmarket.example should not transparently redirect to HTTPS, because this allows clients to configure HTTP URLs without noticing, which risks the integrity of the response. How the proposed requirement is currently worded, they could have a HTTPS redirect, since they don't have "sensitive data in the headers or body". |
So to my mind this is less risky because the attacker would have to have perpetual AiTM to continually feed incorrect data via HTTP |
I'm ok with that. |
Opened #2444 |
I feel like we insufficiently explored whether "sensitive data in the headers or body" is required, and whether integrity protection is needed. I made two comments but the proposed requirement was merged without much discussion. I feel left out, like my contributions were ignored. |
@Sjord - I think your comments were answered. Please revisit this comment and give feedback, does it make sense for you? If not, then please explain.
It was agreed by 3 persons. In that case, if there is no clear problem statement to discuss, it is expected to merge it.
As I understood the problem statement: the scope for this issue is only to "give feedback for misconfigured client to stop using application over If there is some mistake or error in any requirement, we can always re-open related issue and fix it. |
You mentioned this multiple times, but I don't understand why exactly. You seem to assume some misunderstanding on my part, is that right? Do I have an invalid assumption or something like that? To make sure API clients configure the correct (secure) URLs, HTTP URLs should not work. So services should not transparently redirect to HTTPS, unless they expect the URL to by typed by humans into a browser. HTTPS encryption is not only needed for confidentiality but also for integrity, so HTTP URLs should give an error whether the data contains sensitive information or not.
An AiTM that by chance sees some responses by chance and modifies them could already have a large impact, but this depends on the working of the application. In my example, a single modified NASDAQ.json could make the tradebot make incorrect trade decisions. If the tradebot requests this file every minute, it is pretty likely that a AiTM can modify one response. |
@Sjord do you have an alternative wording suggestion? |
|
Could you reword it to be worded as a positive requirement and also include the text that explains why? |
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: