Skip to content

fix(security): hard production guard on insecure-TLS hatch + workflow perms + example SDK bump#193

Merged
saurabhjain1592 merged 1 commit into
mainfrom
fix/security-trustmanager-prod-guard
Jun 16, 2026
Merged

fix(security): hard production guard on insecure-TLS hatch + workflow perms + example SDK bump#193
saurabhjain1592 merged 1 commit into
mainfrom
fix/security-trustmanager-prod-guard

Conversation

@saurabhjain1592

@saurabhjain1592 saurabhjain1592 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Clears all three open security alerts on this repo (epic getaxonflow/axonflow-enterprise#2711).

Alert Sev What Fix
CodeQL #8 high java/insecure-trustmanager at HttpClientFactory.java hard production guard added (see below); alert dismissed-by-design
CodeQL #9 medium actions/missing-workflow-permissions on heartbeat-real-stack.yml top-level permissions: contents: read
Dependabot #2 medium example pins stale com.getaxonflow:axonflow-sdk 5.5.0 (vuln < 6.0.0) examples/wcp-retry-idempotency/pom.xml -> 8.5.0

CodeQL #8: keep the dev escape hatch, add a hard production guard

The trust-all TrustManager is an intentional, double-gated development affordance for self-signed certificates: it activates only when BOTH insecureSkipVerify(true) is set on the config builder AND the AXONFLOW_INSECURE_TLS env var is set. Removing it would break legitimate local self-signed-cert workflows, so it stays.

As belt-and-suspenders, create() now refuses the insecure path entirely when a production-like deployment environment is detected, even if both gates are set: TLS verification stays on and a SECURITY error is logged naming the signalling variable. A production environment is detected when any of a set of common deployment env vars (ENVIRONMENT, AXONFLOW_ENVIRONMENT, APP_ENV, SPRING_PROFILES_ACTIVE, NODE_ENV, ...) carries a prod/production token. The value is tokenised on whitespace/comma/semicolon/colon/hyphen/underscore/dot/slash so compound names like production-us and prod_west are caught; negated labels like non-prod/pre-prod are correctly not treated as production so the dev hatch stays usable there.

New unit tests prove the guard prevents (not merely logs) the insecure path, catches hyphen/underscore-delimited prod names, handles compound Spring profiles, and does not false-positive on negated or non-prod values.

Because this is a real shipped-code change, pom.xml is bumped 8.5.0 -> 8.5.1 with a matching CHANGELOG entry. (No tag is cut here; release is the operator's step.) The CodeQL alert will be dismissed-by-design on the epic now that the production path is hardened.

Workflow permissions

heartbeat-real-stack.yml only checks out the repo and runs tests, so contents: read is sufficient. Block kept byte-identical to the axonflow-sdk-typescript heartbeat fix.

Example SDK bump

examples/wcp-retry-idempotency/pom.xml referenced the long-stale 5.5.0; bumped to the current released 8.5.0 on Maven Central (>= the 6.0.0 patch floor). The example is a standalone module (not in the parent <modules>); it intentionally references the last published release, not the unreleased 8.5.1.

Tests

  • mvn test green (1312 tests, 0 failures; 18 in HttpClientFactoryTest)
  • mvn jacoco:check green (coverage gate met)

Refs getaxonflow/axonflow-enterprise#2711

Runtime E2E

Added runtime-e2e/trustmanager_prod_guard/ (no-mocks Java driver + README) proving the guard end-to-end against a live agent: in a production-like env with insecure TLS requested, the SDK refuses the trust-all path (default verifying verifier stays installed) yet a real governed decide() still succeeds over the agent's valid TLS cert. Compiles against the real SDK API; run instructions in the README.

…orkflow perms + example SDK bump

Three security alerts on axonflow-sdk-java:

1. CodeQL java/insecure-trustmanager (#8, high) at HttpClientFactory.java.
   The trust-all path is an intentional, double-gated development escape
   hatch for self-signed certs (requires BOTH insecureSkipVerify(true) AND
   AXONFLOW_INSECURE_TLS env var). Rather than remove the dev affordance,
   this adds a hard production guard: when a production-like deployment
   environment is detected (ENVIRONMENT / AXONFLOW_ENVIRONMENT / APP_ENV /
   SPRING_PROFILES_ACTIVE / NODE_ENV / ... carrying a 'prod'/'production'
   token), the insecure path is REFUSED outright, TLS verification stays
   enabled, and a SECURITY error is logged naming the signalling variable.
   New tests prove the guard PREVENTS the insecure path (not just logs),
   handles compound values (prod,metrics), and does not false-positive on
   non-production values. Alert to be dismissed-by-design on #2711 now that
   the production path is belt-and-suspenders hardened. Real code change ->
   VERSION bumped 8.5.0 -> 8.5.1 + CHANGELOG.

2. CodeQL actions/missing-workflow-permissions (#9, med) on
   heartbeat-real-stack.yml: added a top-level least-privilege
   'permissions: contents: read' block (workflow only checks out + tests).
   Block kept identical to the axonflow-sdk-typescript fix for coherence.

3. Dependabot #2 (med): examples/wcp-retry-idempotency/pom.xml pinned a
   stale com.getaxonflow:axonflow-sdk 5.5.0 (vulnerable < 6.0.0); bumped to
   the current released 8.5.0.

Refs getaxonflow/axonflow-enterprise#2711

Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
@saurabhjain1592 saurabhjain1592 force-pushed the fix/security-trustmanager-prod-guard branch from 6a7e446 to 2816fd0 Compare June 16, 2026 09:43
@saurabhjain1592 saurabhjain1592 merged commit 54f6f75 into main Jun 16, 2026
18 checks passed
@saurabhjain1592 saurabhjain1592 deleted the fix/security-trustmanager-prod-guard branch June 16, 2026 11:32
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