praxis-sec 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -0
  3. package/ai-defense/cost-protection.md +292 -0
  4. package/ai-defense/llm-security-checklist.md +324 -0
  5. package/ai-defense/prompt-injection-patterns.js +283 -0
  6. package/ai-defense/system-prompt-armor.md +327 -0
  7. package/checklists/launch-day.md +168 -0
  8. package/cli/agents/abom-generator.js +225 -0
  9. package/cli/agents/agent-attestation-agent.js +318 -0
  10. package/cli/agents/agent-config-scanner.js +787 -0
  11. package/cli/agents/agent-telemetry-agent.js +415 -0
  12. package/cli/agents/agentic-security-agent.js +296 -0
  13. package/cli/agents/agentic-supply-chain-agent.js +463 -0
  14. package/cli/agents/ai-infra-inventory-agent.js +449 -0
  15. package/cli/agents/api-fuzzer.js +345 -0
  16. package/cli/agents/auth-bypass-agent.js +348 -0
  17. package/cli/agents/base-agent.js +280 -0
  18. package/cli/agents/cicd-scanner.js +300 -0
  19. package/cli/agents/config-auditor.js +757 -0
  20. package/cli/agents/deep-analyzer.js +776 -0
  21. package/cli/agents/endpoint-agent-abuse-agent.js +404 -0
  22. package/cli/agents/exception-handler-agent.js +187 -0
  23. package/cli/agents/git-history-scanner.js +169 -0
  24. package/cli/agents/governance-audits.js +138 -0
  25. package/cli/agents/hermes-security-agent.js +536 -0
  26. package/cli/agents/html-reporter.js +1125 -0
  27. package/cli/agents/index.js +147 -0
  28. package/cli/agents/injection-tester.js +502 -0
  29. package/cli/agents/legal-risk-agent.js +328 -0
  30. package/cli/agents/llm-redteam.js +199 -0
  31. package/cli/agents/managed-agent-scanner.js +333 -0
  32. package/cli/agents/mcp-security-agent.js +588 -0
  33. package/cli/agents/memory-poisoning-agent.js +305 -0
  34. package/cli/agents/mobile-scanner.js +231 -0
  35. package/cli/agents/model-file-scanner.js +259 -0
  36. package/cli/agents/orchestrator.js +355 -0
  37. package/cli/agents/pii-compliance-agent.js +301 -0
  38. package/cli/agents/policy-engine.js +229 -0
  39. package/cli/agents/prompt-injection-prober.js +224 -0
  40. package/cli/agents/rag-security-agent.js +204 -0
  41. package/cli/agents/recon-agent.js +207 -0
  42. package/cli/agents/sbom-generator.js +265 -0
  43. package/cli/agents/scoring-engine.js +273 -0
  44. package/cli/agents/ssrf-prober.js +130 -0
  45. package/cli/agents/stateful-watcher.js +238 -0
  46. package/cli/agents/supabase-rls-agent.js +154 -0
  47. package/cli/agents/supply-chain-agent.js +857 -0
  48. package/cli/agents/swarm-orchestrator.js +200 -0
  49. package/cli/agents/verifier-agent.js +303 -0
  50. package/cli/agents/vibe-coding-agent.js +250 -0
  51. package/cli/bin/praxis.js +866 -0
  52. package/cli/commands/abom.js +73 -0
  53. package/cli/commands/agent-fix.js +1245 -0
  54. package/cli/commands/audit.js +1180 -0
  55. package/cli/commands/autofix.js +383 -0
  56. package/cli/commands/baseline.js +193 -0
  57. package/cli/commands/benchmark.js +327 -0
  58. package/cli/commands/checklist.js +223 -0
  59. package/cli/commands/ci.js +403 -0
  60. package/cli/commands/deps.js +516 -0
  61. package/cli/commands/diff.js +200 -0
  62. package/cli/commands/doctor.js +195 -0
  63. package/cli/commands/env-audit.js +349 -0
  64. package/cli/commands/fix.js +218 -0
  65. package/cli/commands/guard.js +396 -0
  66. package/cli/commands/hooks.js +278 -0
  67. package/cli/commands/init.js +514 -0
  68. package/cli/commands/legal.js +158 -0
  69. package/cli/commands/live-advisories.js +241 -0
  70. package/cli/commands/mcp.js +660 -0
  71. package/cli/commands/openclaw.js +386 -0
  72. package/cli/commands/red-team.js +350 -0
  73. package/cli/commands/redteam.js +78 -0
  74. package/cli/commands/remediate.js +797 -0
  75. package/cli/commands/rotate.js +768 -0
  76. package/cli/commands/rules.js +196 -0
  77. package/cli/commands/scan-mcp.js +534 -0
  78. package/cli/commands/scan-skill.js +588 -0
  79. package/cli/commands/scan-standard.js +251 -0
  80. package/cli/commands/scan.js +524 -0
  81. package/cli/commands/score.js +449 -0
  82. package/cli/commands/shell.js +514 -0
  83. package/cli/commands/team-report.js +398 -0
  84. package/cli/commands/undo.js +161 -0
  85. package/cli/commands/update-intel.js +126 -0
  86. package/cli/commands/vibe-check.js +276 -0
  87. package/cli/commands/watch.js +757 -0
  88. package/cli/commands/web.js +63 -0
  89. package/cli/core/ast/guardrail-detector.js +141 -0
  90. package/cli/core/ast/index.js +22 -0
  91. package/cli/core/ast/parser.js +676 -0
  92. package/cli/core/ast/scope-tree.js +287 -0
  93. package/cli/core/ast/taint-tracker.js +158 -0
  94. package/cli/core/branding.js +37 -0
  95. package/cli/core/env.js +38 -0
  96. package/cli/core/errors.js +61 -0
  97. package/cli/core/fs.js +62 -0
  98. package/cli/core/output/compliance.js +90 -0
  99. package/cli/core/output/html-theme.js +158 -0
  100. package/cli/core/output/index.js +57 -0
  101. package/cli/core/output/json.js +48 -0
  102. package/cli/core/output/sarif.js +240 -0
  103. package/cli/core/version.js +67 -0
  104. package/cli/core/web/jobs.js +183 -0
  105. package/cli/core/web/projects.js +146 -0
  106. package/cli/core/web/server.js +439 -0
  107. package/cli/data/atlas-knowledge.json +5640 -0
  108. package/cli/data/eaa-catalog.json +39 -0
  109. package/cli/data/known-mcps.json +26 -0
  110. package/cli/data/probes/prompt-injection-corpus.json +271 -0
  111. package/cli/data/threat-intel.json +85 -0
  112. package/cli/data/threatpacks/latest.json +41 -0
  113. package/cli/hooks/patterns.js +313 -0
  114. package/cli/hooks/post-tool-use.js +140 -0
  115. package/cli/hooks/pre-tool-use.js +186 -0
  116. package/cli/index.js +90 -0
  117. package/cli/providers/llm-provider.js +766 -0
  118. package/cli/utils/autofix-rules.js +74 -0
  119. package/cli/utils/cache-manager.js +310 -0
  120. package/cli/utils/compliance-map.js +191 -0
  121. package/cli/utils/entropy.js +132 -0
  122. package/cli/utils/fix-ledger.js +127 -0
  123. package/cli/utils/hermes-tool-registry.js +252 -0
  124. package/cli/utils/intel/cache.js +61 -0
  125. package/cli/utils/intel/http.js +88 -0
  126. package/cli/utils/intel/index.js +235 -0
  127. package/cli/utils/intel/merge.js +229 -0
  128. package/cli/utils/intel/sources/epss.js +54 -0
  129. package/cli/utils/intel/sources/ghsa.js +81 -0
  130. package/cli/utils/intel/sources/gitguardian.js +40 -0
  131. package/cli/utils/intel/sources/gitleaks.js +101 -0
  132. package/cli/utils/intel/sources/kev.js +38 -0
  133. package/cli/utils/intel/sources/nvd.js +84 -0
  134. package/cli/utils/intel/sources/osv.js +132 -0
  135. package/cli/utils/intel/sources/phylum.js +44 -0
  136. package/cli/utils/intel/sources/snyk.js +46 -0
  137. package/cli/utils/intel/sources/socket.js +69 -0
  138. package/cli/utils/intel/sources/sonatype.js +84 -0
  139. package/cli/utils/intel/sources/threatpack.js +69 -0
  140. package/cli/utils/mcp-trust.js +60 -0
  141. package/cli/utils/output.js +251 -0
  142. package/cli/utils/patterns.js +1130 -0
  143. package/cli/utils/pdf-generator.js +94 -0
  144. package/cli/utils/plugin-loader.js +364 -0
  145. package/cli/utils/rule-import.js +228 -0
  146. package/cli/utils/rule-registry.js +426 -0
  147. package/cli/utils/scan-fingerprint.js +109 -0
  148. package/cli/utils/scan-playbook.js +312 -0
  149. package/cli/utils/score-history.js +119 -0
  150. package/cli/utils/secrets-verifier.js +247 -0
  151. package/cli/utils/security-memory.js +296 -0
  152. package/cli/utils/standards/atlas-knowledge.js +87 -0
  153. package/cli/utils/standards/index.js +127 -0
  154. package/cli/utils/standards/sources/avid.js +45 -0
  155. package/cli/utils/standards/sources/eu-ai-act.js +89 -0
  156. package/cli/utils/standards/sources/google-saif.js +39 -0
  157. package/cli/utils/standards/sources/iso-42001.js +94 -0
  158. package/cli/utils/standards/sources/mitre-atlas.js +54 -0
  159. package/cli/utils/standards/sources/nist-ai-600-1.js +45 -0
  160. package/cli/utils/standards/sources/owasp-llm.js +45 -0
  161. package/cli/utils/standards/sources/owasp-ml.js +45 -0
  162. package/cli/utils/threat-intel.js +265 -0
  163. package/configs/firebase/firestore-rules.txt +215 -0
  164. package/configs/firebase/security-checklist.md +236 -0
  165. package/configs/firebase/storage-rules.txt +206 -0
  166. package/configs/gitignore-template +258 -0
  167. package/configs/nextjs-security-headers.js +220 -0
  168. package/configs/praxisignore-template +50 -0
  169. package/configs/supabase/secure-client.ts +225 -0
  170. package/configs/supabase/security-checklist.md +278 -0
  171. package/docs/THIRD_PARTY_NOTICES.md +26 -0
  172. package/docs/THREAT_INTEL.md +292 -0
  173. package/docs/USAGE.md +1205 -0
  174. package/docs/design/WEB-UI.md +82 -0
  175. package/package.json +71 -0
  176. package/scripts/check-determinism.mjs +119 -0
  177. package/snippets/README.md +122 -0
  178. package/snippets/api-security/api-security-checklist.md +412 -0
  179. package/snippets/api-security/cors-config.ts +322 -0
  180. package/snippets/api-security/input-validation.ts +430 -0
  181. package/snippets/auth/jwt-checklist.md +322 -0
  182. package/snippets/rate-limiting/nextjs-middleware.ts +211 -0
  183. package/snippets/rate-limiting/upstash-ratelimit.ts +229 -0
