|
| 1 | +@csp @p2 |
| 2 | +Feature: Content Security Policy |
| 3 | + |
| 4 | + As a site owner |
| 5 | + I want the Content-Security-Policy header to include a per-request nonce |
| 6 | + and match the previously enforced policy |
| 7 | + So that BigPipe and other Drupal inline scripts are not blocked by CSP |
| 8 | + and no source is silently widened or narrowed during the migration |
| 9 | + |
| 10 | + @api |
| 11 | + Scenario: CSP header contains a nonce for anonymous users |
| 12 | + Given I am an anonymous user |
| 13 | + When I go to the homepage |
| 14 | + Then the response status code should be 200 |
| 15 | + And the response header "Content-Security-Policy" should contain the value "'nonce-" |
| 16 | + |
| 17 | + @api |
| 18 | + Scenario: CSP header contains a nonce for authenticated users |
| 19 | + Given I am logged in as a user with the "administrator" role |
| 20 | + When I go to the homepage |
| 21 | + Then the response status code should be 200 |
| 22 | + And the response header "Content-Security-Policy" should contain the value "'nonce-" |
| 23 | + |
| 24 | + @api |
| 25 | + Scenario: CSP policy preserves previously allowed sources |
| 26 | + Given I am an anonymous user |
| 27 | + When I go to the homepage |
| 28 | + Then the response status code should be 200 |
| 29 | + And the response header "Content-Security-Policy" should contain the value "default-src 'self'" |
| 30 | + And the response header "Content-Security-Policy" should contain the value "object-src 'none'" |
| 31 | + And the response header "Content-Security-Policy" should contain the value "frame-ancestors 'none'" |
| 32 | + And the response header "Content-Security-Policy" should contain the value "report-uri /report-csp-violation" |
| 33 | + And the response header "Content-Security-Policy" should contain the value "https://www.googletagmanager.com" |
| 34 | + And the response header "Content-Security-Policy" should contain the value "https://www.recaptcha.net" |
| 35 | + And the response header "Content-Security-Policy" should contain the value "https://www.youtube.com" |
| 36 | + And the response header "Content-Security-Policy" should contain the value "https://fonts.gstatic.com" |
| 37 | + And the response header "Content-Security-Policy" should contain the value "https://www.google-analytics.com" |
0 commit comments