Struct content_security_policy::CspList
source · pub struct CspList(pub Vec<Policy>);
Expand description
https://www.w3.org/TR/CSP/#csp-list
Tuple Fields§
§0: Vec<Policy>
Implementations§
source§impl CspList
impl CspList
pub fn is_valid(&self) -> bool
sourcepub fn contains_a_header_delivered_content_security_policy(&self) -> bool
pub fn contains_a_header_delivered_content_security_policy(&self) -> bool
https://www.w3.org/TR/CSP/#contains-a-header-delivered-content-security-policy
sourcepub fn parse(
list: &str,
source: PolicySource,
disposition: PolicyDisposition,
) -> CspList
pub fn parse( list: &str, source: PolicySource, disposition: PolicyDisposition, ) -> CspList
https://www.w3.org/TR/CSP/#parse-serialized-policy-list
pub fn append(&mut self, other: CspList)
pub fn push(&mut self, policy: Policy)
sourcepub fn report_violations_for_request(&self, request: &Request) -> Vec<Violation>
pub fn report_violations_for_request(&self, request: &Request) -> Vec<Violation>
Given a request, this algorithm reports violations based on client’s “report only” policies.
https://www.w3.org/TR/CSP/#report-for-request
sourcepub fn should_request_be_blocked(
&self,
request: &Request,
) -> (CheckResult, Vec<Violation>)
pub fn should_request_be_blocked( &self, request: &Request, ) -> (CheckResult, Vec<Violation>)
Given a request, this algorithm returns Blocked or Allowed and reports violations based on request’s client’s Content Security Policy.
https://www.w3.org/TR/CSP/#should-block-request
sourcepub fn should_response_to_request_be_blocked(
&self,
request: &Request,
response: &Response,
) -> (CheckResult, Vec<Violation>)
pub fn should_response_to_request_be_blocked( &self, request: &Request, response: &Response, ) -> (CheckResult, Vec<Violation>)
Given a response and a request, this algorithm returns Blocked or Allowed, and reports violations based on request’s client’s Content Security Policy.
https://www.w3.org/TR/CSP/#should-block-response
sourcepub fn should_elements_inline_type_behavior_be_blocked(
&self,
element: &Element<'_>,
type_: InlineCheckType,
source: &str,
) -> (CheckResult, Vec<Violation>)
pub fn should_elements_inline_type_behavior_be_blocked( &self, element: &Element<'_>, type_: InlineCheckType, source: &str, ) -> (CheckResult, Vec<Violation>)
https://www.w3.org/TR/CSP/#should-block-inline
sourcepub fn is_base_allowed_for_document(
&self,
base: &Url,
self_origin: &Origin,
) -> (CheckResult, Vec<Violation>)
pub fn is_base_allowed_for_document( &self, base: &Url, self_origin: &Origin, ) -> (CheckResult, Vec<Violation>)
https://www.w3.org/TR/CSP/#allow-base-for-document
Note that, while this algoritm is defined as operating on a document, the only property it actually uses is the document’s CSP List. So this function operates on that.
pub fn get_sandboxing_flag_set_for_document(&self) -> Option<SandboxingFlagSet>
sourcepub fn is_js_evaluation_allowed(&self) -> CheckResult
pub fn is_js_evaluation_allowed(&self) -> CheckResult
https://www.w3.org/TR/CSP/#can-compile-strings
sourcepub fn is_wasm_evaluation_allowed(&self) -> CheckResult
pub fn is_wasm_evaluation_allowed(&self) -> CheckResult
https://www.w3.org/TR/CSP/#can-compile-wasm-bytes