Repository navigation
Commit edfd0fa
committed
fix(node): address review on icaptcha gate (validate config, bound key fetch)
Addresses CodeRabbit and @jatmn review feedback on #108:
- parse_mode now returns Option and rejects unrecognized ICAPTCHA_MODE values;
init() warns and falls back to off instead of silently disabling the gate on
a typo like "enforced". [P2]
- ICAPTCHA_REQUIRED_LEVEL: warn on a non-empty unparseable value instead of
silently lowering the threshold to the default. [P2]
- fetch_key uses a reqwest client with a 5s timeout so a hung /v1/pubkey can
never block node startup; still fails inert on timeout/error. [P2]
- .env.example: reorder ICAPTCHA_* keys (MODE, PUBKEY, REQUIRED_LEVEL, URL) to
satisfy dotenv-linter. [P3]
- add parse_mode unit test (rejects junk, accepts documented values).
cargo test -p gitlawb-node icaptcha: 12 passed. clippy + fmt clean.
Author: Kevin Codex <kevin@gitlawb.com>1 parent 4f39baf commit edfd0fa
2 files changed
Lines changed: 51 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
56 | 76 | | |
57 | 77 | | |
58 | 78 | | |
| |||
97 | 117 | | |
98 | 118 | | |
99 | 119 | | |
100 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
101 | 127 | | |
102 | 128 | | |
103 | 129 | | |
104 | 130 | | |
105 | 131 | | |
106 | 132 | | |
107 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
108 | 138 | | |
109 | 139 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 140 | + | |
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
| |||
287 | 314 | | |
288 | 315 | | |
289 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
290 | 328 | | |
291 | 329 | | |
292 | 330 | | |
| |||
0 commit comments