Skip to content
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

Allow HTTP routes to programmatically opt out of XSRF protection #53823

Closed
azasypkin opened this issue Dec 27, 2019 · 10 comments · Fixed by #58717
Closed

Allow HTTP routes to programmatically opt out of XSRF protection #53823

azasypkin opened this issue Dec 27, 2019 · 10 comments · Fixed by #58717
Assignees
Labels
enhancement New value added to drive a business result Feature:New Platform Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@azasypkin
Copy link
Member

Currently we have routes that are solely used by the external services (e.g. SAML POST callback route that is called by Identity Provider). Usually such services can't be configured to provide kbn-xsrf HTTP header with their requests and trigger our server XSRF protection as the result.

To workaround that we introduced server.xsrf.whitelist configuration a while ago, but that was never convenient since you should always configure it if you wish to use SAML and with a value that's already known to Kibana (/api/security/saml/callback).

We're a looking for a better way to XSRF-whitelist certain endpoints and eliminate unnecessary admin/user involvement that'd simplify overall setup process. I can think of two options right now:

  • Provide additional route option to mark route as XSRF-whitelisted (similar to authRequired: boolean we already have).

  • Expose programmatic core.http.xsrf-like API that would allow run-time editing of XSRF whitelist.

The first option sounds like a better one overall: simple to understand and easy to audit but I'd like to hear your thoughts on that @elastic/kibana-platform @elastic/kibana-security ?

@azasypkin azasypkin added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! enhancement New value added to drive a business result labels Dec 27, 2019
@kobelb
Copy link
Contributor

kobelb commented Jan 2, 2020

The first option sounds like a better one overall: simple to understand and easy to audit

I also prefer this option because it's immediately obvious from the route definition that we're disabling the XSRF protection and on the surface it seems like less effort.

@jportner
Copy link
Contributor

jportner commented Jan 2, 2020

+1 for the first option.

@pgayvallet
Copy link
Contributor

Related to the changes done in #53684

+1 for first option too.

@mshustov
Copy link
Contributor

mshustov commented Jan 6, 2020

+1 for the first option provided that we delete server.xsrf.whitelist.

@pgayvallet
Copy link
Contributor

@restrry isn't server.xsrf.whitelist for a different usage though? I thought it was present to allow users to explicitely allow cross domains call to some endpoints of their choosing, if they had external API/servers calling Kibana backend for example?

@mshustov
Copy link
Contributor

mshustov commented Jan 6, 2020

@pgayvallet as I can see our docs recommend to set xsrf header for this case:

It is not recommended to disable protections for arbitrary API endpoints. Instead, supply the kbn-xsrf header. There are some scenarios where whitelisting is required, however, such as SAML and OpenID Connect Single Sign-On setups.

https://github.com/elastic/kibana/blob/master/docs/setup/settings.asciidoc

it looks like this parameter has been introduced for 3rd party IP endpoints. @azasypkin can provide more details.

@azasypkin
Copy link
Member Author

it looks like this parameter has been introduced for 3rd party IP endpoints. @azasypkin can provide more details.

Yeah, not much to add here. As far as I'm aware it's only used for SAML/OIDC IdPs (at least that was the initial intention) that can't be configured to send additional headers (usually these are 3rd-parties that you don't have much control over). Any other clients are supposed to provide kbn-xsrf header.

@pgayvallet
Copy link
Contributor

Ok, thanks for the info

@azasypkin
Copy link
Member Author

Thanks everyone for the feedback!

It seems we have a consensus now. @elastic/kibana-platform this functionality would really help us with #39313 that's requested for 7.7, is there any chance you can include this new feature into your 7.7 roadmap?

@mshustov
Copy link
Contributor

mshustov commented Feb 6, 2020

@azasypkin moved to 7.7 backlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:New Platform Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants