Commit Graph

6 Commits

Author SHA1 Message Date
Stan Hu f605898191 Fix Piwik not working
Due to indentation, the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31402 broke the
templating of Piwik script header.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66627
2019-08-26 15:46:14 -07:00
Stan Hu 5fbbd3dd6e
Add support for Content-Security-Policy
A nonce-based Content-Security-Policy thwarts XSS attacks by allowing
inline JavaScript to execute if the script nonce matches the header
value. Rails 5.2 supports nonce-based Content-Security-Policy headers,
so provide configuration to enable this and make it work.

To support this, we need to change all `:javascript` HAML filters to the
following form:

```
= javascript_tag nonce: true do
  :plain
    ...
```

We use `%script` throughout our HAML to store JSON and other text, but
since this doesn't execute, browsers don't appear to block this content
from being used and require the nonce value to be present.
2019-08-07 12:37:31 +10:00
CDuv 38635c645e Adds quotes to Matomo/Piwik website ID
When using Matomo/Piwik integration, only integer website IDs can be used.
If using the "Protect Track ID" Matomo plugin (https://plugins.matomo.org/ProtectTrackID), website IDs are strings which the "_piwik.html.haml" layout file does not supports because it assumes "extra_config.piwik_site_id" variable contains an integer and prints it to JavaScript code without quotes.

This commits surrounds "extra_config.piwik_site_id" variable with double quotes (") so that it works with both integers and strings.

Issue: #61606
2019-05-08 17:25:38 +00:00
Tim Zallmann 423d31a300 Inline script cleanup globals and easy 2017-08-01 08:50:59 +00:00
Achilleas Pipinellis b8cd6f9aae Update piwik template 2015-11-08 18:03:30 +02:00
Sebastian Winkler 64e4b400d0 Added Piwik support 2014-02-23 15:13:38 +01:00