Skip to content

CAMEL-24218: Add Security-First execution layer to Camel JBang MCP Server - #25046

Closed
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:worktree-camel-24218-mcp-security
Closed

CAMEL-24218: Add Security-First execution layer to Camel JBang MCP Server#25046
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:worktree-camel-24218-mcp-security

Conversation

@oscerd

@oscerd oscerd commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Security-First execution layer to the Camel JBang MCP Server via a CDI interceptor, covering:

  • Access control: role-based tool access (readonly / readwrite / admin) based on existing @Tool.Annotations hints
  • Audit logging: structured logging of all tool invocations (caller, args, outcome, duration) to camel.mcp.audit category
  • Output sanitization: redacts passwords, tokens, AWS access keys, and bearer tokens from JsonObject tool responses
  • Configuration: all settings exposed via standard Quarkus/MicroProfile Config properties

New classes

Class Purpose
McpAccessLevel Enum defining three access levels with tool-allow logic
McpSecured CDI @InterceptorBinding annotation
McpSecurityInterceptor Enforces access policy, logs audit trail, redacts secrets
McpSecurityConfig Quarkus config properties (@ConfigProperty)
McpAuditLog Structured audit logging service
OutputSanitizer Pattern-based secret redaction for tool output

Configuration properties

Property Default Description
camel.mcp.security.access-level admin readonly, readwrite, or admin
camel.mcp.security.audit.enabled false Log every tool invocation
camel.mcp.security.redact-secrets true Redact credentials in output

All 19 tool classes annotated with @McpSecured.

Test plan

  • McpAccessLevelTest — parsing, tool-allow logic for all three levels
  • OutputSanitizerTest — JSON key redaction, bearer tokens, AWS keys, generic patterns, null safety
  • All 323 existing MCP server tests pass (no regressions)

Claude Code on behalf of oscerd

🤖 Generated with Claude Code

…rver

Adds access control, audit logging, and output sanitization for the
MCP server's 63 tools via a CDI interceptor.

New classes:
- McpAccessLevel: enum (readonly/readwrite/admin) controlling tool visibility
- McpSecured: CDI interceptor binding annotation
- McpSecurityInterceptor: enforces access policy, logs audit trail, redacts secrets
- McpSecurityConfig: Quarkus config properties for security settings
- McpAuditLog: structured audit logging to 'camel.mcp.audit' category
- OutputSanitizer: redacts passwords, tokens, AWS keys from tool output

All 19 tool classes annotated with @McpSecured. Configuration via:
- camel.mcp.security.access-level (readonly|readwrite|admin, default: admin)
- camel.mcp.security.audit.enabled (default: false)
- camel.mcp.security.redact-secrets (default: true)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd closed this Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-mcp

🔬 Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 1 all tested

Maveniverse Scalpel detected 1 affected modules (current approach: 1).

Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules)

Modules Scalpel would test (1)
  • camel-jbang-mcp

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-mcp: 1 test(s) disabled on GitHub Actions

⚙️ View full build and test results

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