Skip to content

fix(resilience): a probe intervalSec under 1 is refused - #567

Merged
bmscomp merged 1 commit into
mainfrom
fix/probe-interval-floor
Oct 31, 2026
Merged

bmscomp merged 1 commit into
mainfrom
fix/probe-interval-floor

Conversation

@bmscomp

@bmscomp bmscomp commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Why

Audit finding 13 (2026-10-29). POST /api/resilience accepted any probe intervalSec. ResilienceOrchestrator's probe monitor sleeps intervalSec * 1000 ms between rounds of the Continuous probes, so "intervalSec": 0 ran kubectl exec-style calls into the broker pods back to back for the whole fault. One bad request could flood the Kubernetes API.

What changed

  • ResilienceResource.executeResilienceTest refuses a probe with intervalSec < 1 with a 400 Validation Failed, before the stream starts and before the safety and concurrency checks. fieldErrors names each probe by index (probes[1].intervalSec), the way bean validation names list elements. A null entry in probes is skipped here, as before.
  • This is the only way in for a probe from outside: the scenarios (POST /api/resilience/scenarios/{id}) bring their own probes from KafkaProbes, at 10 to 15 s.
  • The OpenAPI 400 description and docs/book/11-api-reference.md say so; the book also gives the default (10).
  • The two new imports move ResilienceResource.java's anchored ref in cli/cmd/mcp_tools_runs_activity.go from 107-137 to 109-139. The new method sits below that range.

Tests

  • New ResilienceResourceTest.aProbeIntervalUnderOneSecondIsRefusedByItsIndex: two probes, the second at 0. 400, only probes[1].intervalSec is named, and the orchestrator is never called. Without the fix the request gets a 200.

Local runs:

  • cd kates && ./mvnw test -Dquarkus.grpc.codegen.skip=true -Dquarkus.http.test-port=0: BUILD SUCCESS, 1789 tests, 0 failures, 0 errors, 3 skipped
  • spotless:check (JDK 25): clean
  • cd cli && go test -count=1 ./cmd -run 'TestMCPCaveat|Anchor': pass
  • golangci-lint run --new-from-rev=origin/main ./...: 0 issues
  • scripts/check-book-style.sh: OK

Only CI can run the integration tests, the native image, Docker, CodeQL and the Quarto book render.

Deliberately not done

  • No floor in the orchestrator itself (Math.max(1, …)): nothing inside Kates builds a probe under 1, so the request check covers every path.
  • timeoutSec has no floor either. Finding 13 was only about the interval; a 0 timeout fails the probe rather than spinning.
  • The monitor still sleeps the first continuous probe's interval for all of them. That is unchanged.

POST /api/resilience took any probe intervalSec. The probe monitor sleeps
that long between rounds, so at 0 it ran exec calls into the broker pods
back to back for the whole fault. It is now a 400 naming the probe, as
probes[1].intervalSec, before the stream starts.

The book's resilience section gives the default and the floor. The two
new imports move ResilienceResource's anchored MCP ref to 109-139.
@bmscomp
bmscomp merged commit f91ee59 into main Oct 31, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant