security: SafeguardJava 8.3.0 — coordinated security review fixes#162
Open
petrsnd wants to merge 7 commits into
Open
security: SafeguardJava 8.3.0 — coordinated security review fixes#162petrsnd wants to merge 7 commits into
petrsnd wants to merge 7 commits into
Conversation
…-SafeguardJava-001) Replaces the generic SSLContext.getInstance(TLS) call with an explicit TLSv1.2 protocol pin in both the REST transport (RestClient.getSSLContext) and the SignalR/WebSocket transport (SafeguardEventListener.ConfigureHttpClientBuilder). The TLS alias can resolve to TLS 1.0/1.1 on JVMs whose jdk.tls.disabledAlgorithms has been narrowed; pinning the version at the SDK layer makes the minimum handshake version a property of the SDK itself, independent of caller JVM configuration. TLS 1.3, where supported by both peers, is still negotiated normally by the underlying SSLContext. Both classes now expose a package-private TLS_PROTOCOL constant so the pinned version has a single auditable source of truth. Tests: - RestClientSSLContextTest: verifies TLS_PROTOCOL constant + actual SSLContext.getProtocol() value via reflection on getSSLContext. - SafeguardEventListenerSSLContextTest: mirror test for the event listener transport. Test infrastructure: pom.xml now declares junit 4.13.2 + okhttp3 mockwebserver 4.12.0 (test scope) and maven-surefire-plugin 3.2.5; previously there was no src/test/java suite at all. Resolves F-SafeguardJava-003 (W2).
…uardJava-002) Per cross-cutting decision D-001, the ignoreSsl feature is kept as a legitimate convenience for development against self-signed appliances, and the SDK does not emit a runtime warning. This commit closes the documentation gap: - README.md: new section 'TLS Certificate Verification and the ignoreSsl Flag'. Documents what ignoreSsl actually toggles (X.509 chain validation + a NoopHostnameVerifier, *not* the TLS version), a three-row table of supported configurations, and the recommended production paths (JVM truststore import, or a HostnameVerifier callback with ignoreSsl=false). - RestClient.java: Javadoc on the (String, String, char[], boolean, HostnameVerifier) constructor describing the security implications of ignoreSsl and pointing to the TLS_PROTOCOL constant. - SafeguardEventListener.java: equivalent Javadoc on the (String, char[], boolean, HostnameVerifier) constructor. No code or public API changes. Resolves F-SafeguardJava-001, F-SafeguardJava-002, F-SafeguardJava-004 (W3).
…P-SafeguardJava-003) Stable transitive-dep refresh per F-SafeguardJava-005: jackson-databind 2.18.3 -> 2.21.3 gson 2.11.0 -> 2.14.0 httpclient5 5.4.3 -> 5.6.1 All three are stable (non-preview, non-alpha) releases and are drop-in compatible with the SDK's current usage. mvn verify (build + 4 unit tests + spotbugs) green. Deferred per D-014 / owner no-preview-tech rule: - okhttp 4.12.0 (latest is 5.x alpha) - signalr 8.0.12 (latest is 11.0.0-preview) - slf4j-api 2.0.17 (latest is 2.1.0-alpha1) These three will be revisited once each upstream reaches GA. Resolves F-SafeguardJava-005 (M, stable subset).
Add BoundedResponseReader that enforces a 10 MB default cap on in-memory HTTP response bodies. Pre-read check rejects oversized Content-Length headers; streaming counter trips on chunked overflow. Wired into Utils.getResponse and PkceAuthenticator.rstsFormPost. Explicit streaming download paths (StreamResponse, StreamingRequest) are unaffected — callers there manage their own sinks.
Audit outcome: Java event listener delegates reconnect to caller via SafeguardEventListenerDisconnectedException; no native tight-loop reconnect exists to harden. Distinct-but-valid design. A jittered exponential backoff helper is deferred to Phase 2.
…afeguardJava-001, D-014)
Member
Author
|
Partial live verification against 192.168.117.15 admin smoke 2026-05-26. Manual Java SDK read-only probe passed (connect, GET Me, GET Users?limit=200, GET Status). Oversized response cap could not be safely triggered with available read-only appliance endpoints; cap remains unit-verified only. Full log: .security-review-impl-logs/live-sweep/java-live.log |
Member
Author
|
Full live appliance sweep re-run (mutation allowed) completed against 192.168.117.15. Results:
Lease released in |
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
Coordinated SafeguardJava security review fixes for the 8.3.0 snapshot release.
Findings cited from
E:\source\OpenSource\security-findings-safeguardjava.mdSSLContext.getInstance("TLS")could allow TLS 1.0/1.1 negotiation on misconfigured JVMs.ignoreSsl=truecertificate/hostname-verification risk documented with clearer guidance rather than changing the explicit opt-in behavior.Release notes
Utils.getResponsesignature: now throws checkedSafeguardForJavaException; in-tree migration is complete. Downstream consumers calling this internal helper directly may need to update try/catch. Surfaced here for release notes, but treated as non-breaking per D-002 scope decision.handleDisconnectdelegates toDefaultDisconnectHandler; reference impl inSafeguardDotNet/Event/ReconnectBackoff.cs.Verification
mvn -B verifypasses: 10 tests, 0 failures/errors/skips; SpotBugs 0 findings.8.2.0-SNAPSHOTto8.3.0-SNAPSHOT.