Skip to content

Fix #195, #196, #197: jooby security and correctness fixes#198

Merged
xsalefter merged 2 commits intojobby-fix_deferred_testsfrom
copilot/fix-issues-195-196-197
Apr 8, 2026
Merged

Fix #195, #196, #197: jooby security and correctness fixes#198
xsalefter merged 2 commits intojobby-fix_deferred_testsfrom
copilot/fix-issues-195-196-197

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

Fixes three issues from the Copilot code review on PR #194:

Changes

#195 — CsrfHandler: CSRF token leak in error message

Issue | Original review

The error message echoed back the attacker-controlled CSRF token candidate, which could leak sensitive values into responses/logs. Changed to a generic "Invalid CSRF token" message.

#196 — Cookie.Signature: platform-dependent charset

Issue | Original review

secret.getBytes() and value.getBytes() used platform default charset, which could produce different HMAC signatures across environments. Both now use explicit StandardCharsets.UTF_8.

#197 — SSIHandler: stream variable mismatch and missing error context

Issue | Original review

  • text() read from stream instead of the managed in variable in the try-with-resources block — fixed to read from in
  • file() now explicitly checks for null resource and throws NoSuchElementException with the resource path, instead of relying on NullPointerException from InputStreamReader
  • Removed NullPointerException from the catch clause (no longer needed)

Tests added

  • CsrfHandlerTest — 4 tests: invalid token does not echo candidate, valid token passes through, GET request skips verification, missing token throws 403
  • SSIHandlerTest — 2 tests: missing resource includes path in message, existing resource returns content

Test results

All 929 jooby tests pass, 0 failures (baseline was 923; +6 from new tests).

Copilot AI and others added 2 commits April 8, 2026 16:32
#195: CsrfHandler no longer echoes attacker token
#196: Cookie.Signature uses explicit UTF-8 charset
#197: SSIHandler reads managed stream, includes path

Agent-Logs-Url: https://github.com/killbill/killbill-commons/sessions/1c6da6eb-b63f-4e6e-a2e2-bb2a2d6f8d27

Co-authored-by: xsalefter <510438+xsalefter@users.noreply.github.com>
@xsalefter xsalefter changed the base branch from master to jobby-fix_deferred_tests April 8, 2026 16:36
Copilot AI requested a review from xsalefter April 8, 2026 16:38
@xsalefter xsalefter marked this pull request as ready for review April 8, 2026 18:23
@xsalefter xsalefter merged commit b257be0 into jobby-fix_deferred_tests Apr 8, 2026
28 checks passed
@xsalefter xsalefter deleted the copilot/fix-issues-195-196-197 branch April 10, 2026 21:01
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.

2 participants