Repository navigation
fix: harden encryption, key refresh and error messages - #117
Merged
Merged
Conversation
Parameters were encoded with the JVM's default charset before encryption, so non-ASCII credentials were altered wherever that default isn't UTF-8. An item update without a body, such as updateItem(itemId), threw a NullPointerException when encryption was enabled; it is now sent as-is.
Reading a stored key's exp claim threw when the key wasn't a JWT or its payload had a non-string claim, which broke every later request on the client. Such a key is now reused until the API rejects it, then refreshed once. When the refresh fails, the original 401 or 403 is returned with its body still readable, instead of a response that was already closed.
…tring A successful /auth response that couldn't be parsed was copied into the exception message and the error log, and that body carries the api key. Error responses still keep their body in the message. toString on AuthResponse, ConnectTokenResponse, CreateItemRequest and UpdateItemRequest no longer prints the key, the token or the item parameters.
rsaPublicKey(null), for example from an unset environment variable, silently built a client without parameter encryption. The integration test that uses the key now skips when the key isn't configured.
The jar included an empty log4j2.properties. Log4j looks for that file before log4j2.xml, yaml or json, so it could replace an application's own logging configuration.
Also documents how the api key interceptor handles keys it can't read, and that the encryption integration test is skipped without an RSA key.
cernadasjuan
force-pushed
the
fix/sdk-hardening
branch
from
November 5, 2026 23:33
5fec0ac to
9f11078
Compare
cernadasjuan
marked this pull request as ready for review
November 5, 2026 23:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateItem(itemId)no longer throws with encryption enabled.toString: no longer include the api key, connect token or item parameters./autherror responses still include the API's message.rsaPublicKey(null): now throws instead of silently disabling encryption. The encryption integration test skips when the key isn't configured.log4j2.properties, which could replace an application's Log4j configuration.Behaviour changes
rsaPublicKey(null)throwsIllegalArgumentException.Test plan
mvn -B clean verify: 107 unit tests (10 new) and 41 integration tests pass; the 4 skipped are existing@Disabledtests and the encryption test runs with the key setlog4j2.*resource and reports version 1.17.3maven-publish.ymlforv1.17.3is green after merge