Commit 80c822b
feat(serving): config validation, integration coverage, docs refresh (PR 5/5)
Final PR of the production-readiness series. Closes the remaining audit
findings around silent oversized-input clamping, missing end-to-end
coverage of the serving filter chain, and stale tech-stack pins.
McpTools per-call clamping:
- queryNodes / queryEdges `limit` → clamped to mcp.limits.max_results
- getEgoGraph `radius` → clamped to mcp.limits.max_depth
- searchGraph `limit` → clamped to mcp.limits.max_results
Defense-in-depth on top of the transaction-timeout cap from PR 2 — a
caller asking for limit=1_000_000 or radius=999 now gets the configured
ceiling instead of an unbounded Cypher walk.
ConfigValidator hard ceilings + blank-string checks:
- mcp.limits.max_payload_bytes — must be > 0
- mcp.limits.rate_per_minute — must be > 0
- mcp.limits.max_depth — must be 1..100 (variable-length Cypher
with depth >100 is pathological — DoS sentinel)
- mcp.auth.token_env / .token — blank fails validation when mode=bearer
ServingChainIntegrationTest (new, 9 cases):
- 401 envelope shape with X-Request-Id correlation
- 200 + valid token pass-through
- 401 + wrong token
- security headers present on success responses
- inbound X-Request-Id propagation when valid
- inbound control-char rejection (log-injection defense)
- 429 envelope with Retry-After + X-RateLimit-Remaining: 0
- /actuator/health bypasses auth (kubelet probes)
- rate-limit bucket isolation per token
Manually chains the four filters via lambda FilterChain instances —
runs sub-second, no @SpringBootTest, no Neo4j.
CLAUDE.md tech-stack pins: Spring Boot 4.0.5→4.0.6, Spring AI
2.0.0-M3→2.0.0-M4, Neo4j 2026.02.3→2026.04.0; added Bucket4j 8.18.0,
logstash-logback-encoder 9.0, micrometer-registry-prometheus.
Tests: 3689 / 0 / 0 / 32 skipped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e8eda53 commit 80c822b
5 files changed
Lines changed: 339 additions & 9 deletions
File tree
- src
- main/java/io/github/randomcodespace/iq
- config/unified
- mcp
- test/java/io/github/randomcodespace/iq/config/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
475 | 530 | | |
476 | 531 | | |
477 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
67 | 106 | | |
68 | 107 | | |
69 | 108 | | |
| |||
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
| |||
181 | 187 | | |
182 | 188 | | |
183 | 189 | | |
184 | | - | |
| 190 | + | |
| 191 | + | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| |||
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
204 | | - | |
| 211 | + | |
205 | 212 | | |
206 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
207 | 219 | | |
208 | 220 | | |
209 | 221 | | |
| |||
429 | 441 | | |
430 | 442 | | |
431 | 443 | | |
432 | | - | |
| 444 | + | |
433 | 445 | | |
434 | | - | |
| 446 | + | |
| 447 | + | |
435 | 448 | | |
436 | 449 | | |
437 | 450 | | |
| |||
0 commit comments