Skip to content

Commit b6827a0

Browse files
committed
fix: allow inline scripts in CSP for Starlight functionality
The IC asset canister's "standard" security policy sets script-src 'self' which blocks Starlight's inline scripts for mobile menu, theme toggle, search, and sidebar state. Replace with explicit CSP headers that include 'unsafe-inline' while keeping other security protections.
1 parent 5739d84 commit b6827a0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

public/.ic-assets.json5

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
[
22
{
3-
// Default: no raw access, standard security headers, no caching
3+
// Default: no raw access, no caching
44
"match": "**/*",
5-
"security_policy": "standard",
65
"allow_raw_access": false,
76
"headers": {
8-
"Cache-Control": "public, max-age=0, must-revalidate"
7+
"Cache-Control": "public, max-age=0, must-revalidate",
8+
// Starlight uses inline <script> tags for theme toggle, mobile menu,
9+
// sidebar state, and search. 'unsafe-inline' is required for these.
10+
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' https://icp0.io https://*.icp0.io; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; upgrade-insecure-requests",
11+
"X-Content-Type-Options": "nosniff",
12+
"Referrer-Policy": "strict-origin-when-cross-origin",
13+
"Permissions-Policy": "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()"
914
}
1015
},
1116
{

0 commit comments

Comments
 (0)