|
Lines 224-230
subtest 'Content-Security-Policy tests' => sub {
Link Here
|
| 224 |
'content_security_policy', |
224 |
'content_security_policy', |
| 225 |
{ 'opac' => { csp_mode => 'report-only', csp_header_value => $expected_csp_header_value } } |
225 |
{ 'opac' => { csp_mode => 'report-only', csp_header_value => $expected_csp_header_value } } |
| 226 |
); |
226 |
); |
| 227 |
$expected_csp_header_value =~ s/_CSP_NONCE_//g; |
|
|
| 228 |
|
227 |
|
| 229 |
my $query = CGI->new(); |
228 |
my $query = CGI->new(); |
| 230 |
|
229 |
|
|
Lines 242-247
subtest 'Content-Security-Policy tests' => sub {
Link Here
|
| 242 |
} |
241 |
} |
| 243 |
); |
242 |
); |
| 244 |
|
243 |
|
|
|
244 |
my $cache = Koha::Cache::Memory::Lite->get_instance; |
| 245 |
my $nonce = $cache->get_from_cache("csp_nonce"); |
| 246 |
$expected_csp_header_value =~ s/_CSP_NONCE_/nonce-$nonce/g; |
| 245 |
C4::Output::output_html_with_http_headers( $query, $cookie, $template->output ); |
247 |
C4::Output::output_html_with_http_headers( $query, $cookie, $template->output ); |
| 246 |
|
248 |
|
| 247 |
$stdout =~ /(Content-Security-Policy[A-Za-z\-]*): (.*)\r/im; |
249 |
$stdout =~ /(Content-Security-Policy[A-Za-z\-]*): (.*)\r/im; |
|
Lines 280-286
subtest 'Content-Security-Policy tests' => sub {
Link Here
|
| 280 |
'content_security_policy', |
282 |
'content_security_policy', |
| 281 |
{ 'opac' => { csp_mode => 'enabled', csp_header_value => $expected_csp_header_value } } |
283 |
{ 'opac' => { csp_mode => 'enabled', csp_header_value => $expected_csp_header_value } } |
| 282 |
); |
284 |
); |
| 283 |
$expected_csp_header_value =~ s/_CSP_NONCE_//g; |
|
|
| 284 |
|
285 |
|
| 285 |
my $query = CGI->new(); |
286 |
my $query = CGI->new(); |
| 286 |
|
287 |
|
|
Lines 298-303
subtest 'Content-Security-Policy tests' => sub {
Link Here
|
| 298 |
} |
299 |
} |
| 299 |
); |
300 |
); |
| 300 |
|
301 |
|
|
|
302 |
my $cache = Koha::Cache::Memory::Lite->get_instance; |
| 303 |
my $nonce = $cache->get_from_cache("csp_nonce"); |
| 304 |
$expected_csp_header_value =~ s/_CSP_NONCE_/nonce-$nonce/g; |
| 305 |
|
| 301 |
C4::Output::output_html_with_http_headers( $query, $cookie, $template->output ); |
306 |
C4::Output::output_html_with_http_headers( $query, $cookie, $template->output ); |
| 302 |
|
307 |
|
| 303 |
$stdout =~ /(Content-Security-Policy[A-Za-z\-]*): (.*)\r/im; |
308 |
$stdout =~ /(Content-Security-Policy[A-Za-z\-]*): (.*)\r/im; |
| 304 |
- |
|
|