Skip to content

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

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

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

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 26, 2026

Summary

Adds a security policy enforcement system that detects insecure configuration at startup and warns or prevents the application from starting.

Reviewer note: This PR touches 570 files but most are auto-generated metadata. The key files to review are listed below with direct links.

Key Files to Review

Core implementation (new files):

Integration points (modified files):

Annotation definitions (3 attributes added: security(), insecureValue()):

Build tooling (reads annotations, generates SecurityUtils map):

Tests:

Documentation:

  • security.adoc — "Security Policy Enforcement" section (near end of file)

What can be skipped during review

  • catalog/camel-catalog/src/generated/ — regenerated component JSON metadata (bulk of the diff)
  • dsl/camel-endpointdsl/src/generated/ — regenerated endpoint DSL factories
  • core/camel-main/src/generated/ — regenerated configurer and metadata JSON
  • components/*/src/generated/ — regenerated per-component JSON
  • Component annotation changes (57+ files, all 1-3 line additions of security = "insecure:ssl" etc.) — mechanical, can be spot-checked

Features

  • Security policy enforcement with configurable policies (allow/warn/fail) under camel.security.* namespace
  • Security categories: secret, insecure:ssl, insecure:serialization, insecure:dev
  • Profile-aware defaults: camel.main.profile=prod defaults to fail; dev/test keep warn (overridable)
  • Property allowlist: camel.security.allowedProperties to exclude specific properties
  • Plain-text secret detection: flags passwords/tokens not using RAW(), {{vault:...}}, ${env:...}, or {{...}}
  • Health check: SecurityPolicyHealthCheck readiness check reports violations at runtime
  • Context plugin: SecurityPolicyResult for programmatic access to violations
  • Annotation-driven: security and insecureValue attributes on @UriParam/@Metadata/@UriPath — build tools auto-generate the tracking map

Annotated Components (57+)

  • SSL/TLS: trustAllCertificates, hostnameVerification, validateCertificates, ignoreSslVerification — AWS (37), Netty, Splunk, Paho MQTT, Huawei Cloud (7), core SSL
  • Serialization: allowJavaSerializedObject, transferException, transferExchange, allowSerializedHeaders — JMS, Netty, Mina, HTTP
  • Dev features: devConsoleEnabled, uploadEnabled, downloadEnabled, sendEnabled — management server

Test plan

  • 25 tests in MainSecurityPolicyTest covering all policy levels, categories, overrides, allowlist, placeholders, context plugin, profile-aware defaults
  • Build and verify with JDK 17, 21, 25
  • Regenerated catalog, SecurityUtils, endpoint DSL, and all generated files

…ation

- Add security policy enforcement with configurable policies (allow/warn/fail)
  under the camel.security.* namespace
- Add `security` and `insecureValue` attributes to @metadata, @UriParam, @UriPath
  annotations to categorize security-sensitive options
- Deprecate `secret` attribute in favor of `security="secret"`
- Introduce security categories: secret, insecure:ssl, insecure:serialization,
  insecure:dev
- Create SecurityUtils utility for detecting insecure configuration values
  and plain-text secrets
- Create SecurityConfigurationProperties for per-category policy configuration
  with property-level allowlist overrides
- Annotate insecure properties across 50+ components (AWS trustAllCertificates,
  JMS transferException, Netty hostnameVerification, etc.)
- Fix DevConsole JSON output to mask sensitive values (was only masked in text)
- Extend build tooling (EndpointSchemaGeneratorMojo, SchemaGeneratorMojo,
  PackageLanguageMojo, GeneratePojoBeanMojo) to process new annotations
- Extend UpdateSensitizeHelper to generate SecurityUtils from catalog metadata
- Add comprehensive tests for security policy enforcement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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.

Regenerated all component JSON catalogs, endpoint DSL, component DSL,
and SecurityUtils after full build. The generated files now include
the new `security` field in component option metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet and others added 4 commits March 26, 2026 08:55
…nd docs

- Fix camel.security.* property prefix mapping and group registration
- Add policy value validation (allow/warn/fail only)
- Annotate camel-mina and camel-hazelcast transferExchange as insecure:serialization
- Add insecure:dev annotation to devConsoleEnabled in DefaultConfigurationProperties
- Fix insecure:dev options generation via EXTRA_SECURITY_OPTIONS in UpdateSensitizeHelper
- Improve warning message to suggest vault/env/placeholder instead of RAW()
- Add comprehensive tests for insecure:ssl, insecure:dev, and policy validation
- Add Security Policy Enforcement documentation section
- Regenerate all downstream artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add SecurityViolation record in camel-util for shared violation representation
- Add SecurityUtils.detectViolations() shared utility method
- Refactor BaseMainSupport.enforceSecurityPolicies() to use shared utility
- Add SecurityPolicyResult context plugin for runtime access to violations
- Add SecurityPolicyHealthCheck in camel-health (readiness check)
- Add getAllowedPropertySet() to SecurityConfigurationProperties
- Add tests for detectViolations(), SecurityPolicyResult context plugin
- Spring Boot: verified SecurityConfigurationPropertiesConfigurer generation,
  service loader registration, and camel.security.* metadata prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add @UriParam(security="insecure:ssl") to ignoreSslVerification properties
across all 7 Huawei cloud components (OBS, SMN, DMS, FRS, FunctionGraph,
IAM, ImageRecognition). Regenerate catalog and SecurityUtils.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the dsl label Mar 26, 2026
When camel.main.profile=prod, the global security policy defaults to
"fail" so production applications refuse to start with insecure
configurations. Users can override via camel.security.policy=warn.
Dev and test profiles keep the default "warn" behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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
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