Skip to content

CAMEL-23250: Security policy enforcement with profile-aware defaults#22269

Open
gnodet wants to merge 3 commits intomainfrom
CAMEL-23250-security-policy-enforcement
Open

CAMEL-23250: Security policy enforcement with profile-aware defaults#22269
gnodet wants to merge 3 commits intomainfrom
CAMEL-23250-security-policy-enforcement

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 26, 2026

Summary

Built-in security policy enforcement that detects insecure configuration at startup and either warns or prevents the application from starting.

  • 4 security categories: secret (plain-text passwords), insecure:ssl (disabled cert verification), insecure:serialization (Java object deserialization), insecure:dev (dev-only features in prod)
  • 3 policy levels: allow (silent), warn (log, default), fail (block startup)
  • Profile-aware: prod profile auto-sets policy=fail
  • Per-category overrides: e.g. camel.security.insecureSslPolicy=allow while global is fail
  • Allowlist: exempt specific properties via camel.security.allowedProperties
  • Health check: exposes violations via Camel health check API
  • Programmatic API: SecurityPolicyResult accessible as a CamelContext plugin

Commit structure (for easier review)

  1. b0834ac Fix missing secret=true annotations — CyberArk authToken, IBM Event Streams eventStreamUsername/eventStreamPassword (2 files)
  2. 5c89a07 Security policy enforcement framework — all new classes, tooling, component annotations, tests, docs (90 files)
  3. c25dd5c Regenerate catalog and generated files — JSON metadata and endpoint DSL (423 files, reviewers can skip this commit)

Key files to review

Framework core:

Tooling (annotation → generated map pipeline):

Health check:

Tests & docs:

Example annotation change (repeated across 60+ components):

Test plan

  • 27 unit tests in MainSecurityPolicyTest (all policy levels, categories, overrides, profiles, allowed properties, placeholder detection)
  • 1 unit test in SecurityUtilsTest (plain-text secret detection)
  • Build succeeds with mvn install -B -pl core/camel-main -DskipTests -am
  • All tests pass with mvn test -B -pl core/camel-main -Dtest=MainSecurityPolicyTest
  • Generated files are up to date (no uncommitted changes after build)
  • Code formatted with mvn formatter:format impsort:sort

Follow-up ideas

Findings from a security audit that are not covered by this PR but could be addressed in follow-up tickets:

Near-term

  1. Infinispan deserialization filterDefaultExchangeHolderUtils uses ClassLoadingAwareObjectInputStream without JEP-290 setObjectInputFilter(). Should add the same default filter (java.**;org.apache.camel.**;!*) used by SQL/LevelDB/Cassandra/Consul stores.

  2. TLS protocol version filtering — Splunk and Paho MQTT expose SSLv3/TLSv1 in their protocol enums. The global SSLContextParameters default filtering only excludes SSL.* regex. Consider also excluding TLSv1 and TLSv1.1 by default.

Medium-term

  1. FIPS compliance category — The framework already supports arbitrary categories via resolvePolicy()'s default → null fallback. Adding insecure:fips requires annotating non-FIPS algorithms and adding a fipsPolicy field to SecurityConfigurationProperties. See JIRA comment for a detailed plan.

  2. SSRF mitigation — Add an optional URI whitelist mechanism for toD/recipientList dynamic routing. This is an architectural change beyond config-level checking.

  3. Expression language sandboxing — OGNL, Groovy, MVEL, SpEL all allow arbitrary code execution. Not config-level (the framework can't catch this), but documenting the risk in security.adoc would help users make informed choices.

Low priority

  1. HTTP header CRLF validation — Add header value sanitization in camel-http-common to prevent header injection.

  2. MongoDB trust-all TrustManagerSslAwareMongoClient hardcodes a trust-all TrustManager. Not trackable by the annotation framework since it's programmatic, not a @UriParam.

@gnodet gnodet requested review from davsclaus and oscerd March 26, 2026 00:46
@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet marked this pull request as draft March 26, 2026 06:24
@gnodet gnodet changed the title CAMEL-23250: Warn or prevent plain-text secrets and insecure configuration CAMEL-23250: Security policy enforcement with profile-aware defaults Mar 26, 2026
@gnodet gnodet marked this pull request as ready for review March 27, 2026 07:43
gnodet and others added 2 commits March 27, 2026 09:53
- CyberArkVaultConfiguration: mark authToken as secret
- IBMSecretsManagerVaultConfiguration: mark eventStreamUsername and
  eventStreamPassword as secret

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a built-in security policy enforcement mechanism that detects
insecure configuration at startup and either warns or prevents the
application from starting, depending on the configured policy.

Framework components:
- SecurityUtils and SecurityViolation in camel-util for detection logic
- SecurityConfigurationProperties for camel.security.* configuration
- SecurityPolicyResult as a CamelContext plugin for runtime access
- SecurityPolicyHealthCheck for health monitoring
- Profile-aware defaults: prod profile auto-sets policy=fail
- security attribute on @UriParam/@UriPath/@metadata annotations
- Tooling support to generate security options map from annotations

Security categories: secret, insecure:ssl, insecure:serialization,
insecure:dev. Policy levels: allow, warn (default), fail.

Annotated 60+ component options across AWS, Huawei, JMS, Netty,
HTTP, Splunk, Paho, and other components with security categories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the CAMEL-23250-security-policy-enforcement branch from 8da3b9c to c25dd5c Compare March 27, 2026 08:55
Regenerated component JSON metadata, endpoint DSL factories, and
catalog resources to reflect the new security annotations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the CAMEL-23250-security-policy-enforcement branch from c25dd5c to ca52d14 Compare March 27, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants