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.
- package/LICENSE +21 -0
- package/README.md +170 -0
- package/ai-defense/cost-protection.md +292 -0
- package/ai-defense/llm-security-checklist.md +324 -0
- package/ai-defense/prompt-injection-patterns.js +283 -0
- package/ai-defense/system-prompt-armor.md +327 -0
- package/checklists/launch-day.md +168 -0
- package/cli/agents/abom-generator.js +225 -0
- package/cli/agents/agent-attestation-agent.js +318 -0
- package/cli/agents/agent-config-scanner.js +787 -0
- package/cli/agents/agent-telemetry-agent.js +415 -0
- package/cli/agents/agentic-security-agent.js +296 -0
- package/cli/agents/agentic-supply-chain-agent.js +463 -0
- package/cli/agents/ai-infra-inventory-agent.js +449 -0
- package/cli/agents/api-fuzzer.js +345 -0
- package/cli/agents/auth-bypass-agent.js +348 -0
- package/cli/agents/base-agent.js +280 -0
- package/cli/agents/cicd-scanner.js +300 -0
- package/cli/agents/config-auditor.js +757 -0
- package/cli/agents/deep-analyzer.js +776 -0
- package/cli/agents/endpoint-agent-abuse-agent.js +404 -0
- package/cli/agents/exception-handler-agent.js +187 -0
- package/cli/agents/git-history-scanner.js +169 -0
- package/cli/agents/governance-audits.js +138 -0
- package/cli/agents/hermes-security-agent.js +536 -0
- package/cli/agents/html-reporter.js +1125 -0
- package/cli/agents/index.js +147 -0
- package/cli/agents/injection-tester.js +502 -0
- package/cli/agents/legal-risk-agent.js +328 -0
- package/cli/agents/llm-redteam.js +199 -0
- package/cli/agents/managed-agent-scanner.js +333 -0
- package/cli/agents/mcp-security-agent.js +588 -0
- package/cli/agents/memory-poisoning-agent.js +305 -0
- package/cli/agents/mobile-scanner.js +231 -0
- package/cli/agents/model-file-scanner.js +259 -0
- package/cli/agents/orchestrator.js +355 -0
- package/cli/agents/pii-compliance-agent.js +301 -0
- package/cli/agents/policy-engine.js +229 -0
- package/cli/agents/prompt-injection-prober.js +224 -0
- package/cli/agents/rag-security-agent.js +204 -0
- package/cli/agents/recon-agent.js +207 -0
- package/cli/agents/sbom-generator.js +265 -0
- package/cli/agents/scoring-engine.js +273 -0
- package/cli/agents/ssrf-prober.js +130 -0
- package/cli/agents/stateful-watcher.js +238 -0
- package/cli/agents/supabase-rls-agent.js +154 -0
- package/cli/agents/supply-chain-agent.js +857 -0
- package/cli/agents/swarm-orchestrator.js +200 -0
- package/cli/agents/verifier-agent.js +303 -0
- package/cli/agents/vibe-coding-agent.js +250 -0
- package/cli/bin/praxis.js +866 -0
- package/cli/commands/abom.js +73 -0
- package/cli/commands/agent-fix.js +1245 -0
- package/cli/commands/audit.js +1180 -0
- package/cli/commands/autofix.js +383 -0
- package/cli/commands/baseline.js +193 -0
- package/cli/commands/benchmark.js +327 -0
- package/cli/commands/checklist.js +223 -0
- package/cli/commands/ci.js +403 -0
- package/cli/commands/deps.js +516 -0
- package/cli/commands/diff.js +200 -0
- package/cli/commands/doctor.js +195 -0
- package/cli/commands/env-audit.js +349 -0
- package/cli/commands/fix.js +218 -0
- package/cli/commands/guard.js +396 -0
- package/cli/commands/hooks.js +278 -0
- package/cli/commands/init.js +514 -0
- package/cli/commands/legal.js +158 -0
- package/cli/commands/live-advisories.js +241 -0
- package/cli/commands/mcp.js +660 -0
- package/cli/commands/openclaw.js +386 -0
- package/cli/commands/red-team.js +350 -0
- package/cli/commands/redteam.js +78 -0
- package/cli/commands/remediate.js +797 -0
- package/cli/commands/rotate.js +768 -0
- package/cli/commands/rules.js +196 -0
- package/cli/commands/scan-mcp.js +534 -0
- package/cli/commands/scan-skill.js +588 -0
- package/cli/commands/scan-standard.js +251 -0
- package/cli/commands/scan.js +524 -0
- package/cli/commands/score.js +449 -0
- package/cli/commands/shell.js +514 -0
- package/cli/commands/team-report.js +398 -0
- package/cli/commands/undo.js +161 -0
- package/cli/commands/update-intel.js +126 -0
- package/cli/commands/vibe-check.js +276 -0
- package/cli/commands/watch.js +757 -0
- package/cli/commands/web.js +63 -0
- package/cli/core/ast/guardrail-detector.js +141 -0
- package/cli/core/ast/index.js +22 -0
- package/cli/core/ast/parser.js +676 -0
- package/cli/core/ast/scope-tree.js +287 -0
- package/cli/core/ast/taint-tracker.js +158 -0
- package/cli/core/branding.js +37 -0
- package/cli/core/env.js +38 -0
- package/cli/core/errors.js +61 -0
- package/cli/core/fs.js +62 -0
- package/cli/core/output/compliance.js +90 -0
- package/cli/core/output/html-theme.js +158 -0
- package/cli/core/output/index.js +57 -0
- package/cli/core/output/json.js +48 -0
- package/cli/core/output/sarif.js +240 -0
- package/cli/core/version.js +67 -0
- package/cli/core/web/jobs.js +183 -0
- package/cli/core/web/projects.js +146 -0
- package/cli/core/web/server.js +439 -0
- package/cli/data/atlas-knowledge.json +5640 -0
- package/cli/data/eaa-catalog.json +39 -0
- package/cli/data/known-mcps.json +26 -0
- package/cli/data/probes/prompt-injection-corpus.json +271 -0
- package/cli/data/threat-intel.json +85 -0
- package/cli/data/threatpacks/latest.json +41 -0
- package/cli/hooks/patterns.js +313 -0
- package/cli/hooks/post-tool-use.js +140 -0
- package/cli/hooks/pre-tool-use.js +186 -0
- package/cli/index.js +90 -0
- package/cli/providers/llm-provider.js +766 -0
- package/cli/utils/autofix-rules.js +74 -0
- package/cli/utils/cache-manager.js +310 -0
- package/cli/utils/compliance-map.js +191 -0
- package/cli/utils/entropy.js +132 -0
- package/cli/utils/fix-ledger.js +127 -0
- package/cli/utils/hermes-tool-registry.js +252 -0
- package/cli/utils/intel/cache.js +61 -0
- package/cli/utils/intel/http.js +88 -0
- package/cli/utils/intel/index.js +235 -0
- package/cli/utils/intel/merge.js +229 -0
- package/cli/utils/intel/sources/epss.js +54 -0
- package/cli/utils/intel/sources/ghsa.js +81 -0
- package/cli/utils/intel/sources/gitguardian.js +40 -0
- package/cli/utils/intel/sources/gitleaks.js +101 -0
- package/cli/utils/intel/sources/kev.js +38 -0
- package/cli/utils/intel/sources/nvd.js +84 -0
- package/cli/utils/intel/sources/osv.js +132 -0
- package/cli/utils/intel/sources/phylum.js +44 -0
- package/cli/utils/intel/sources/snyk.js +46 -0
- package/cli/utils/intel/sources/socket.js +69 -0
- package/cli/utils/intel/sources/sonatype.js +84 -0
- package/cli/utils/intel/sources/threatpack.js +69 -0
- package/cli/utils/mcp-trust.js +60 -0
- package/cli/utils/output.js +251 -0
- package/cli/utils/patterns.js +1130 -0
- package/cli/utils/pdf-generator.js +94 -0
- package/cli/utils/plugin-loader.js +364 -0
- package/cli/utils/rule-import.js +228 -0
- package/cli/utils/rule-registry.js +426 -0
- package/cli/utils/scan-fingerprint.js +109 -0
- package/cli/utils/scan-playbook.js +312 -0
- package/cli/utils/score-history.js +119 -0
- package/cli/utils/secrets-verifier.js +247 -0
- package/cli/utils/security-memory.js +296 -0
- package/cli/utils/standards/atlas-knowledge.js +87 -0
- package/cli/utils/standards/index.js +127 -0
- package/cli/utils/standards/sources/avid.js +45 -0
- package/cli/utils/standards/sources/eu-ai-act.js +89 -0
- package/cli/utils/standards/sources/google-saif.js +39 -0
- package/cli/utils/standards/sources/iso-42001.js +94 -0
- package/cli/utils/standards/sources/mitre-atlas.js +54 -0
- package/cli/utils/standards/sources/nist-ai-600-1.js +45 -0
- package/cli/utils/standards/sources/owasp-llm.js +45 -0
- package/cli/utils/standards/sources/owasp-ml.js +45 -0
- package/cli/utils/threat-intel.js +265 -0
- package/configs/firebase/firestore-rules.txt +215 -0
- package/configs/firebase/security-checklist.md +236 -0
- package/configs/firebase/storage-rules.txt +206 -0
- package/configs/gitignore-template +258 -0
- package/configs/nextjs-security-headers.js +220 -0
- package/configs/praxisignore-template +50 -0
- package/configs/supabase/secure-client.ts +225 -0
- package/configs/supabase/security-checklist.md +278 -0
- package/docs/THIRD_PARTY_NOTICES.md +26 -0
- package/docs/THREAT_INTEL.md +292 -0
- package/docs/USAGE.md +1205 -0
- package/docs/design/WEB-UI.md +82 -0
- package/package.json +71 -0
- package/scripts/check-determinism.mjs +119 -0
- package/snippets/README.md +122 -0
- package/snippets/api-security/api-security-checklist.md +412 -0
- package/snippets/api-security/cors-config.ts +322 -0
- package/snippets/api-security/input-validation.ts +430 -0
- package/snippets/auth/jwt-checklist.md +322 -0
- package/snippets/rate-limiting/nextjs-middleware.ts +211 -0
- 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/
|