@@ -0,0 +1,258 @@
1
+ # =============================================================================
2
+ # PRAXIS .GITIGNORE
3
+ # =============================================================================
4
+ # This file prevents you from accidentally committing sensitive data.
5
+ # Copy this to your project root. Customize as needed.
6
+ # =============================================================================
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # ENVIRONMENT FILES - THE #1 SOURCE OF LEAKED SECRETS
10
+ # -----------------------------------------------------------------------------
11
+ # These files often contain API keys, database URLs, and passwords.
12
+ # NEVER commit these. Use .env.example with placeholder values instead.
13
+
14
+ .env
15
+ .env.local
16
+ .env.development
17
+ .env.development.local
18
+ .env.test
19
+ .env.test.local
20
+ .env.production
21
+ .env.production.local
22
+ .env.staging
23
+ .env*.local
24
+
25
+ # Some frameworks use different names
26
+ .envrc
27
+ .env.backup
28
+ .env.bak
29
+ *.env
30
+
31
+ # -----------------------------------------------------------------------------
32
+ # PRIVATE KEYS & CERTIFICATES
33
+ # -----------------------------------------------------------------------------
34
+ # These are cryptographic secrets. If leaked, attackers can impersonate you.
35
+
36
+ *.pem
37
+ *.key
38
+ *.p12
39
+ *.pfx
40
+ *.crt
41
+ *.cer
42
+ *.der
43
+ *.csr
44
+
45
+ # SSH keys - NEVER commit these
46
+ id_rsa
47
+ id_rsa.pub
48
+ id_ed25519
49
+ id_ed25519.pub
50
+ id_dsa
51
+ id_dsa.pub
52
+ *.ppk
53
+
54
+ # GPG keys
55
+ *.gpg
56
+ *.asc
57
+ secring.*
58
+
59
+ # -----------------------------------------------------------------------------
60
+ # API KEYS & CREDENTIALS FILES
61
+ # -----------------------------------------------------------------------------
62
+ # Various tools store credentials in these files
63
+
64
+ # Google Cloud / Firebase
65
+ **/service-account*.json
66
+ *-firebase-adminsdk-*.json
67
+ credentials.json
68
+ client_secret*.json
69
+
70
+ # AWS
71
+ .aws/credentials
72
+ aws-credentials.json
73
+ *.aws
74
+
75
+ # Stripe
76
+ stripe-cli-config.toml
77
+
78
+ # Generic credential files
79
+ *credentials*
80
+ *secrets*
81
+ *.secrets.json
82
+ config/secrets.yml
83
+ secrets.yml
84
+ secrets.yaml
85
+
86
+ # Exception: Allow our security scanning scripts
87
+ !scripts/
88
+ !scripts/*
89
+
90
+ # -----------------------------------------------------------------------------
91
+ # DATABASE FILES
92
+ # -----------------------------------------------------------------------------
93
+ # Local databases may contain user data or test credentials
94
+
95
+ *.sqlite
96
+ *.sqlite3
97
+ *.db
98
+ *.sql
99
+ dump.rdb
100
+
101
+ # -----------------------------------------------------------------------------
102
+ # LOGS - MAY CONTAIN SENSITIVE DATA
103
+ # -----------------------------------------------------------------------------
104
+ # Logs can accidentally contain API responses, user data, or errors with secrets
105
+
106
+ *.log
107
+ logs/
108
+ npm-debug.log*
109
+ yarn-debug.log*
110
+ yarn-error.log*
111
+ pnpm-debug.log*
112
+ lerna-debug.log*
113
+
114
+ # -----------------------------------------------------------------------------
115
+ # OS FILES - NOT SENSITIVE BUT ANNOYING
116
+ # -----------------------------------------------------------------------------
117
+
118
+ # macOS
119
+ .DS_Store
120
+ .DS_Store?
121
+ ._*
122
+ .Spotlight-V100
123
+ .Trashes
124
+ .AppleDouble
125
+ .LSOverride
126
+
127
+ # Windows
128
+ Thumbs.db
129
+ Thumbs.db:encryptable
130
+ ehthumbs.db
131
+ ehthumbs_vista.db
132
+ *.stackdump
133
+ [Dd]esktop.ini
134
+ $RECYCLE.BIN/
135
+ *.cab
136
+ *.msi
137
+ *.msix
138
+ *.msm
139
+ *.msp
140
+ *.lnk
141
+
142
+ # Linux
143
+ *~
144
+ .fuse_hidden*
145
+ .directory
146
+ .Trash-*
147
+ .nfs*
148
+
149
+ # -----------------------------------------------------------------------------
150
+ # IDE & EDITOR FILES
151
+ # -----------------------------------------------------------------------------
152
+ # May contain local paths or workspace settings with secrets
153
+
154
+ .idea/
155
+ .vscode/
156
+ *.swp
157
+ *.swo
158
+ *.swn
159
+ *.sublime-workspace
160
+ *.sublime-project
161
+ .project
162
+ .classpath
163
+ .settings/
164
+ *.code-workspace
165
+
166
+ # -----------------------------------------------------------------------------
167
+ # DEPENDENCY DIRECTORIES
168
+ # -----------------------------------------------------------------------------
169
+ # These are large and should be installed fresh via package manager
170
+
171
+ node_modules/
172
+ vendor/
173
+ .bundle/
174
+ bower_components/
175
+ jspm_packages/
176
+
177
+ # Python
178
+ __pycache__/
179
+ *.py[cod]
180
+ *$py.class
181
+ .Python
182
+ venv/
183
+ env/
184
+ ENV/
185
+ .venv/
186
+ pip-log.txt
187
+ pip-delete-this-directory.txt
188
+
189
+ # -----------------------------------------------------------------------------
190
+ # BUILD OUTPUT - MAY CONTAIN INLINED SECRETS
191
+ # -----------------------------------------------------------------------------
192
+ # Build processes sometimes inline environment variables
193
+
194
+ .next/
195
+ .nuxt/
196
+ dist/
197
+ build/
198
+ out/
199
+ .output/
200
+ .cache/
201
+ .parcel-cache/
202
+ .turbo/
203
+
204
+ # -----------------------------------------------------------------------------
205
+ # TEST & COVERAGE - MAY CONTAIN SNAPSHOTS OF SENSITIVE DATA
206
+ # -----------------------------------------------------------------------------
207
+
208
+ coverage/
209
+ .nyc_output/
210
+ *.lcov
211
+
212
+ # -----------------------------------------------------------------------------
213
+ # VERCEL & DEPLOYMENT
214
+ # -----------------------------------------------------------------------------
215
+ # Vercel CLI may cache tokens
216
+
217
+ .vercel/
218
+
219
+ # -----------------------------------------------------------------------------
220
+ # MISC SECURITY-SENSITIVE PATTERNS
221
+ # -----------------------------------------------------------------------------
222
+
223
+ # Backup files might contain old secrets
224
+ *.bak
225
+ *.backup
226
+ *.old
227
+ *.orig
228
+ *.temp
229
+ *.tmp
230
+
231
+ # Archives that might contain sensitive exports
232
+ *.zip
233
+ *.tar
234
+ *.tar.gz
235
+ *.tgz
236
+ *.rar
237
+
238
+ # Docker secrets
239
+ docker-compose.override.yml
240
+ .docker/
241
+
242
+ # Terraform state (contains infrastructure secrets)
243
+ *.tfstate
244
+ *.tfstate.*
245
+ .terraform/
246
+ *.tfvars
247
+
248
+ # Ansible vault
249
+ *.vault
250
+
251
+ # Kubernetes secrets
252
+ *kubeconfig*
253
+
254
+ # -----------------------------------------------------------------------------
255
+ # ADD YOUR PROJECT-SPECIFIC IGNORES BELOW
256
+ # -----------------------------------------------------------------------------
257
+
258
+ .claude/
@@ -0,0 +1,220 @@
1
+ /**
2
+ * Praxis - Next.js Security Headers Configuration
3
+ * ===================================================
4
+ *
5
+ * Drop this into your next.config.js to add essential security headers.
6
+ *
7
+ * WHY THESE HEADERS MATTER:
8
+ * Without security headers, your app is vulnerable to:
9
+ * - Clickjacking (your site loaded in malicious iframes)
10
+ * - XSS attacks (malicious scripts injected into your pages)
11
+ * - MIME sniffing (browsers misinterpreting file types)
12
+ * - Protocol downgrade attacks (HTTPS -> HTTP)
13
+ *
14
+ * HOW TO USE:
15
+ * 1. Copy this file to your Next.js project root
16
+ * 2. Import and spread into your next.config.js (see example at bottom)
17
+ *
18
+ * TEST YOUR HEADERS:
19
+ * After deploying, check your score at: https://securityheaders.com
20
+ */
21
+
22
+ const securityHeaders = [
23
+ // ==========================================================================
24
+ // CLICKJACKING PROTECTION
25
+ // ==========================================================================
26
+ {
27
+ key: 'X-Frame-Options',
28
+ value: 'DENY'
29
+ // WHAT: Prevents your site from being embedded in iframes
30
+ // WHY: Attackers could overlay invisible buttons on your site (clickjacking)
31
+ // OPTIONS:
32
+ // 'DENY' - Never allow framing (most secure)
33
+ // 'SAMEORIGIN' - Only allow framing by your own site
34
+ // NOTE: Use 'SAMEORIGIN' if you need iframes for your own features
35
+ },
36
+
37
+ // ==========================================================================
38
+ // XSS PROTECTION
39
+ // ==========================================================================
40
+ {
41
+ key: 'X-XSS-Protection',
42
+ value: '1; mode=block'
43
+ // WHAT: Enables browser's built-in XSS filter
44
+ // WHY: Adds a layer of defense against reflected XSS attacks
45
+ // NOTE: Modern browsers use CSP instead, but this helps older browsers
46
+ },
47
+ {
48
+ key: 'X-Content-Type-Options',
49
+ value: 'nosniff'
50
+ // WHAT: Prevents browsers from MIME-sniffing (guessing file types)
51
+ // WHY: Attackers could trick browsers into executing malicious content
52
+ // by serving scripts with incorrect MIME types
53
+ },
54
+
55
+ // ==========================================================================
56
+ // HTTPS ENFORCEMENT
57
+ // ==========================================================================
58
+ {
59
+ key: 'Strict-Transport-Security',
60
+ value: 'max-age=31536000; includeSubDomains; preload'
61
+ // WHAT: Forces browsers to always use HTTPS for your site
62
+ // WHY: Prevents protocol downgrade attacks and cookie hijacking
63
+ // BREAKDOWN:
64
+ // max-age=31536000 - Remember for 1 year (in seconds)
65
+ // includeSubDomains - Apply to all subdomains too
66
+ // preload - Allow inclusion in browser's HSTS preload list
67
+ // WARNING: Only enable 'preload' if you're CERTAIN all subdomains support HTTPS
68
+ },
69
+
70
+ // ==========================================================================
71
+ // REFERRER POLICY
72
+ // ==========================================================================
73
+ {
74
+ key: 'Referrer-Policy',
75
+ value: 'strict-origin-when-cross-origin'
76
+ // WHAT: Controls how much referrer info is sent to other sites
77
+ // WHY: Prevents leaking sensitive URLs (with tokens, user IDs, etc.)
78
+ // THIS SETTING: Send origin only (not full URL) for cross-origin requests
79
+ // OPTIONS:
80
+ // 'no-referrer' - Never send referrer (most private, may break analytics)
81
+ // 'strict-origin' - Only send origin, never on HTTP downgrade
82
+ // 'strict-origin-when-cross-origin' - Full URL same-site, origin cross-site
83
+ },
84
+
85
+ // ==========================================================================
86
+ // PERMISSIONS POLICY (formerly Feature-Policy)
87
+ // ==========================================================================
88
+ {
89
+ key: 'Permissions-Policy',
90
+ value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()'
91
+ // WHAT: Disables browser features you don't need
92
+ // WHY: Reduces attack surface; malicious scripts can't access these APIs
93
+ // THIS SETTING: Disables camera, mic, location, and FLoC tracking
94
+ // CUSTOMIZE: If you need camera/mic (e.g., for video chat), update this:
95
+ // camera=(self) - Allow camera only from your own origin
96
+ // microphone=(self "https://trusted-site.com") - Allow from specific origins
97
+ },
98
+
99
+ // ==========================================================================
100
+ // CONTENT SECURITY POLICY (CSP)
101
+ // ==========================================================================
102
+ // CSP is your most powerful defense against XSS attacks.
103
+ // It tells the browser exactly which resources are allowed to load.
104
+ //
105
+ // WARNING: CSP can break your site if misconfigured!
106
+ // Start with 'Content-Security-Policy-Report-Only' to test without blocking.
107
+ {
108
+ key: 'Content-Security-Policy',
109
+ value: [
110
+ // DEFAULT: Block everything not explicitly allowed
111
+ "default-src 'self'",
112
+
113
+ // SCRIPTS: Only from your domain + inline scripts (needed for Next.js)
114
+ // NOTE: 'unsafe-inline' is needed for Next.js. For maximum security,
115
+ // use nonces instead (requires custom server setup)
116
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval'",
117
+
118
+ // STYLES: Your domain + inline styles (needed for most CSS-in-JS)
119
+ "style-src 'self' 'unsafe-inline'",
120
+
121
+ // IMAGES: Your domain + data URIs + common CDNs
122
+ // ADD your image CDN here if needed (e.g., images.unsplash.com)
123
+ "img-src 'self' data: blob: https:",
124
+
125
+ // FONTS: Your domain + Google Fonts
126
+ "font-src 'self' https://fonts.gstatic.com",
127
+
128
+ // CONNECTIONS (fetch, WebSocket, etc.): Your domain + your API
129
+ // ADD your API domains here
130
+ "connect-src 'self' https://api.openai.com https://api.anthropic.com",
131
+
132
+ // FRAMES: Block all iframes by default
133
+ // Change to 'self' if you need iframes from your own domain
134
+ "frame-src 'none'",
135
+
136
+ // PREVENT your site from being framed
137
+ "frame-ancestors 'none'",
138
+
139
+ // FORMS: Only submit to your own domain
140
+ "form-action 'self'",
141
+
142
+ // BASE URI: Prevent base tag injection
143
+ "base-uri 'self'",
144
+
145
+ // UPGRADE insecure requests to HTTPS
146
+ "upgrade-insecure-requests",
147
+ ].join('; ')
148
+ //
149
+ // DEBUGGING CSP:
150
+ // 1. Open browser DevTools > Console
151
+ // 2. Look for "Refused to load..." errors
152
+ // 3. Add the blocked domain to the appropriate directive
153
+ //
154
+ // COMMON ADDITIONS:
155
+ // - Google Analytics: Add to script-src and connect-src
156
+ // script-src: https://www.googletagmanager.com
157
+ // connect-src: https://www.google-analytics.com
158
+ // - Stripe:
159
+ // script-src: https://js.stripe.com
160
+ // frame-src: https://js.stripe.com
161
+ },
162
+ ];
163
+
164
+ /**
165
+ * Export the headers configuration for next.config.js
166
+ *
167
+ * USAGE IN next.config.js:
168
+ *
169
+ * const { securityHeadersConfig } = require('./nextjs-security-headers');
170
+ *
171
+ * module.exports = {
172
+ * ...securityHeadersConfig,
173
+ * // your other config options...
174
+ * };
175
+ *
176
+ * OR for ES modules (next.config.mjs):
177
+ *
178
+ * import { securityHeadersConfig } from './nextjs-security-headers.js';
179
+ *
180
+ * export default {
181
+ * ...securityHeadersConfig,
182
+ * // your other config options...
183
+ * };
184
+ */
185
+ const securityHeadersConfig = {
186
+ async headers() {
187
+ return [
188
+ {
189
+ // Apply to all routes
190
+ source: '/:path*',
191
+ headers: securityHeaders,
192
+ },
193
+ ];
194
+ },
195
+ };
196
+
197
+ // =============================================================================
198
+ // COMPLETE EXAMPLE: next.config.js
199
+ // =============================================================================
200
+ /*
201
+ // next.config.js (CommonJS)
202
+ const { securityHeadersConfig } = require('./nextjs-security-headers');
203
+
204
+ module.exports = {
205
+ ...securityHeadersConfig,
206
+ reactStrictMode: true,
207
+ // ... your other config
208
+ };
209
+
210
+ // OR next.config.mjs (ES Modules)
211
+ import { securityHeadersConfig } from './nextjs-security-headers.js';
212
+
213
+ export default {
214
+ ...securityHeadersConfig,
215
+ reactStrictMode: true,
216
+ // ... your other config
217
+ };
218
+ */
219
+
220
+ module.exports = { securityHeaders, securityHeadersConfig };
@@ -0,0 +1,50 @@
1
+ # .praxisignore
2
+ # =================
3
+ # Exclude paths from praxis secret scanning.
4
+ # Same syntax as .gitignore — one pattern per line, # for comments.
5
+ #
6
+ # Praxis already skips test files by default.
7
+ # Use this file to exclude additional paths that generate false positives.
8
+ #
9
+ # USAGE:
10
+ # Copy this file to your project root as .praxisignore
11
+ # Then run: npx praxis scan .
12
+
13
+ # ── Examples ──────────────────────────────────────────────────────────────────
14
+
15
+ # Exclude a specific file
16
+ # config/seed-data.js
17
+
18
+ # Exclude a directory
19
+ # scripts/fixtures/
20
+
21
+ # Exclude all files matching a pattern
22
+ # **/*.example.js
23
+ # **/*.sample.*
24
+
25
+ # Exclude documentation that contains example credentials
26
+ # docs/
27
+ # *.md
28
+
29
+ # Exclude generated files
30
+ # generated/
31
+ # prisma/migrations/
32
+
33
+ # Exclude vendor/third-party code not in node_modules
34
+ # vendor/
35
+ # third-party/
36
+
37
+ # ── Common false positive sources ─────────────────────────────────────────────
38
+
39
+ # E2E test fixtures (praxis skips unit tests but not e2e by default)
40
+ # e2e/
41
+ # cypress/fixtures/
42
+ # playwright/
43
+
44
+ # Seed data with example values
45
+ # prisma/seed.ts
46
+ # database/seeds/
47
+
48
+ # Infrastructure-as-code with example configs
49
+ # terraform/examples/
50
+ # .terraform/