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

Matomo should be setting content security policy to prevent some XSS #17773

Closed
tsteur opened this issue Jul 14, 2021 · 0 comments · Fixed by #17798
Closed

Matomo should be setting content security policy to prevent some XSS #17773

tsteur opened this issue Jul 14, 2021 · 0 comments · Fixed by #17798
Assignees
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Jul 14, 2021

This is for the Matomo UI (not tracking). For better security we shouldn't leave it up to users to configure content security policy. We should set a CSP to only allow requests to the current domain. Note: When Matomo is behind a load balancer etc then it might not know the correct domain it is on so would need to use trusted hosts maybe (or in some cases).

Not sure if there are any external domains the UI requests. In any case plugins should allow to configure extra rules. These rules would probably be applied to all Matomo requests (as eg if a widget does external requests by the time the widget is requested then it cannot change the CSP). Additionally, for better security, we may give plugins the ability to enrich the CSP for a specific controller/action request. This way they would only change the CSP for the current request but not other pages. This can be useful if a plugin renders an entire page.

We may also need to allow extra configurations through the config file.

We could also be making use of nonce-source which may be quite good but not sure it fully works or whether some other plugins may add script tags dynamically etc where this could get difficult.

@tsteur tsteur added the c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. label Jul 14, 2021
@tsteur tsteur added this to the 4.5.0 milestone Jul 14, 2021
@tsteur tsteur changed the title Matomo should be setting content security policy Matomo should be setting content security policy to prevent some XSS Jul 14, 2021
@justinvelluppillai justinvelluppillai self-assigned this Jul 22, 2021
@mattab mattab modified the milestones: 4.6.0, 4.5.0 Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants