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.
- package/README.md +84 -115
- package/ai-defense/cost-protection.md +6 -0
- package/ai-defense/llm-security-checklist.md +6 -0
- package/ai-defense/system-prompt-armor.md +7 -1
- package/assets/praxis-architecture.svg +304 -0
- package/assets/praxis-logo.svg +38 -0
- package/checklists/launch-day.md +6 -7
- package/cli/agents/agent-telemetry-agent.js +2 -0
- package/cli/agents/api-fuzzer.js +2 -2
- package/cli/agents/git-history-scanner.js +14 -15
- package/cli/agents/html-reporter.js +9 -8
- package/cli/agents/mcp-security-agent.js +600 -594
- package/cli/agents/memory-poisoning-agent.js +1 -5
- package/cli/agents/orchestrator.js +375 -360
- package/cli/commands/agent-fix.js +3 -1
- package/cli/commands/audit.js +1272 -1228
- package/cli/commands/autofix.js +32 -13
- package/cli/commands/baseline.js +4 -2
- package/cli/commands/benchmark.js +2 -1
- package/cli/commands/ci.js +12 -8
- package/cli/commands/diff.js +2 -1
- package/cli/commands/env-audit.js +4 -2
- package/cli/commands/fix.js +2 -1
- package/cli/commands/legal.js +2 -1
- package/cli/commands/mcp.js +54 -51
- package/cli/commands/openclaw.js +3 -6
- package/cli/commands/red-team.js +2 -1
- package/cli/commands/remediate.js +2 -1
- package/cli/commands/rotate.js +2 -1
- package/cli/commands/scan-mcp.js +20 -9
- package/cli/commands/scan-standard.js +3 -6
- package/cli/commands/scan.js +15 -7
- package/cli/commands/score.js +2 -1
- package/cli/commands/vibe-check.js +4 -2
- package/cli/commands/watch.js +8 -6
- package/cli/core/glob.js +7 -5
- package/cli/core/output/json.js +56 -48
- package/cli/core/paths.js +91 -0
- package/cli/core/web/jobs.js +2 -0
- package/cli/data/documented-secret-examples.json +14 -0
- package/cli/utils/cache-manager.js +2 -1
- package/cli/utils/entropy.js +19 -0
- package/cli/utils/hermes-tool-registry.js +11 -9
- package/configs/firebase/security-checklist.md +3 -3
- package/configs/supabase/security-checklist.md +19 -21
- package/docs/RELEASE-1.2.4.md +85 -0
- package/docs/RELEASING.md +51 -0
- package/docs/THIRD_PARTY_NOTICES.md +8 -0
- package/docs/THREAT_INTEL.md +4 -2
- package/docs/USAGE.md +97 -76
- package/package.json +6 -4
- package/snippets/README.md +6 -0
- 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
|
|
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. [ ]
|
|
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
|
-
//
|
|
17
|
+
// Asymmetric option: RS256 with appropriate key management
|
|
18
18
|
jwt.sign(payload, privateKey, { algorithm: 'RS256' });
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// Asymmetric option: ES256 with appropriate key management
|
|
21
21
|
jwt.sign(payload, privateKey, { algorithm: 'ES256' });
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**Why:** HS256
|
|
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
|
|
39
|
-
- [ ] At least 256 bits (32
|
|
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
|
-
**
|
|
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)
|
|
67
|
+
### 5. [ ] Expiration claim (exp) is required and validated
|
|
68
68
|
|
|
69
69
|
```typescript
|
|
70
|
-
//
|
|
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', //
|
|
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
|
-
###
|
|
265
|
+
### Illustrative JWT Service
|
|
265
266
|
|
|
266
267
|
```typescript
|
|
267
268
|
import jwt from 'jsonwebtoken';
|