-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add option to forbid plain http requests (where ssl-redirect is unsafe) #11391
Comments
Interesting, this seems like a absolute requirement for related users. /triage accepted What have you tried so far ? From the current list of features I mean. |
Oh yeah sorry. This works:
It results in: $ curl -i http://myapi.example.com
HTTP/1.1 403 Forbidden
Date: Wed, 29 May 2024 12:57:22 GMT
Content-Type: text/html
Content-Length: 94
Connection: keep-alive
This endpoint is only accessible via https. You are currently using plaintext http.
$ curl -i https://myapi.example.com | head -n 1
HTTP/2 200 Note that this works even if |
Thanks, that So a feature would be to instrument that Lets wait for other comments. |
This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach |
Update: sometimes nginx is running behind another proxy (with
|
Hi @awoimbee, @strongjz, @longwuyuan, I’ve just submitted a PR #12384 introducing two new annotations: These annotations are implemented using Lua and are designed to function similarly to
Looking forward to your feedback! |
Revisiting this after months caused a fresh perspective, in light of the status of this controller.
So in the light of above factors, implementing new annotations that are not implied by the upstream K8S KEP for the Ingress-API but rather implied by a user error seems not feasible. Not because of lack of interest but because of lack of resources to support/maintain and enhance such features. This originates from the direction that the project needs to do rock solid implementation of the K8S Ingress-API and the implied functions. So thanks for the contribution, but there are practical problems like validating the annotation and making such annotations rich enough to handle all kinds of user initiated situations. Design wise, a application development team and a user ought to NOT send tokens over HTTP/PlainText, to begin with. Wait for other comments but I would not recommend the implementation of proposed new annotations. I know its not what I initially indicated but syncing with reality is high priority. |
According to OWASP, the best practice for HTTPS API services is disable HTTP or fail HTTP requests. Redirection is a common but insecure practice. Misconfigured clients would inadvertently expose sensitive information such as API keys without ever knowing about it. In my opinion, this is an important security feature. Without this feature, the only way to implement such best practice is snippets. However, snippets are almost always disabled for good reasons - prevent arbitrary code injection. The implementation of this feature is simple. It is just a small twist of the existing SSL redirect annotations. The maintenance overhead is minimal and totally justify the benefits. Resource shortage - do we have a backlog somewhere? I'm happy to contribute and help. |
@gavinkflam thanks for the contribution efforts and also thanks for the detailed pot. I think that if you attend the community meeting and explain this, it may get comments from the maintainers. |
@longwuyuan Thank you. I’ll try to join. Is this the weekly meeting on Thursdays 4 PM UTC? Also, does it typically last the full hour? |
I host an API, a webapp (and much more).
I want HTTP requests to the webapp to be redirected to HTTPS -> I use
ssl-redirect
.I want HTTP requests to the API to return a 4XX "
http_unsupported: This endpoint is only accessible over HTTPS.
"Reason:
If an API consumer misconfigures his client to use plain HTTP, he won't know about it but all his secret tokens will be sent plaintext.
See hackernews API Shouldn't Redirect HTTP to HTTPS.
Most APIs (that don't redirect to HTTPS) return a 403, npm returns a 426 with no
Upgrade
header.The text was updated successfully, but these errors were encountered: