-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/comprehensive updates and fixes #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,12 @@ | |
| "test:local:security": "./scripts/test-ci-local.sh security", | ||
| "test:local:build": "./scripts/test-ci-local.sh build", | ||
| "test:local:vercel": "./scripts/test-ci-local.sh vercel", | ||
| "vercel:setup": "./scripts/setup-vercel-config.sh" | ||
| "vercel:setup": "./scripts/setup-vercel-config.sh", | ||
| "lighthouse": "lhci autorun", | ||
| "lighthouse:local": "lhci autorun --config=lighthouserc.js", | ||
| "lighthouse:install": "npm install -g @lhci/cli@0.12.x", | ||
| "lighthouse:test": "./scripts/lighthouse-test.sh local", | ||
| "lighthouse:custom": "./scripts/lighthouse-test.sh custom" | ||
|
Comment on lines
+34
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify referenced configs/scripts exist and are executable. Ensure lighthouserc.js and scripts/lighthouse-test.sh are present and runnable. 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Checking Lighthouse config/script presence"
fd -H -a -t f '^lighthouserc\.js$' || true
fd -H -a -t f '^lighthouse-test\.sh$' scripts || true
echo "Check executable bit on scripts/lighthouse-test.sh (if found)"
[ -f scripts/lighthouse-test.sh ] && ls -l scripts/lighthouse-test.sh || echo "scripts/lighthouse-test.sh not found"Length of output: 176 Add missing scripts/lighthouse-test.sh or update package.json
🤖 Prompt for AI Agents |
||
| }, | ||
| "dependencies": { | ||
| "@google/generative-ai": "^0.24.1", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -73,7 +73,7 @@ | |||||
| }, | ||||||
| { | ||||||
| "key": "Content-Security-Policy", | ||||||
| "value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://va.vercel-scripts.com https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https: blob:; connect-src 'self' https://*.supabase.co https://*.vercel.app wss://*.supabase.co; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;" | ||||||
| "value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://va.vercel-scripts.com https://static.cloudflareinsights.com https://checkout.razorpay.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https: blob:; connect-src 'self' https://*.supabase.co https://*.vercel.app wss://*.supabase.co https://api.razorpay.com; frame-src 'self' https://checkout.razorpay.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;" | ||||||
|
Comment on lines
75
to
+76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAvoid sending two CSP headers (static + dynamic). You also set CSP dynamically in lib/security/csp-config.ts. Two CSP headers combine as an intersection and can cause brittle breakages (and make nonces ineffective if one policy disallows them). Prefer one source of truth. Apply this diff to remove the static CSP header here and rely on the dynamic CSP: {
- "key": "Content-Security-Policy",
- "value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://va.vercel-scripts.com https://static.cloudflareinsights.com https://checkout.razorpay.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https: blob:; connect-src 'self' https://*.supabase.co https://*.vercel.app wss://*.supabase.co https://api.razorpay.com; frame-src 'self' https://checkout.razorpay.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;"
+ // removed: CSP is set dynamically with nonce in lib/security/csp-config.ts
}Run to confirm there’s no duplicate CSP setter left: 🏁 Script executed: #!/bin/bash
rg -n "Content-Security-Policy" -C2
rg -n "applyCSPHeaders|getCSPConfig" -C2Length of output: 5040 Remove static Content-Security-Policy header from vercel.json — rely on dynamic per-request CSP vercel.json currently defines a static CSP (vercel.json:75–76); the app also sets CSP per-request in lib/security/csp-config.ts (applyCSPHeaders → response.headers.set at line 70) and in lib/security/api-wrapper.ts (response.headers.set at ~lines 33, 49, 94, 124). Two CSP headers combine by intersection and can break nonces — remove the static header from vercel.json. 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Tighten production CSP: drop 'unsafe-eval' (and ideally 'unsafe-inline') when feasible. Keeping 'unsafe-eval' (and 'unsafe-inline') in production weakens CSP substantially. Since you already generate nonces, prefer nonce/hashes over 'unsafe-inline', and remove 'unsafe-eval' if not strictly required. Proposed minimal change now (drop only unsafe-eval): -"value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://va.vercel-scripts.com https://static.cloudflareinsights.com https://checkout.razorpay.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https: blob:; connect-src 'self' https://*.supabase.co https://*.vercel.app wss://*.supabase.co https://api.razorpay.com; frame-src 'self' https://checkout.razorpay.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;"
+"value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://vercel.live https://va.vercel-scripts.com https://static.cloudflareinsights.com https://checkout.razorpay.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https: blob:; connect-src 'self' https://*.supabase.co https://*.vercel.app wss://*.supabase.co https://api.razorpay.com; frame-src 'self' https://checkout.razorpay.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;"If you can, also drop 'unsafe-inline' once all inline scripts/styles are nonced/hashed. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents💡 Verification agent 🧩 Analysis chainConfirm if additional Razorpay subdomains are needed. Some integrations use extra hosts (e.g., logging/CDN). If Checkout loads assets from other razorpay domains, you’ll need to whitelist them in script-src/connect-src/frame-src. 🌐 Web query: 💡 Result: Short answer — allow these Razorpay hosts:
Notes: include the exact https:// scheme (and wss:// variant if you observe websocket errors) and add any merchant-specific CDN hostnames you use. Sources: Razorpay integration docs and Razorpay payment-button/iframe implementation notes. [1][2][3] Add Razorpay CDN domains to the CSP vercel.json (CSP value at line ~76): whitelist these Razorpay hosts—
🤖 Prompt for AI Agents |
||||||
| } | ||||||
| ] | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Razorpay connect/frame allowances — OK, but consider eval removal.
Allowing https://api.razorpay.com (connect) and https://checkout.razorpay.com (frame) matches Checkout needs. Also consider dropping 'unsafe-eval' from script-src in production.
Apply this diff to remove 'unsafe-eval' here:
If feasible later, also remove 'unsafe-inline' once all inline uses are nonced.
🤖 Prompt for AI Agents