humanmade / humanmade/altis-browser-security

Documentation: Cannot add property with policy value filter

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The documentation for the main `content_security_policies` filter shows adding `base-uri`:
```
add_filter( 'altis.security.browser.content_security_policies', function ( array $policies ) : array {
$policies['base-uri'] = 'self';
// ...etc
return $policies;
} );
```

However, because `base-uri` isn't in the base object of content security policy directives we pass into the CSP header logic, we never check for a `base-uri` filter and the filter below (which I believe you would logically conclude would work, reading the README) will never run:
```
altis.security.browser.filter_report_only_policy_value.base-uri
```
This is confusing, and we should clarify the list of CSP directives that will work as policy value filters out of the box, and note that further directives should be added using the first filter (or Altis config) prior to filtering.

Alternatively, we could expand our base list to include [all supported directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.