CAMEL-23250: Security policy enforcement with profile-aware defaults#22269
Open
CAMEL-23250: Security policy enforcement with profile-aware defaults#22269
Conversation
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
5 tasks
oscerd
approved these changes
Mar 27, 2026
- 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>
8da3b9c to
c25dd5c
Compare
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>
c25dd5c to
ca52d14
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- SecurityViolation now carries effective policy from detection phase - RAW() no longer treated as secure (it's a URI encoding wrapper, not security) - Policy validation is case-insensitive (FAIL/Warn/allow all accepted) - Health check: DOWN only for fail-level violations, UP for warn-level - Dev profile auto-defaults insecureDevPolicy=allow - Add missing security annotations: netty (transferExchange, allowSerializedHeaders), activemq/activemq6 (trustAllPackages), 11 aggregation repositories (allowSerializedHeaders) - Forward-compatible collectSecretOption (also checks security="secret") - Add @SInCE 4.19.0 to public API classes - Comprehensive unit tests for SecurityUtils (10 tests) and expanded MainSecurityPolicyTest (32 tests) - Fix docs: RAW() note, ${sys:} escape, proposals health check status Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Built-in security policy enforcement that detects insecure configuration at startup and either warns or prevents the application from starting.
secret(plain-text passwords),insecure:ssl(disabled cert verification),insecure:serialization(Java object deserialization),insecure:dev(dev-only features in prod)allow(silent),warn(log, default),fail(block startup)prodprofile auto-setspolicy=fail;devprofile auto-setsinsecureDevPolicy=allowcamel.security.insecureSslPolicy=allowwhile global isfailcamel.security.allowedPropertiesSecurityPolicyResultaccessible as a CamelContext pluginproposals/security.adoc— full design doc for the security frameworkCommit structure (for easier review)
b0834acFix missing secret=true annotations — CyberArkauthToken, IBM Event StreamseventStreamUsername/eventStreamPassword(2 files)5c89a07Security policy enforcement framework — all new classes, tooling, component annotations, tests, docs (90 files)ca52d14Regenerate catalog and generated files — JSON metadata and endpoint DSL (423 files, reviewers can skip this commit)bfff8e6Add security design proposal and update AGENTS.md —proposals/security.adocdesign doc + area-to-proposal mapping in AGENTS.md/CLAUDE.md54ffc82Fix generated main.adoc — remove stale{zwsp}markers2674828Address review findings — carry policy in violations, RAW() as insecure, case-insensitive policy, health check fix, dev profile defaults, missing annotations on netty/activemq/aggregation repos, expanded tests (42 total), doc fixesKey files to review
Framework core:
core/camel-util/…/SecurityUtils.java— detection logic + security options mapcore/camel-util/…/SecurityViolation.java— violation record (now carries effective policy)core/camel-main/…/SecurityConfigurationProperties.java—camel.security.*config (case-insensitive policy)core/camel-main/…/SecurityPolicyResult.java— runtime result APIcore/camel-main/…/BaseMainSupport.java— enforcement wiring at startupcore/camel-main/…/ProfileConfigurer.java—prod→ fail,dev→ insecureDevPolicy=allowDesign proposal:
proposals/security.adoc— full design docTooling (annotation → generated map pipeline):
tooling/spi-annotations/…/UriParam.java— newsecurity()attributetooling/…/UpdateSensitizeHelper.java— generatesSecurityUtils.javamapHealth check:
core/camel-health/…/SecurityPolicyHealthCheck.java— DOWN for fail only, UP with details for warnTests & docs:
core/camel-main/…/MainSecurityPolicyTest.java— 32 tests covering all policy levels, categories, overrides, profiles, case-insensitivitycore/camel-util/…/SecurityUtilsTest.java— 10 unit tests for detection logicdocs/…/security.adoc— user documentationdocs/…/camel-4x-upgrade-guide-4_19.adoc— upgrade guide entryTest plan
MainSecurityPolicyTest(all policy levels, categories, overrides, profiles, case-insensitivity, multiple violations, policy carried in violations)SecurityUtilsTest(plain-text detection, getSecurityOption, isInsecureValue, detectViolations, allowed keys, null handling)mvn install -B -pl core/camel-main -DskipTests -ammvn test -B -pl core/camel-main -Dtest=MainSecurityPolicyTestmvn test -B -pl core/camel-util -Dtest=SecurityUtilsTestmvn formatter:format impsort:sortFollow-up ideas
Findings from a security audit that are not covered by this PR but could be addressed in follow-up tickets:
Near-term
Infinispan deserialization filter —
DefaultExchangeHolderUtilsusesClassLoadingAwareObjectInputStreamwithout JEP-290setObjectInputFilter(). Should add the same default filter (java.**;org.apache.camel.**;!*) used by SQL/LevelDB/Cassandra/Consul stores.TLS protocol version filtering — Splunk and Paho MQTT expose SSLv3/TLSv1 in their protocol enums. The global
SSLContextParametersdefault filtering only excludesSSL.*regex. Consider also excludingTLSv1andTLSv1.1by default.Medium-term
FIPS compliance category — The framework already supports arbitrary categories via
resolvePolicy()'sdefault → nullfallback. Addinginsecure:fipsrequires annotating non-FIPS algorithms and adding afipsPolicyfield toSecurityConfigurationProperties.SSRF mitigation — Add an optional URI whitelist mechanism for
toD/recipientListdynamic routing.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.adocwould help users make informed choices.Low priority
HTTP header CRLF validation — Add header value sanitization in
camel-http-commonto prevent header injection.MongoDB trust-all TrustManager —
SslAwareMongoClienthardcodes a trust-allTrustManager. Not trackable by the annotation framework since it's programmatic, not a@UriParam.