// CSP recipe library for common migration starting points.
///|
pub fn recipe_static_site_core() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
}
///|
pub fn recipe_static_site_core_policy() -> Policy {
parse(recipe_static_site_core())
}
///|
pub fn recipe_static_site_core_findings() -> Array[Finding] {
extended_audit(recipe_static_site_core_policy())
}
///|
pub fn recipe_static_site_with_reports() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-to csp-endpoint"
}
///|
pub fn recipe_static_site_with_reports_policy() -> Policy {
parse(recipe_static_site_with_reports())
}
///|
pub fn recipe_static_site_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_reports_policy())
}
///|
pub fn recipe_static_site_with_upgrade() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; upgrade-insecure-requests"
}
///|
pub fn recipe_static_site_with_upgrade_policy() -> Policy {
parse(recipe_static_site_with_upgrade())
}
///|
pub fn recipe_static_site_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_upgrade_policy())
}
///|
pub fn recipe_static_site_with_trusted_types() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_static_site_with_trusted_types_policy() -> Policy {
parse(recipe_static_site_with_trusted_types())
}
///|
pub fn recipe_static_site_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_trusted_types_policy())
}
///|
pub fn recipe_static_site_with_prefetch() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; prefetch-src 'self'"
}
///|
pub fn recipe_static_site_with_prefetch_policy() -> Policy {
parse(recipe_static_site_with_prefetch())
}
///|
pub fn recipe_static_site_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_prefetch_policy())
}
///|
pub fn recipe_static_site_with_manifest() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; manifest-src 'self'"
}
///|
pub fn recipe_static_site_with_manifest_policy() -> Policy {
parse(recipe_static_site_with_manifest())
}
///|
pub fn recipe_static_site_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_manifest_policy())
}
///|
pub fn recipe_static_site_with_navigation() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; navigate-to 'self'"
}
///|
pub fn recipe_static_site_with_navigation_policy() -> Policy {
parse(recipe_static_site_with_navigation())
}
///|
pub fn recipe_static_site_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_navigation_policy())
}
///|
pub fn recipe_static_site_with_legacy_report() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_static_site_with_legacy_report_policy() -> Policy {
parse(recipe_static_site_with_legacy_report())
}
///|
pub fn recipe_static_site_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_static_site_with_legacy_report_policy())
}
///|
pub fn recipe_static_site_sandboxed() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_static_site_sandboxed_policy() -> Policy {
parse(recipe_static_site_sandboxed())
}
///|
pub fn recipe_static_site_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_static_site_sandboxed_policy())
}
///|
pub fn recipe_static_site_locked_forms() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'"
}
///|
pub fn recipe_static_site_locked_forms_policy() -> Policy {
parse(recipe_static_site_locked_forms())
}
///|
pub fn recipe_static_site_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_static_site_locked_forms_policy())
}
///|
pub fn recipe_docs_site_core() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
}
///|
pub fn recipe_docs_site_core_policy() -> Policy {
parse(recipe_docs_site_core())
}
///|
pub fn recipe_docs_site_core_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_core_policy())
}
///|
pub fn recipe_docs_site_with_reports() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-to csp-endpoint"
}
///|
pub fn recipe_docs_site_with_reports_policy() -> Policy {
parse(recipe_docs_site_with_reports())
}
///|
pub fn recipe_docs_site_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_reports_policy())
}
///|
pub fn recipe_docs_site_with_upgrade() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; upgrade-insecure-requests"
}
///|
pub fn recipe_docs_site_with_upgrade_policy() -> Policy {
parse(recipe_docs_site_with_upgrade())
}
///|
pub fn recipe_docs_site_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_upgrade_policy())
}
///|
pub fn recipe_docs_site_with_trusted_types() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_docs_site_with_trusted_types_policy() -> Policy {
parse(recipe_docs_site_with_trusted_types())
}
///|
pub fn recipe_docs_site_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_trusted_types_policy())
}
///|
pub fn recipe_docs_site_with_prefetch() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; prefetch-src 'self'"
}
///|
pub fn recipe_docs_site_with_prefetch_policy() -> Policy {
parse(recipe_docs_site_with_prefetch())
}
///|
pub fn recipe_docs_site_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_prefetch_policy())
}
///|
pub fn recipe_docs_site_with_manifest() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; manifest-src 'self'"
}
///|
pub fn recipe_docs_site_with_manifest_policy() -> Policy {
parse(recipe_docs_site_with_manifest())
}
///|
pub fn recipe_docs_site_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_manifest_policy())
}
///|
pub fn recipe_docs_site_with_navigation() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; navigate-to 'self'"
}
///|
pub fn recipe_docs_site_with_navigation_policy() -> Policy {
parse(recipe_docs_site_with_navigation())
}
///|
pub fn recipe_docs_site_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_navigation_policy())
}
///|
pub fn recipe_docs_site_with_legacy_report() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_docs_site_with_legacy_report_policy() -> Policy {
parse(recipe_docs_site_with_legacy_report())
}
///|
pub fn recipe_docs_site_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_with_legacy_report_policy())
}
///|
pub fn recipe_docs_site_sandboxed() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_docs_site_sandboxed_policy() -> Policy {
parse(recipe_docs_site_sandboxed())
}
///|
pub fn recipe_docs_site_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_sandboxed_policy())
}
///|
pub fn recipe_docs_site_locked_forms() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'"
}
///|
pub fn recipe_docs_site_locked_forms_policy() -> Policy {
parse(recipe_docs_site_locked_forms())
}
///|
pub fn recipe_docs_site_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_docs_site_locked_forms_policy())
}
///|
pub fn recipe_wasm_app_core() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'"
}
///|
pub fn recipe_wasm_app_core_policy() -> Policy {
parse(recipe_wasm_app_core())
}
///|
pub fn recipe_wasm_app_core_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_core_policy())
}
///|
pub fn recipe_wasm_app_with_reports() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-to csp-endpoint"
}
///|
pub fn recipe_wasm_app_with_reports_policy() -> Policy {
parse(recipe_wasm_app_with_reports())
}
///|
pub fn recipe_wasm_app_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_reports_policy())
}
///|
pub fn recipe_wasm_app_with_upgrade() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; upgrade-insecure-requests"
}
///|
pub fn recipe_wasm_app_with_upgrade_policy() -> Policy {
parse(recipe_wasm_app_with_upgrade())
}
///|
pub fn recipe_wasm_app_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_upgrade_policy())
}
///|
pub fn recipe_wasm_app_with_trusted_types() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_wasm_app_with_trusted_types_policy() -> Policy {
parse(recipe_wasm_app_with_trusted_types())
}
///|
pub fn recipe_wasm_app_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_trusted_types_policy())
}
///|
pub fn recipe_wasm_app_with_prefetch() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; prefetch-src 'self'"
}
///|
pub fn recipe_wasm_app_with_prefetch_policy() -> Policy {
parse(recipe_wasm_app_with_prefetch())
}
///|
pub fn recipe_wasm_app_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_prefetch_policy())
}
///|
pub fn recipe_wasm_app_with_manifest() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; manifest-src 'self'"
}
///|
pub fn recipe_wasm_app_with_manifest_policy() -> Policy {
parse(recipe_wasm_app_with_manifest())
}
///|
pub fn recipe_wasm_app_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_manifest_policy())
}
///|
pub fn recipe_wasm_app_with_navigation() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; navigate-to 'self'"
}
///|
pub fn recipe_wasm_app_with_navigation_policy() -> Policy {
parse(recipe_wasm_app_with_navigation())
}
///|
pub fn recipe_wasm_app_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_navigation_policy())
}
///|
pub fn recipe_wasm_app_with_legacy_report() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_wasm_app_with_legacy_report_policy() -> Policy {
parse(recipe_wasm_app_with_legacy_report())
}
///|
pub fn recipe_wasm_app_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_with_legacy_report_policy())
}
///|
pub fn recipe_wasm_app_sandboxed() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_wasm_app_sandboxed_policy() -> Policy {
parse(recipe_wasm_app_sandboxed())
}
///|
pub fn recipe_wasm_app_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_sandboxed_policy())
}
///|
pub fn recipe_wasm_app_locked_forms() -> String {
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'; worker-src 'self'; img-src 'self' blob: data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; form-action 'self'"
}
///|
pub fn recipe_wasm_app_locked_forms_policy() -> Policy {
parse(recipe_wasm_app_locked_forms())
}
///|
pub fn recipe_wasm_app_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_wasm_app_locked_forms_policy())
}
///|
pub fn recipe_admin_console_core() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
}
///|
pub fn recipe_admin_console_core_policy() -> Policy {
parse(recipe_admin_console_core())
}
///|
pub fn recipe_admin_console_core_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_core_policy())
}
///|
pub fn recipe_admin_console_with_reports() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-to csp-endpoint"
}
///|
pub fn recipe_admin_console_with_reports_policy() -> Policy {
parse(recipe_admin_console_with_reports())
}
///|
pub fn recipe_admin_console_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_reports_policy())
}
///|
pub fn recipe_admin_console_with_upgrade() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; upgrade-insecure-requests"
}
///|
pub fn recipe_admin_console_with_upgrade_policy() -> Policy {
parse(recipe_admin_console_with_upgrade())
}
///|
pub fn recipe_admin_console_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_upgrade_policy())
}
///|
pub fn recipe_admin_console_with_trusted_types() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_admin_console_with_trusted_types_policy() -> Policy {
parse(recipe_admin_console_with_trusted_types())
}
///|
pub fn recipe_admin_console_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_trusted_types_policy())
}
///|
pub fn recipe_admin_console_with_prefetch() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; prefetch-src 'self'"
}
///|
pub fn recipe_admin_console_with_prefetch_policy() -> Policy {
parse(recipe_admin_console_with_prefetch())
}
///|
pub fn recipe_admin_console_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_prefetch_policy())
}
///|
pub fn recipe_admin_console_with_manifest() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; manifest-src 'self'"
}
///|
pub fn recipe_admin_console_with_manifest_policy() -> Policy {
parse(recipe_admin_console_with_manifest())
}
///|
pub fn recipe_admin_console_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_manifest_policy())
}
///|
pub fn recipe_admin_console_with_navigation() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; navigate-to 'self'"
}
///|
pub fn recipe_admin_console_with_navigation_policy() -> Policy {
parse(recipe_admin_console_with_navigation())
}
///|
pub fn recipe_admin_console_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_navigation_policy())
}
///|
pub fn recipe_admin_console_with_legacy_report() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_admin_console_with_legacy_report_policy() -> Policy {
parse(recipe_admin_console_with_legacy_report())
}
///|
pub fn recipe_admin_console_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_with_legacy_report_policy())
}
///|
pub fn recipe_admin_console_sandboxed() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_admin_console_sandboxed_policy() -> Policy {
parse(recipe_admin_console_sandboxed())
}
///|
pub fn recipe_admin_console_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_sandboxed_policy())
}
///|
pub fn recipe_admin_console_locked_forms() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'"
}
///|
pub fn recipe_admin_console_locked_forms_policy() -> Policy {
parse(recipe_admin_console_locked_forms())
}
///|
pub fn recipe_admin_console_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_admin_console_locked_forms_policy())
}
///|
pub fn recipe_analytics_light_core() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'"
}
///|
pub fn recipe_analytics_light_core_policy() -> Policy {
parse(recipe_analytics_light_core())
}
///|
pub fn recipe_analytics_light_core_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_core_policy())
}
///|
pub fn recipe_analytics_light_with_reports() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; report-to csp-endpoint"
}
///|
pub fn recipe_analytics_light_with_reports_policy() -> Policy {
parse(recipe_analytics_light_with_reports())
}
///|
pub fn recipe_analytics_light_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_reports_policy())
}
///|
pub fn recipe_analytics_light_with_upgrade() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; upgrade-insecure-requests"
}
///|
pub fn recipe_analytics_light_with_upgrade_policy() -> Policy {
parse(recipe_analytics_light_with_upgrade())
}
///|
pub fn recipe_analytics_light_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_upgrade_policy())
}
///|
pub fn recipe_analytics_light_with_trusted_types() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_analytics_light_with_trusted_types_policy() -> Policy {
parse(recipe_analytics_light_with_trusted_types())
}
///|
pub fn recipe_analytics_light_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_trusted_types_policy())
}
///|
pub fn recipe_analytics_light_with_prefetch() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; prefetch-src 'self'"
}
///|
pub fn recipe_analytics_light_with_prefetch_policy() -> Policy {
parse(recipe_analytics_light_with_prefetch())
}
///|
pub fn recipe_analytics_light_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_prefetch_policy())
}
///|
pub fn recipe_analytics_light_with_manifest() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; manifest-src 'self'"
}
///|
pub fn recipe_analytics_light_with_manifest_policy() -> Policy {
parse(recipe_analytics_light_with_manifest())
}
///|
pub fn recipe_analytics_light_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_manifest_policy())
}
///|
pub fn recipe_analytics_light_with_navigation() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; navigate-to 'self'"
}
///|
pub fn recipe_analytics_light_with_navigation_policy() -> Policy {
parse(recipe_analytics_light_with_navigation())
}
///|
pub fn recipe_analytics_light_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_navigation_policy())
}
///|
pub fn recipe_analytics_light_with_legacy_report() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_analytics_light_with_legacy_report_policy() -> Policy {
parse(recipe_analytics_light_with_legacy_report())
}
///|
pub fn recipe_analytics_light_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_with_legacy_report_policy())
}
///|
pub fn recipe_analytics_light_sandboxed() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_analytics_light_sandboxed_policy() -> Policy {
parse(recipe_analytics_light_sandboxed())
}
///|
pub fn recipe_analytics_light_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_sandboxed_policy())
}
///|
pub fn recipe_analytics_light_locked_forms() -> String {
"default-src 'self'; script-src 'self' https://analytics.example; connect-src 'self' https://analytics.example; img-src 'self' data: https://analytics.example; object-src 'none'; base-uri 'self'; form-action 'self'"
}
///|
pub fn recipe_analytics_light_locked_forms_policy() -> Policy {
parse(recipe_analytics_light_locked_forms())
}
///|
pub fn recipe_analytics_light_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_analytics_light_locked_forms_policy())
}
///|
pub fn recipe_media_gallery_core() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'"
}
///|
pub fn recipe_media_gallery_core_policy() -> Policy {
parse(recipe_media_gallery_core())
}
///|
pub fn recipe_media_gallery_core_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_core_policy())
}
///|
pub fn recipe_media_gallery_with_reports() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; report-to csp-endpoint"
}
///|
pub fn recipe_media_gallery_with_reports_policy() -> Policy {
parse(recipe_media_gallery_with_reports())
}
///|
pub fn recipe_media_gallery_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_reports_policy())
}
///|
pub fn recipe_media_gallery_with_upgrade() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; upgrade-insecure-requests"
}
///|
pub fn recipe_media_gallery_with_upgrade_policy() -> Policy {
parse(recipe_media_gallery_with_upgrade())
}
///|
pub fn recipe_media_gallery_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_upgrade_policy())
}
///|
pub fn recipe_media_gallery_with_trusted_types() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_media_gallery_with_trusted_types_policy() -> Policy {
parse(recipe_media_gallery_with_trusted_types())
}
///|
pub fn recipe_media_gallery_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_trusted_types_policy())
}
///|
pub fn recipe_media_gallery_with_prefetch() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; prefetch-src 'self'"
}
///|
pub fn recipe_media_gallery_with_prefetch_policy() -> Policy {
parse(recipe_media_gallery_with_prefetch())
}
///|
pub fn recipe_media_gallery_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_prefetch_policy())
}
///|
pub fn recipe_media_gallery_with_manifest() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; manifest-src 'self'"
}
///|
pub fn recipe_media_gallery_with_manifest_policy() -> Policy {
parse(recipe_media_gallery_with_manifest())
}
///|
pub fn recipe_media_gallery_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_manifest_policy())
}
///|
pub fn recipe_media_gallery_with_navigation() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; navigate-to 'self'"
}
///|
pub fn recipe_media_gallery_with_navigation_policy() -> Policy {
parse(recipe_media_gallery_with_navigation())
}
///|
pub fn recipe_media_gallery_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_navigation_policy())
}
///|
pub fn recipe_media_gallery_with_legacy_report() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_media_gallery_with_legacy_report_policy() -> Policy {
parse(recipe_media_gallery_with_legacy_report())
}
///|
pub fn recipe_media_gallery_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_with_legacy_report_policy())
}
///|
pub fn recipe_media_gallery_sandboxed() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_media_gallery_sandboxed_policy() -> Policy {
parse(recipe_media_gallery_sandboxed())
}
///|
pub fn recipe_media_gallery_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_sandboxed_policy())
}
///|
pub fn recipe_media_gallery_locked_forms() -> String {
"default-src 'self'; img-src 'self' https: data: blob:; media-src 'self' https: blob:; script-src 'self'; style-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'"
}
///|
pub fn recipe_media_gallery_locked_forms_policy() -> Policy {
parse(recipe_media_gallery_locked_forms())
}
///|
pub fn recipe_media_gallery_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_media_gallery_locked_forms_policy())
}
///|
pub fn recipe_payment_redirect_core() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'"
}
///|
pub fn recipe_payment_redirect_core_policy() -> Policy {
parse(recipe_payment_redirect_core())
}
///|
pub fn recipe_payment_redirect_core_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_core_policy())
}
///|
pub fn recipe_payment_redirect_with_reports() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; report-to csp-endpoint"
}
///|
pub fn recipe_payment_redirect_with_reports_policy() -> Policy {
parse(recipe_payment_redirect_with_reports())
}
///|
pub fn recipe_payment_redirect_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_reports_policy())
}
///|
pub fn recipe_payment_redirect_with_upgrade() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; upgrade-insecure-requests"
}
///|
pub fn recipe_payment_redirect_with_upgrade_policy() -> Policy {
parse(recipe_payment_redirect_with_upgrade())
}
///|
pub fn recipe_payment_redirect_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_upgrade_policy())
}
///|
pub fn recipe_payment_redirect_with_trusted_types() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_payment_redirect_with_trusted_types_policy() -> Policy {
parse(recipe_payment_redirect_with_trusted_types())
}
///|
pub fn recipe_payment_redirect_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_trusted_types_policy())
}
///|
pub fn recipe_payment_redirect_with_prefetch() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; prefetch-src 'self'"
}
///|
pub fn recipe_payment_redirect_with_prefetch_policy() -> Policy {
parse(recipe_payment_redirect_with_prefetch())
}
///|
pub fn recipe_payment_redirect_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_prefetch_policy())
}
///|
pub fn recipe_payment_redirect_with_manifest() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; manifest-src 'self'"
}
///|
pub fn recipe_payment_redirect_with_manifest_policy() -> Policy {
parse(recipe_payment_redirect_with_manifest())
}
///|
pub fn recipe_payment_redirect_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_manifest_policy())
}
///|
pub fn recipe_payment_redirect_with_navigation() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; navigate-to 'self'"
}
///|
pub fn recipe_payment_redirect_with_navigation_policy() -> Policy {
parse(recipe_payment_redirect_with_navigation())
}
///|
pub fn recipe_payment_redirect_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_navigation_policy())
}
///|
pub fn recipe_payment_redirect_with_legacy_report() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_payment_redirect_with_legacy_report_policy() -> Policy {
parse(recipe_payment_redirect_with_legacy_report())
}
///|
pub fn recipe_payment_redirect_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_with_legacy_report_policy())
}
///|
pub fn recipe_payment_redirect_sandboxed() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_payment_redirect_sandboxed_policy() -> Policy {
parse(recipe_payment_redirect_sandboxed())
}
///|
pub fn recipe_payment_redirect_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_sandboxed_policy())
}
///|
pub fn recipe_payment_redirect_locked_forms() -> String {
"default-src 'self'; script-src 'self' https://pay.example; frame-src https://pay.example; connect-src 'self' https://pay.example; form-action 'self' https://pay.example; object-src 'none'; base-uri 'self'; form-action 'self'"
}
///|
pub fn recipe_payment_redirect_locked_forms_policy() -> Policy {
parse(recipe_payment_redirect_locked_forms())
}
///|
pub fn recipe_payment_redirect_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_payment_redirect_locked_forms_policy())
}
///|
pub fn recipe_embed_widget_core() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'"
}
///|
pub fn recipe_embed_widget_core_policy() -> Policy {
parse(recipe_embed_widget_core())
}
///|
pub fn recipe_embed_widget_core_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_core_policy())
}
///|
pub fn recipe_embed_widget_with_reports() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; report-to csp-endpoint"
}
///|
pub fn recipe_embed_widget_with_reports_policy() -> Policy {
parse(recipe_embed_widget_with_reports())
}
///|
pub fn recipe_embed_widget_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_reports_policy())
}
///|
pub fn recipe_embed_widget_with_upgrade() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; upgrade-insecure-requests"
}
///|
pub fn recipe_embed_widget_with_upgrade_policy() -> Policy {
parse(recipe_embed_widget_with_upgrade())
}
///|
pub fn recipe_embed_widget_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_upgrade_policy())
}
///|
pub fn recipe_embed_widget_with_trusted_types() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_embed_widget_with_trusted_types_policy() -> Policy {
parse(recipe_embed_widget_with_trusted_types())
}
///|
pub fn recipe_embed_widget_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_trusted_types_policy())
}
///|
pub fn recipe_embed_widget_with_prefetch() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; prefetch-src 'self'"
}
///|
pub fn recipe_embed_widget_with_prefetch_policy() -> Policy {
parse(recipe_embed_widget_with_prefetch())
}
///|
pub fn recipe_embed_widget_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_prefetch_policy())
}
///|
pub fn recipe_embed_widget_with_manifest() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; manifest-src 'self'"
}
///|
pub fn recipe_embed_widget_with_manifest_policy() -> Policy {
parse(recipe_embed_widget_with_manifest())
}
///|
pub fn recipe_embed_widget_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_manifest_policy())
}
///|
pub fn recipe_embed_widget_with_navigation() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; navigate-to 'self'"
}
///|
pub fn recipe_embed_widget_with_navigation_policy() -> Policy {
parse(recipe_embed_widget_with_navigation())
}
///|
pub fn recipe_embed_widget_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_navigation_policy())
}
///|
pub fn recipe_embed_widget_with_legacy_report() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_embed_widget_with_legacy_report_policy() -> Policy {
parse(recipe_embed_widget_with_legacy_report())
}
///|
pub fn recipe_embed_widget_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_with_legacy_report_policy())
}
///|
pub fn recipe_embed_widget_sandboxed() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_embed_widget_sandboxed_policy() -> Policy {
parse(recipe_embed_widget_sandboxed())
}
///|
pub fn recipe_embed_widget_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_sandboxed_policy())
}
///|
pub fn recipe_embed_widget_locked_forms() -> String {
"default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors https://partner.example; object-src 'none'; base-uri 'self'; form-action 'self'"
}
///|
pub fn recipe_embed_widget_locked_forms_policy() -> Policy {
parse(recipe_embed_widget_locked_forms())
}
///|
pub fn recipe_embed_widget_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_embed_widget_locked_forms_policy())
}
///|
pub fn recipe_report_only_baseline_core() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'"
}
///|
pub fn recipe_report_only_baseline_core_policy() -> Policy {
parse(recipe_report_only_baseline_core())
}
///|
pub fn recipe_report_only_baseline_core_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_core_policy())
}
///|
pub fn recipe_report_only_baseline_with_reports() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; report-to csp-endpoint"
}
///|
pub fn recipe_report_only_baseline_with_reports_policy() -> Policy {
parse(recipe_report_only_baseline_with_reports())
}
///|
pub fn recipe_report_only_baseline_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_with_reports_policy())
}
///|
pub fn recipe_report_only_baseline_with_upgrade() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; upgrade-insecure-requests"
}
///|
pub fn recipe_report_only_baseline_with_upgrade_policy() -> Policy {
parse(recipe_report_only_baseline_with_upgrade())
}
///|
pub fn recipe_report_only_baseline_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_with_upgrade_policy())
}
///|
pub fn recipe_report_only_baseline_with_trusted_types() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_report_only_baseline_with_trusted_types_policy() -> Policy {
parse(recipe_report_only_baseline_with_trusted_types())
}
///|
pub fn recipe_report_only_baseline_with_trusted_types_findings() -> Array[
Finding,
] {
extended_audit(recipe_report_only_baseline_with_trusted_types_policy())
}
///|
pub fn recipe_report_only_baseline_with_prefetch() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; prefetch-src 'self'"
}
///|
pub fn recipe_report_only_baseline_with_prefetch_policy() -> Policy {
parse(recipe_report_only_baseline_with_prefetch())
}
///|
pub fn recipe_report_only_baseline_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_with_prefetch_policy())
}
///|
pub fn recipe_report_only_baseline_with_manifest() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; manifest-src 'self'"
}
///|
pub fn recipe_report_only_baseline_with_manifest_policy() -> Policy {
parse(recipe_report_only_baseline_with_manifest())
}
///|
pub fn recipe_report_only_baseline_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_with_manifest_policy())
}
///|
pub fn recipe_report_only_baseline_with_navigation() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; navigate-to 'self'"
}
///|
pub fn recipe_report_only_baseline_with_navigation_policy() -> Policy {
parse(recipe_report_only_baseline_with_navigation())
}
///|
pub fn recipe_report_only_baseline_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_with_navigation_policy())
}
///|
pub fn recipe_report_only_baseline_with_legacy_report() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_report_only_baseline_with_legacy_report_policy() -> Policy {
parse(recipe_report_only_baseline_with_legacy_report())
}
///|
pub fn recipe_report_only_baseline_with_legacy_report_findings() -> Array[
Finding,
] {
extended_audit(recipe_report_only_baseline_with_legacy_report_policy())
}
///|
pub fn recipe_report_only_baseline_sandboxed() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_report_only_baseline_sandboxed_policy() -> Policy {
parse(recipe_report_only_baseline_sandboxed())
}
///|
pub fn recipe_report_only_baseline_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_sandboxed_policy())
}
///|
pub fn recipe_report_only_baseline_locked_forms() -> String {
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; report-to csp-endpoint; object-src 'none'; form-action 'self'"
}
///|
pub fn recipe_report_only_baseline_locked_forms_policy() -> Policy {
parse(recipe_report_only_baseline_locked_forms())
}
///|
pub fn recipe_report_only_baseline_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_report_only_baseline_locked_forms_policy())
}
///|
pub fn recipe_strict_nonce_core() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'"
}
///|
pub fn recipe_strict_nonce_core_policy() -> Policy {
parse(recipe_strict_nonce_core())
}
///|
pub fn recipe_strict_nonce_core_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_core_policy())
}
///|
pub fn recipe_strict_nonce_with_reports() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; report-to csp-endpoint"
}
///|
pub fn recipe_strict_nonce_with_reports_policy() -> Policy {
parse(recipe_strict_nonce_with_reports())
}
///|
pub fn recipe_strict_nonce_with_reports_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_reports_policy())
}
///|
pub fn recipe_strict_nonce_with_upgrade() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; upgrade-insecure-requests"
}
///|
pub fn recipe_strict_nonce_with_upgrade_policy() -> Policy {
parse(recipe_strict_nonce_with_upgrade())
}
///|
pub fn recipe_strict_nonce_with_upgrade_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_upgrade_policy())
}
///|
pub fn recipe_strict_nonce_with_trusted_types() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; trusted-types default; require-trusted-types-for 'script'"
}
///|
pub fn recipe_strict_nonce_with_trusted_types_policy() -> Policy {
parse(recipe_strict_nonce_with_trusted_types())
}
///|
pub fn recipe_strict_nonce_with_trusted_types_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_trusted_types_policy())
}
///|
pub fn recipe_strict_nonce_with_prefetch() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; prefetch-src 'self'"
}
///|
pub fn recipe_strict_nonce_with_prefetch_policy() -> Policy {
parse(recipe_strict_nonce_with_prefetch())
}
///|
pub fn recipe_strict_nonce_with_prefetch_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_prefetch_policy())
}
///|
pub fn recipe_strict_nonce_with_manifest() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; manifest-src 'self'"
}
///|
pub fn recipe_strict_nonce_with_manifest_policy() -> Policy {
parse(recipe_strict_nonce_with_manifest())
}
///|
pub fn recipe_strict_nonce_with_manifest_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_manifest_policy())
}
///|
pub fn recipe_strict_nonce_with_navigation() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; navigate-to 'self'"
}
///|
pub fn recipe_strict_nonce_with_navigation_policy() -> Policy {
parse(recipe_strict_nonce_with_navigation())
}
///|
pub fn recipe_strict_nonce_with_navigation_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_navigation_policy())
}
///|
pub fn recipe_strict_nonce_with_legacy_report() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; report-uri https://reports.example/csp"
}
///|
pub fn recipe_strict_nonce_with_legacy_report_policy() -> Policy {
parse(recipe_strict_nonce_with_legacy_report())
}
///|
pub fn recipe_strict_nonce_with_legacy_report_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_with_legacy_report_policy())
}
///|
pub fn recipe_strict_nonce_sandboxed() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; sandbox allow-scripts allow-same-origin"
}
///|
pub fn recipe_strict_nonce_sandboxed_policy() -> Policy {
parse(recipe_strict_nonce_sandboxed())
}
///|
pub fn recipe_strict_nonce_sandboxed_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_sandboxed_policy())
}
///|
pub fn recipe_strict_nonce_locked_forms() -> String {
"default-src 'none'; script-src 'nonce-demo' 'strict-dynamic'; style-src 'nonce-demo'; img-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'"
}
///|
pub fn recipe_strict_nonce_locked_forms_policy() -> Policy {
parse(recipe_strict_nonce_locked_forms())
}
///|
pub fn recipe_strict_nonce_locked_forms_findings() -> Array[Finding] {
extended_audit(recipe_strict_nonce_locked_forms_policy())
}
///|
pub fn recipe_names() -> Array[String] {
let names : Array[String] = []
names.push("static_site_core")
names.push("static_site_with_reports")
names.push("static_site_with_upgrade")
names.push("static_site_with_trusted_types")
names.push("static_site_with_prefetch")
names.push("static_site_with_manifest")
names.push("static_site_with_navigation")
names.push("static_site_with_legacy_report")
names.push("static_site_sandboxed")
names.push("static_site_locked_forms")
names.push("docs_site_core")
names.push("docs_site_with_reports")
names.push("docs_site_with_upgrade")
names.push("docs_site_with_trusted_types")
names.push("docs_site_with_prefetch")
names.push("docs_site_with_manifest")
names.push("docs_site_with_navigation")
names.push("docs_site_with_legacy_report")
names.push("docs_site_sandboxed")
names.push("docs_site_locked_forms")
names.push("wasm_app_core")
names.push("wasm_app_with_reports")
names.push("wasm_app_with_upgrade")
names.push("wasm_app_with_trusted_types")
names.push("wasm_app_with_prefetch")
names.push("wasm_app_with_manifest")
names.push("wasm_app_with_navigation")
names.push("wasm_app_with_legacy_report")
names.push("wasm_app_sandboxed")
names.push("wasm_app_locked_forms")
names.push("admin_console_core")
names.push("admin_console_with_reports")
names.push("admin_console_with_upgrade")
names.push("admin_console_with_trusted_types")
names.push("admin_console_with_prefetch")
names.push("admin_console_with_manifest")
names.push("admin_console_with_navigation")
names.push("admin_console_with_legacy_report")
names.push("admin_console_sandboxed")
names.push("admin_console_locked_forms")
names.push("analytics_light_core")
names.push("analytics_light_with_reports")
names.push("analytics_light_with_upgrade")
names.push("analytics_light_with_trusted_types")
names.push("analytics_light_with_prefetch")
names.push("analytics_light_with_manifest")
names.push("analytics_light_with_navigation")
names.push("analytics_light_with_legacy_report")
names.push("analytics_light_sandboxed")
names.push("analytics_light_locked_forms")
names.push("media_gallery_core")
names.push("media_gallery_with_reports")
names.push("media_gallery_with_upgrade")
names.push("media_gallery_with_trusted_types")
names.push("media_gallery_with_prefetch")
names.push("media_gallery_with_manifest")
names.push("media_gallery_with_navigation")
names.push("media_gallery_with_legacy_report")
names.push("media_gallery_sandboxed")
names.push("media_gallery_locked_forms")
names.push("payment_redirect_core")
names.push("payment_redirect_with_reports")
names.push("payment_redirect_with_upgrade")
names.push("payment_redirect_with_trusted_types")
names.push("payment_redirect_with_prefetch")
names.push("payment_redirect_with_manifest")
names.push("payment_redirect_with_navigation")
names.push("payment_redirect_with_legacy_report")
names.push("payment_redirect_sandboxed")
names.push("payment_redirect_locked_forms")
names.push("embed_widget_core")
names.push("embed_widget_with_reports")
names.push("embed_widget_with_upgrade")
names.push("embed_widget_with_trusted_types")
names.push("embed_widget_with_prefetch")
names.push("embed_widget_with_manifest")
names.push("embed_widget_with_navigation")
names.push("embed_widget_with_legacy_report")
names.push("embed_widget_sandboxed")
names.push("embed_widget_locked_forms")
names.push("report_only_baseline_core")
names.push("report_only_baseline_with_reports")
names.push("report_only_baseline_with_upgrade")
names.push("report_only_baseline_with_trusted_types")
names.push("report_only_baseline_with_prefetch")
names.push("report_only_baseline_with_manifest")
names.push("report_only_baseline_with_navigation")
names.push("report_only_baseline_with_legacy_report")
names.push("report_only_baseline_sandboxed")
names.push("report_only_baseline_locked_forms")
names.push("strict_nonce_core")
names.push("strict_nonce_with_reports")
names.push("strict_nonce_with_upgrade")
names.push("strict_nonce_with_trusted_types")
names.push("strict_nonce_with_prefetch")
names.push("strict_nonce_with_manifest")
names.push("strict_nonce_with_navigation")
names.push("strict_nonce_with_legacy_report")
names.push("strict_nonce_sandboxed")
names.push("strict_nonce_locked_forms")
names
}
///|
pub fn recipe_count() -> Int {
100
}
///|
pub fn recipe_policy_by_name(name : String) -> Policy? {
let key = normalize_token(name)
if key == "static_site_core" {
return Some(recipe_static_site_core_policy())
}
if key == "static_site_with_reports" {
return Some(recipe_static_site_with_reports_policy())
}
if key == "static_site_with_upgrade" {
return Some(recipe_static_site_with_upgrade_policy())
}
if key == "static_site_with_trusted_types" {
return Some(recipe_static_site_with_trusted_types_policy())
}
if key == "static_site_with_prefetch" {
return Some(recipe_static_site_with_prefetch_policy())
}
if key == "static_site_with_manifest" {
return Some(recipe_static_site_with_manifest_policy())
}
if key == "static_site_with_navigation" {
return Some(recipe_static_site_with_navigation_policy())
}
if key == "static_site_with_legacy_report" {
return Some(recipe_static_site_with_legacy_report_policy())
}
if key == "static_site_sandboxed" {
return Some(recipe_static_site_sandboxed_policy())
}
if key == "static_site_locked_forms" {
return Some(recipe_static_site_locked_forms_policy())
}
if key == "docs_site_core" {
return Some(recipe_docs_site_core_policy())
}
if key == "docs_site_with_reports" {
return Some(recipe_docs_site_with_reports_policy())
}
if key == "docs_site_with_upgrade" {
return Some(recipe_docs_site_with_upgrade_policy())
}
if key == "docs_site_with_trusted_types" {
return Some(recipe_docs_site_with_trusted_types_policy())
}
if key == "docs_site_with_prefetch" {
return Some(recipe_docs_site_with_prefetch_policy())
}
if key == "docs_site_with_manifest" {
return Some(recipe_docs_site_with_manifest_policy())
}
if key == "docs_site_with_navigation" {
return Some(recipe_docs_site_with_navigation_policy())
}
if key == "docs_site_with_legacy_report" {
return Some(recipe_docs_site_with_legacy_report_policy())
}
if key == "docs_site_sandboxed" {
return Some(recipe_docs_site_sandboxed_policy())
}
if key == "docs_site_locked_forms" {
return Some(recipe_docs_site_locked_forms_policy())
}
if key == "wasm_app_core" {
return Some(recipe_wasm_app_core_policy())
}
if key == "wasm_app_with_reports" {
return Some(recipe_wasm_app_with_reports_policy())
}
if key == "wasm_app_with_upgrade" {
return Some(recipe_wasm_app_with_upgrade_policy())
}
if key == "wasm_app_with_trusted_types" {
return Some(recipe_wasm_app_with_trusted_types_policy())
}
if key == "wasm_app_with_prefetch" {
return Some(recipe_wasm_app_with_prefetch_policy())
}
if key == "wasm_app_with_manifest" {
return Some(recipe_wasm_app_with_manifest_policy())
}
if key == "wasm_app_with_navigation" {
return Some(recipe_wasm_app_with_navigation_policy())
}
if key == "wasm_app_with_legacy_report" {
return Some(recipe_wasm_app_with_legacy_report_policy())
}
if key == "wasm_app_sandboxed" {
return Some(recipe_wasm_app_sandboxed_policy())
}
if key == "wasm_app_locked_forms" {
return Some(recipe_wasm_app_locked_forms_policy())
}
if key == "admin_console_core" {
return Some(recipe_admin_console_core_policy())
}
if key == "admin_console_with_reports" {
return Some(recipe_admin_console_with_reports_policy())
}
if key == "admin_console_with_upgrade" {
return Some(recipe_admin_console_with_upgrade_policy())
}
if key == "admin_console_with_trusted_types" {
return Some(recipe_admin_console_with_trusted_types_policy())
}
if key == "admin_console_with_prefetch" {
return Some(recipe_admin_console_with_prefetch_policy())
}
if key == "admin_console_with_manifest" {
return Some(recipe_admin_console_with_manifest_policy())
}
if key == "admin_console_with_navigation" {
return Some(recipe_admin_console_with_navigation_policy())
}
if key == "admin_console_with_legacy_report" {
return Some(recipe_admin_console_with_legacy_report_policy())
}
if key == "admin_console_sandboxed" {
return Some(recipe_admin_console_sandboxed_policy())
}
if key == "admin_console_locked_forms" {
return Some(recipe_admin_console_locked_forms_policy())
}
if key == "analytics_light_core" {
return Some(recipe_analytics_light_core_policy())
}
if key == "analytics_light_with_reports" {
return Some(recipe_analytics_light_with_reports_policy())
}
if key == "analytics_light_with_upgrade" {
return Some(recipe_analytics_light_with_upgrade_policy())
}
if key == "analytics_light_with_trusted_types" {
return Some(recipe_analytics_light_with_trusted_types_policy())
}
if key == "analytics_light_with_prefetch" {
return Some(recipe_analytics_light_with_prefetch_policy())
}
if key == "analytics_light_with_manifest" {
return Some(recipe_analytics_light_with_manifest_policy())
}
if key == "analytics_light_with_navigation" {
return Some(recipe_analytics_light_with_navigation_policy())
}
if key == "analytics_light_with_legacy_report" {
return Some(recipe_analytics_light_with_legacy_report_policy())
}
if key == "analytics_light_sandboxed" {
return Some(recipe_analytics_light_sandboxed_policy())
}
if key == "analytics_light_locked_forms" {
return Some(recipe_analytics_light_locked_forms_policy())
}
if key == "media_gallery_core" {
return Some(recipe_media_gallery_core_policy())
}
if key == "media_gallery_with_reports" {
return Some(recipe_media_gallery_with_reports_policy())
}
if key == "media_gallery_with_upgrade" {
return Some(recipe_media_gallery_with_upgrade_policy())
}
if key == "media_gallery_with_trusted_types" {
return Some(recipe_media_gallery_with_trusted_types_policy())
}
if key == "media_gallery_with_prefetch" {
return Some(recipe_media_gallery_with_prefetch_policy())
}
if key == "media_gallery_with_manifest" {
return Some(recipe_media_gallery_with_manifest_policy())
}
if key == "media_gallery_with_navigation" {
return Some(recipe_media_gallery_with_navigation_policy())
}
if key == "media_gallery_with_legacy_report" {
return Some(recipe_media_gallery_with_legacy_report_policy())
}
if key == "media_gallery_sandboxed" {
return Some(recipe_media_gallery_sandboxed_policy())
}
if key == "media_gallery_locked_forms" {
return Some(recipe_media_gallery_locked_forms_policy())
}
if key == "payment_redirect_core" {
return Some(recipe_payment_redirect_core_policy())
}
if key == "payment_redirect_with_reports" {
return Some(recipe_payment_redirect_with_reports_policy())
}
if key == "payment_redirect_with_upgrade" {
return Some(recipe_payment_redirect_with_upgrade_policy())
}
if key == "payment_redirect_with_trusted_types" {
return Some(recipe_payment_redirect_with_trusted_types_policy())
}
if key == "payment_redirect_with_prefetch" {
return Some(recipe_payment_redirect_with_prefetch_policy())
}
if key == "payment_redirect_with_manifest" {
return Some(recipe_payment_redirect_with_manifest_policy())
}
if key == "payment_redirect_with_navigation" {
return Some(recipe_payment_redirect_with_navigation_policy())
}
if key == "payment_redirect_with_legacy_report" {
return Some(recipe_payment_redirect_with_legacy_report_policy())
}
if key == "payment_redirect_sandboxed" {
return Some(recipe_payment_redirect_sandboxed_policy())
}
if key == "payment_redirect_locked_forms" {
return Some(recipe_payment_redirect_locked_forms_policy())
}
if key == "embed_widget_core" {
return Some(recipe_embed_widget_core_policy())
}
if key == "embed_widget_with_reports" {
return Some(recipe_embed_widget_with_reports_policy())
}
if key == "embed_widget_with_upgrade" {
return Some(recipe_embed_widget_with_upgrade_policy())
}
if key == "embed_widget_with_trusted_types" {
return Some(recipe_embed_widget_with_trusted_types_policy())
}
if key == "embed_widget_with_prefetch" {
return Some(recipe_embed_widget_with_prefetch_policy())
}
if key == "embed_widget_with_manifest" {
return Some(recipe_embed_widget_with_manifest_policy())
}
if key == "embed_widget_with_navigation" {
return Some(recipe_embed_widget_with_navigation_policy())
}
if key == "embed_widget_with_legacy_report" {
return Some(recipe_embed_widget_with_legacy_report_policy())
}
if key == "embed_widget_sandboxed" {
return Some(recipe_embed_widget_sandboxed_policy())
}
if key == "embed_widget_locked_forms" {
return Some(recipe_embed_widget_locked_forms_policy())
}
if key == "report_only_baseline_core" {
return Some(recipe_report_only_baseline_core_policy())
}
if key == "report_only_baseline_with_reports" {
return Some(recipe_report_only_baseline_with_reports_policy())
}
if key == "report_only_baseline_with_upgrade" {
return Some(recipe_report_only_baseline_with_upgrade_policy())
}
if key == "report_only_baseline_with_trusted_types" {
return Some(recipe_report_only_baseline_with_trusted_types_policy())
}
if key == "report_only_baseline_with_prefetch" {
return Some(recipe_report_only_baseline_with_prefetch_policy())
}
if key == "report_only_baseline_with_manifest" {
return Some(recipe_report_only_baseline_with_manifest_policy())
}
if key == "report_only_baseline_with_navigation" {
return Some(recipe_report_only_baseline_with_navigation_policy())
}
if key == "report_only_baseline_with_legacy_report" {
return Some(recipe_report_only_baseline_with_legacy_report_policy())
}
if key == "report_only_baseline_sandboxed" {
return Some(recipe_report_only_baseline_sandboxed_policy())
}
if key == "report_only_baseline_locked_forms" {
return Some(recipe_report_only_baseline_locked_forms_policy())
}
if key == "strict_nonce_core" {
return Some(recipe_strict_nonce_core_policy())
}
if key == "strict_nonce_with_reports" {
return Some(recipe_strict_nonce_with_reports_policy())
}
if key == "strict_nonce_with_upgrade" {
return Some(recipe_strict_nonce_with_upgrade_policy())
}
if key == "strict_nonce_with_trusted_types" {
return Some(recipe_strict_nonce_with_trusted_types_policy())
}
if key == "strict_nonce_with_prefetch" {
return Some(recipe_strict_nonce_with_prefetch_policy())
}
if key == "strict_nonce_with_manifest" {
return Some(recipe_strict_nonce_with_manifest_policy())
}
if key == "strict_nonce_with_navigation" {
return Some(recipe_strict_nonce_with_navigation_policy())
}
if key == "strict_nonce_with_legacy_report" {
return Some(recipe_strict_nonce_with_legacy_report_policy())
}
if key == "strict_nonce_sandboxed" {
return Some(recipe_strict_nonce_sandboxed_policy())
}
if key == "strict_nonce_locked_forms" {
return Some(recipe_strict_nonce_locked_forms_policy())
}
None
}
///|
pub fn recipe_audit_by_name(name : String) -> Array[Finding] {
match recipe_policy_by_name(name) {
Some(policy) => extended_audit(policy)
None => {
let findings : Array[Finding] = []
findings.push(
make_finding(
Error,
"unknown-recipe",
name,
"recipe name is not defined",
0,
),
)
findings
}
}
}