Commit f34b394
fix(security): Implement JWKS-based JWT verification (#18)
* fix(security): implement JWKS-based JWT verification
CRITICAL SECURITY FIX: JWT signatures were not being verified,
allowing attackers to forge tokens and access/delete any user's data.
Root cause: Commit 6f41807 removed JWKS verification code assuming
gateway verification was enabled, but verify_jwt=false was still set.
Changes:
- Add jose library for JWT verification
- Implement JWKS-based signature verification for production
- Validate issuer and audience claims
- Fall back to decode-only for local dev (where JWKS is empty)
- Remove incompatible deno.lock (version 5 not supported)
Security model:
- Production: Full JWKS signature verification (ES256/RS256)
- Local dev: Decode-only (acceptable since DB is local)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle all JWKS errors in local development
Fall back to decode-only mode for ANY JWKS verification error in local
development, not just specific error messages. This handles network
errors, fetch failures, and other edge cases that wouldn't match the
previous substring checks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 40371f3 commit f34b394
2 files changed
Lines changed: 68 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
2 | 17 | | |
3 | 18 | | |
4 | 19 | | |
| |||
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
28 | 54 | | |
29 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
30 | 68 | | |
| 69 | + | |
31 | 70 | | |
32 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
33 | 80 | | |
34 | 81 | | |
35 | | - | |
| 82 | + | |
36 | 83 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 84 | + | |
43 | 85 | | |
44 | 86 | | |
45 | 87 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 88 | + | |
| 89 | + | |
49 | 90 | | |
50 | 91 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
57 | 96 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
68 | 102 | | |
69 | | - | |
70 | 103 | | |
0 commit comments