Simple CSP parser. Does not validate or normalise.
By specification, a CSP is a map of directive name to directive value and
directive value is a set1.
So this parser gives you a JS Map of String => Set.
This code is an implementation of the canonical serialized CSP parsing
algorithm2. With the additional rule that directive-names are forced to
lowercase because CSPv2 specifies case-insensitive matching of names3 and
all the valid names are canonically lowercase. Discussion4.
If you want directive name validation use csputil or add a validate function.
Simple CSP parser. Does not validate or normalise.
By specification, a CSP is a map of directive name to directive value and directive value is a set1.
So this parser gives you a JS Map of String => Set.
This code is an implementation of the canonical serialized CSP parsing algorithm2. With the additional rule that directive-names are forced to lowercase because CSPv2 specifies case-insensitive matching of names3 and all the valid names are canonically lowercase. Discussion4.
If you want directive name validation use csputil or add a validate function.