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

[Serverless-observability-CDN-QA] Maps can't load external layers #179061

Closed
jsanz opened this issue Mar 20, 2024 · 15 comments · Fixed by #179609
Closed

[Serverless-observability-CDN-QA] Maps can't load external layers #179061

jsanz opened this issue Mar 20, 2024 · 15 comments · Fixed by #179609
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Maps Project:Serverless Work as part of the Serverless project for its initial release Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@jsanz
Copy link
Member

jsanz commented Mar 20, 2024

Kibana version:

Kibana version: Serverless observability project testing for CDN readiness

Browser version:

Firefox 124

Describe the bug:

The new CSP policy disallows Maps to load external layers from WMS or Tile providers.

Steps to reproduce:

  1. Create a dashboard and add a map
  2. Scroll down and select the "Web Map Service" card
  3. Put this URL to load https://www.ign.es/wms-inspire/pnoa-ma

Expected behavior:

The wizard continues with the normal workflow to select a layer and a style.

Screenshots (if relevant):

image

Errors in browser console (if relevant):

Content-Security-Policy: The page’s settings blocked the loading 
of a resource at https://www.ign.es/wms-inspire/pnoa-ma?
version=1.1.1&request=GetCapabilities&service=WMS (“connect-src”).

Any additional context:

This issue was mentioned on a comment at #177732 (comment)


As described in #179061 (comment), we need to relax our CSP connect-src directive to allow connections to any https: resource.

@jsanz jsanz added the bug Fixes for quality problems that affect the customer experience label Mar 20, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Mar 20, 2024
@jsanz jsanz added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Mar 20, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Mar 20, 2024
@jsanz
Copy link
Member Author

jsanz commented Mar 20, 2024

cc. @elastic/kibana-presentation

@jsanz jsanz added Feature:Maps Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Mar 20, 2024
@jloleysens
Copy link
Contributor

This will likely need to be reworked in a way that avoids the browser calling to external domains directly. On way is to use Kibana server to call to the other domain to load this metadata. I'm not familiar enough with this feature to say what the repercussions of that are however.

@jsanz
Copy link
Member Author

jsanz commented Mar 21, 2024

Thanks for clarifying, @jloleysens. Moving the management of HTTP requests from the browser to the Kibana Server is not trivial, so this needs further team discussion to prioritize.

Are CSP restrictions to be enforced by default for all Kibana versions (self-hosted, cloud, serverless)?

@nreese
Copy link
Contributor

nreese commented Mar 21, 2024

This will likely need to be reworked in a way that avoids the browser calling to external domains directly. On way is to use Kibana server to call to the other domain to load this metadata. I'm not familiar enough with this feature to say what the repercussions of that are however.

I don't think this solution will work. We used to have an option to proxy EMS requests through the kibana server. This feature received a lot of negative feedback from customers (so much negative feedback that we removed it and changed how Kibana accesses EMS). The network topology did not reflect what customers require. In many networks, the browser has access to public resources but the kibana server does not. It is very standard requirement for mapping applications to access content from 3rd party services.

@jloleysens
Copy link
Contributor

jloleysens commented Mar 22, 2024

Are CSP restrictions to be enforced by default for all Kibana versions (self-hosted, cloud, serverless)?

I'm thinking of serverless. But any user anyone running Kibana can configure csp for connect-src and it would have the same result.

@jloleysens
Copy link
Contributor

jloleysens commented Mar 22, 2024

It is very standard requirement for mapping applications to access content from 3rd party services.

Good point. It seems we self host many of the third party assets we need for maps. However, in this case we allow users to enter and call any URL they want in our client which doesn't work with CSP.

I'm not familiair enough with this feature to say but perhaps the metadata retrieval can be done another way like simply pasting it in? Or uploaded? Less ergonomic of course. Or, just for serverless, we could route through server side that could do some further sanity checks on the data returned?

@jloleysens jloleysens added the Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! label Mar 22, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@jloleysens jloleysens changed the title [Serverless-observability-CDN-QA] Maps can't load external layers [Maps/Security] Maps can't load external layers Mar 22, 2024
@jloleysens jloleysens changed the title [Maps/Security] Maps can't load external layers [Serverless-observability-CDN-QA] Maps can't load external layers Mar 22, 2024
@jeramysoucy
Copy link
Contributor

I've raised this issue with the team (Kibana security) for discussion.

@legrego
Copy link
Member

legrego commented Mar 22, 2024

Is the ability to load external layers a feature that's required for serverless GA? Knowing this will inform the options available to us. If we have more time to solve for this, then we can likely come up with something that satisfies your needs without completely removing the connect-src directive from our CSP.

If it is required for GA, is there a set of hosts that would satisfy the majority of our user's needs in the short term, while we work on a more configurable solution?

@nreese
Copy link
Contributor

nreese commented Mar 22, 2024

Is the ability to load external layers a feature that's required for serverless GA?

I would say yes, but this should be a question for Product.

If it is required for GA, is there a set of hosts that would satisfy the majority of our user's needs in the short term, while we work on a more configurable solution?

Its not possible to gather a set of hosts because external sources are really dependent on use case and customer. For example, weather data is gathered and published by most governments. Customers will likely get weather data from their respective government. Also, with the Serverless Elasticsearch SKU, the use case could be anything. Maybe its farming and you need to see historical precipitation, or invasive species coverage, or crop yields. Customers can also host their own WMS and TileServices and expect to view these in Kibana Maps. There is no way to anticipate which services are going to be required.

The value proposition with Maps is layering contextual information on a single map. Without this, Kibana Maps is a very handicapped product.

@legrego
Copy link
Member

legrego commented Mar 22, 2024

Thanks, @nreese, that context is helpful. We'll respond to this issue soon with a proposal.

@legrego
Copy link
Member

legrego commented Mar 27, 2024

We discussed this yesterday. From our perspective, it would be ideal if we could give administrators a mechanism to control which origins Kibana is allowed to connect to (via connect-src).

That is not a small or well-defined task, and would be unrealistic to accomplish prior to GA. Given this, our next-best option is to relax the connect-src directive to accommodate your needs.

Since these resources could exist on nearly any origin, we won't be able to create an "allow list". We would also prefer not to allow all connections if possible. My question to the geo experts:

  • Would it be sufficient to allow access to all https resources? Do you require the ability to contact http resources, or any other protocol except for https?

@jsanz
Copy link
Member Author

jsanz commented Mar 27, 2024

  • Would it be sufficient to allow access to all https resources? Do you require the ability to contact http resources, or any other protocol except for https?

Allowing loading only https resources is fair. In fact, in ESS, it is already impossible to load http endpoints because of the mixed active content policy

image

@legrego legrego added blocker Project:Serverless Work as part of the Serverless project for its initial release labels Mar 27, 2024
@legrego
Copy link
Member

legrego commented Mar 27, 2024

Thanks, @jsanz. We'll proceed with relaxing the connect-src to permit all connections to https: for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Maps Project:Serverless Work as part of the Serverless project for its initial release Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas 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.

6 participants