# FRAPE browser agent 0.6.1: security headers for the pages that load it (checkout, login, sign-up).
# Built from the signed manifest https://frape.io/agent/manifest.json. Guide: https://frape.io/developers/agent-integrity/
#
# script-src allows two exact agent URLs and no other FRAPE path. Load one of them:
# Default (always the current version, updates arrive without a change on your side):
#
# Fixed version with integrity (recommended for payment pages that must authorise every script change):
#
# Using only one of them? You can remove the other URL from script-src.
# This policy allows no inline script: keep the init code in your own script file ('self') or add a nonce.
# Already send a CSP? Add the agent URL to your existing script-src instead of sending a second policy.
#
# connect-src: from agent 0.5.0 the agent sends one request without cookies to collect.frape.io for its
# connection check (collectUrl sets your own host, collectUrl: false turns it off). If your policy restricts
# connect-src, allow that host. Agent 0.4 and older make no HTTP requests of their own.
# connect-src does not govern the WebRTC STUN traffic of the network check; stunUrls: [] turns that check off.
#
# Rollout: step 1 sends Content-Security-Policy-Report-Only and changes nothing for visitors. Read the reports
# for a week or two, then step 2 switches to the enforcing Content-Security-Policy header.
# Replace https://merchant.example/csp-reports with your own report collector, and /checkout/ with your payment page paths.
# With the fixed version: when you move to a new agent version, update the URL and the integrity value together.
location /checkout/ {
add_header Reporting-Endpoints 'csp-endpoint="https://merchant.example/csp-reports"' always;
# Step 1: report only.
add_header Content-Security-Policy-Report-Only "script-src 'self' https://frape.io/agent/frape-agent.js https://frape.io/agent/frape-agent-0.6.1.js; report-to csp-endpoint; report-uri https://merchant.example/csp-reports" always;
# Step 2: enforce (replace the line above).
# add_header Content-Security-Policy "script-src 'self' https://frape.io/agent/frape-agent.js https://frape.io/agent/frape-agent-0.6.1.js; report-to csp-endpoint; report-uri https://merchant.example/csp-reports" always;
}