praxis-sec 1.2.1 → 1.2.4

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 (53) hide show
  1. package/README.md +84 -115
  2. package/ai-defense/cost-protection.md +6 -0
  3. package/ai-defense/llm-security-checklist.md +6 -0
  4. package/ai-defense/system-prompt-armor.md +7 -1
  5. package/assets/praxis-architecture.svg +304 -0
  6. package/assets/praxis-logo.svg +38 -0
  7. package/checklists/launch-day.md +6 -7
  8. package/cli/agents/agent-telemetry-agent.js +2 -0
  9. package/cli/agents/api-fuzzer.js +2 -2
  10. package/cli/agents/git-history-scanner.js +14 -15
  11. package/cli/agents/html-reporter.js +9 -8
  12. package/cli/agents/mcp-security-agent.js +600 -594
  13. package/cli/agents/memory-poisoning-agent.js +1 -5
  14. package/cli/agents/orchestrator.js +375 -360
  15. package/cli/commands/agent-fix.js +3 -1
  16. package/cli/commands/audit.js +1272 -1228
  17. package/cli/commands/autofix.js +32 -13
  18. package/cli/commands/baseline.js +4 -2
  19. package/cli/commands/benchmark.js +2 -1
  20. package/cli/commands/ci.js +12 -8
  21. package/cli/commands/diff.js +2 -1
  22. package/cli/commands/env-audit.js +4 -2
  23. package/cli/commands/fix.js +2 -1
  24. package/cli/commands/legal.js +2 -1
  25. package/cli/commands/mcp.js +54 -51
  26. package/cli/commands/openclaw.js +3 -6
  27. package/cli/commands/red-team.js +2 -1
  28. package/cli/commands/remediate.js +2 -1
  29. package/cli/commands/rotate.js +2 -1
  30. package/cli/commands/scan-mcp.js +20 -9
  31. package/cli/commands/scan-standard.js +3 -6
  32. package/cli/commands/scan.js +15 -7
  33. package/cli/commands/score.js +2 -1
  34. package/cli/commands/vibe-check.js +4 -2
  35. package/cli/commands/watch.js +8 -6
  36. package/cli/core/glob.js +7 -5
  37. package/cli/core/output/json.js +56 -48
  38. package/cli/core/paths.js +91 -0
  39. package/cli/core/web/jobs.js +2 -0
  40. package/cli/data/documented-secret-examples.json +14 -0
  41. package/cli/utils/cache-manager.js +2 -1
  42. package/cli/utils/entropy.js +19 -0
  43. package/cli/utils/hermes-tool-registry.js +11 -9
  44. package/configs/firebase/security-checklist.md +3 -3
  45. package/configs/supabase/security-checklist.md +19 -21
  46. package/docs/RELEASE-1.2.4.md +85 -0
  47. package/docs/RELEASING.md +51 -0
  48. package/docs/THIRD_PARTY_NOTICES.md +8 -0
  49. package/docs/THREAT_INTEL.md +4 -2
  50. package/docs/USAGE.md +97 -76
  51. package/package.json +6 -4
  52. package/snippets/README.md +6 -0
  53. package/snippets/auth/jwt-checklist.md +14 -13
@@ -2,26 +2,26 @@
2
2
 
3
3
  **Secure your JWT implementation before launch.**
4
4
 
5
- Based on [JWT Best Practices 2025](https://jwt.app/blog/jwt-best-practices/) and OWASP guidelines.
5
+ Based on [RFC 8725: JWT Best Current Practices](https://www.rfc-editor.org/rfc/rfc8725.html). Examples need application-specific key management and claim validation.
6
6
 
7
7
  ---
8
8
 
9
9
  ## Critical: Algorithm & Signing
10
10
 
11
- ### 1. [ ] Using secure algorithm (not HS256 in production)
11
+ ### 1. [ ] Use an explicitly allowed algorithm and appropriate keys
12
12
 
13
13
  ```typescript
14
14
  // BAD: HS256 with weak secret
15
15
  jwt.sign(payload, 'my-secret', { algorithm: 'HS256' });
16
16
 
17
- // GOOD: RS256 (asymmetric) for production
17
+ // Asymmetric option: RS256 with appropriate key management
18
18
  jwt.sign(payload, privateKey, { algorithm: 'RS256' });
19
19
 
20
- // GOOD: ES256 (elliptic curve) - smaller keys, same security
20
+ // Asymmetric option: ES256 with appropriate key management
21
21
  jwt.sign(payload, privateKey, { algorithm: 'ES256' });
22
22
  ```
23
23
 
24
- **Why:** HS256 secrets can be brute-forced. RS256/ES256 use public/private key pairs.
24
+ **Why:** Weak HS256 keys permit offline guessing. HS256 can be appropriate with a strong random shared key; asymmetric keys separate signing authority from verification. Pin the expected algorithm and key type.
25
25
 
26
26
  ### 2. [ ] Algorithm specified in verification (not "auto")
27
27
 
@@ -35,8 +35,8 @@ jwt.verify(token, key, { algorithms: ['RS256'] });
35
35
 
36
36
  ### 3. [ ] Strong secret/key used
37
37
 
38
- For HS256 (if you must use it):
39
- - [ ] At least 256 bits (32 characters)
38
+ For HS256:
39
+ - [ ] At least 256 bits of random key material (32 bytes; character count is not entropy)
40
40
  - [ ] Random, not dictionary words
41
41
  - [ ] Stored in environment variable
42
42
 
@@ -59,15 +59,15 @@ jwt.sign(payload, key, { expiresIn: '15m' });
59
59
  jwt.sign(payload, key, { expiresIn: '30d' }); // Too long!
60
60
  ```
61
61
 
62
- **Recommended lifetimes:**
62
+ **Illustrative lifetimes; choose these from the application risk and session requirements:**
63
63
  - Access tokens: 15-60 minutes
64
64
  - Refresh tokens: 7-30 days
65
65
  - Remember me: 30-90 days (with re-auth for sensitive actions)
66
66
 
67
- ### 5. [ ] Expiration claim (exp) always set
67
+ ### 5. [ ] Expiration claim (exp) is required and validated
68
68
 
69
69
  ```typescript
70
- // Always verify expiration
70
+ // Validate expiration, and separately reject tokens missing the required exp claim
71
71
  jwt.verify(token, key, {
72
72
  algorithms: ['RS256'],
73
73
  clockTolerance: 30, // 30 seconds tolerance for clock skew
@@ -132,7 +132,7 @@ res.cookie('token', value, {
132
132
 
133
133
  ```typescript
134
134
  res.cookie('token', value, {
135
- sameSite: 'strict', // Prevents CSRF
135
+ sameSite: 'strict', // Helps reduce CSRF; verify the full request/CSRF design
136
136
  // Or 'lax' if you need cross-site GET requests
137
137
  });
138
138
  ```
@@ -184,10 +184,11 @@ JWTs can't be invalidated by default. Implement one of:
184
184
 
185
185
  **Option B: Token blacklist/denylist**
186
186
  ```typescript
187
+ // Illustrative only; production revocation state must be shared and durable.
187
188
  const revokedTokens = new Set();
188
189
 
189
190
  function verifyToken(token) {
190
- const payload = jwt.verify(token, key);
191
+ const payload = jwt.verify(token, key, { algorithms: ['RS256'] });
191
192
  if (revokedTokens.has(payload.jti)) {
192
193
  throw new Error('Token revoked');
193
194
  }
@@ -261,7 +262,7 @@ const token = jwt.sign({
261
262
 
262
263
  ## Code Examples
263
264
 
264
- ### Complete JWT Service
265
+ ### Illustrative JWT Service
265
266
 
266
267
  ```typescript
267
268
  import jwt from 'jsonwebtoken';