Repository navigation
Reject unreadable request bodies in ICAPFilter - #197
Conversation
2763154 to
b173664
Compare
maximthomas
left a comment
There was a problem hiding this comment.
praise: The new tests exercise read failures during both the empty-body probe and the full read, and verify that an empty body still reaches the next handler.
suggestion (non-blocking): Assert that the ICAP request receives the full readable body.
The new probe reads one byte and restores the stream position before getBytes() constructs the ICAP payload. A future regression that loses the probe byte could pass the read-failure and empty-body tests. The current push() and pop() balance was independently verified against Commons HTTP Framework 3.2.2. First-byte probe
Pin: Capture the ICAPRequest sent to a mocked client that returns ICAP 204 and assert that getHttpRequestBody() equals the original non-empty byte array.
## Summary Use the test classpath root in `ScriptTest` so the shared Groovy engine can find file-backed test scripts when the permissions tests run first. This addresses the six `Cannot open URL` failures seen in CI for #197. ## Validation - Reproduced all six failures on `master` with `ScriptTest` first. After the change, all 40 tests passed in both class orders on JDK 11. - `mvn -pl openig-core -am verify` passed all 1,072 tests on JDK 11.
b173664 to
577c748
Compare
|
@maximthomas I addressed your review suggestion in 577c748f. The regression test captures the |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The regression test checks the exact bytes sent to ICAP when the client returns 204. ICAPFilterTest.java:139
Summary
Return HTTP 400 when
ICAPFiltercannot read a request body. This covers errors during the empty-body check and during the read before sending the body to ICAP.Validation
mvn verifypassed on JDK 27 with 1,601 tests. The new test failed as expected when the probe consumed the first byte.Related pull request