-
Notifications
You must be signed in to change notification settings - Fork 616
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
Bug 1622372 - Require CSRF token on all proxied requests #461
Conversation
* Require a CSRF token on all proxied requests. This prevents loading content hosted from a pod under the console domain by clicking on a link that uses the console proxy. Previously, it was not required for GET requests. * Do not forward the X-CSRFToken header through the proxy. * Set `Content-Security-Policy: default-src 'none'` in the proxied response to prevent scripts from running in proxied content. In order to support the CSRF token for WebSockets, this adds an `x-csrf-token` query parameter when headers can't be set. It also updates the console to check the `Origin` header when present since `Referer` is not set for WebSockets. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1622372
lgtm |
@spadgett one quick question: how does we including csrf-token into proxied requests to perform GET requests? It can get application content with web console proxy from terminal like: |
@spadgett bump, in case you miss the above question. Thank you. |
@SSshahan You need to include both the edit: This should actually be a cookie not the authorization header... (Getting my consoles mixed up.) |
@spadgett thanks, but get |
Right, it's expected since the request doesn't have the two cookies. You should include the I'd recommend using "Copy -> Copy as cURL" from the Network tab of Chrome developer tools. |
@spadgett It works finally, |
content hosted from a pod under the console domain by clicking on a
link that uses the console proxy. Previously, it was not required for
GET requests.
Content-Security-Policy: default-src 'none'
in the proxiedresponse to prevent scripts from running in proxied content.
In order to support the CSRF token for WebSockets, this adds an
x-csrf-token
query parameter when headers can't be set. It also updatesthe console to check the
Origin
header when present sinceReferer
isnot set for WebSockets.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1622372
/assign @liggitt