Use fetch_csp() to load & parse a CSP from a remote site. Use parse_csp() to parse an already fetched or composed CSP.

parse_csp(csp_text, origin_url)

fetch_csp(origin_url, method = c("head", "get"))

Arguments

csp_text

length 1 character vector containing CSP text

origin_url

site to fetch CSP from or to use when just parsing a plain text (possibly already fetched) CSP

method

method to use fetch CSP (sites may change headers returned depending on the method used)

References

Content Security Policy Level 3

Examples

# NOT RUN {
parse_csp("default-src: 'none'", "https://example.com")
fetch_csp("https://rud.is/")
# }