Commit b3f736c
committed
refactor: rename cookie_secret to signing_key and add JWT test coverage
Breaking changes:
- Rename cookie_secret -> signing_key for clarity (JWT signing key)
- Remove redundant CookieGenerator.Secret field (unused)
Improvements:
- Fix Content-Type matching: use HasPrefix + ToLower for RFC compliance
- Now handles: application/x-www-form-urlencoded; charset=UTF-8
- Case-insensitive: Application/X-WWW-Form-URLEncoded
- Add comprehensive JWT test coverage (20 tests):
- Signature verification and tampering detection
- Expiration validation
- Token lifecycle and status transitions
- Cookie generation and validation
- Edge cases and malformed tokens
Updated:
- README: cookie_secret -> signing_key with JWT clarification
- Config example: updated to use signing_key
- Simplified CookieGenerator.Init() (no secret param)
All tests pass. Closes security and UX gaps in stateless captcha flow.1 parent 2a63ef0 commit b3f736c
File tree
5 files changed
+482
-26
lines changed- config
- internal/remediation/captcha
- pkg/spoa
5 files changed
+482
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments