Class PolicyList

java.lang.Object
org.htmlunit.csp.PolicyList
All Implemented Interfaces:
CspQueries

public class PolicyList extends Object implements CspQueries
Represents a list of Content Security Policies parsed from a comma-separated serialized CSP list, or combined from multiple header / meta deliveries.

A serialized CSP list (e.g. the value of a Content-Security-Policy HTTP header) may contain multiple policies separated by commas. Each policy is parsed independently, and a resource is blocked if any policy in the list blocks it — equivalently, allows* methods return true only when every member policy allows the resource. See CSP3 multiple policies.

Implements CspQueries: each query method AND-delegates to member Policy instances (short-circuit on the first deny). An empty list is unrestricted (all allows* return true).

Instances are created by Policy.parseSerializedCSPList(String, PolicyListErrorConsumer) or ofSerialized(List, PolicyListErrorConsumer). Empty policies (those with no directives) are omitted during parsing.

Author:
Ronald Brill, Rick Mitchell, Salvation Team
See Also: