Skip to content

fix(jdbc,jms): add command ACLs for the jdbc and jms scopes (karaf-4.4.x) - #2863

Open
jbonofre wants to merge 1 commit into
apache:karaf-4.4.xfrom
jbonofre:command-acl-jdbc-jms-karaf-4.4.x
Open

fix(jdbc,jms): add command ACLs for the jdbc and jms scopes (karaf-4.4.x)#2863
jbonofre wants to merge 1 commit into
apache:karaf-4.4.xfrom
jbonofre:command-acl-jdbc-jms-karaf-4.4.x

Conversation

@jbonofre

@jbonofre jbonofre commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem

The jdbc and jms command scopes ship no org.apache.karaf.command.acl.* configuration. Karaf's command guard treats a command with no matching ACL entry as allowed, so any authenticated shell user — viewer role included — can run every jdbc:* and jms:* command.

jdbc:ds-create / jms:create store a user-supplied URL into a pax-jdbc-config / pax-jms-config factory configuration that is turned into a live DataSource / ConnectionFactory. Several JDBC drivers execute code at connection time based on URL parameters (for instance H2 INIT=RUNSCRIPT), making datasource creation equivalent to arbitrary code execution. jdbc:execute / jdbc:query run arbitrary SQL, and jms:send / jms:consume / jms:move write to or destructively drain broker destinations.

This is the same class of gap as #2861 / #2862 (config:install), and lets a low-privilege user bypass the admin requirement that already protects shell:exec.

Fix

Add an ACL for each scope, provided by the jdbc / jms feature via a <config> element under a shell conditional (same mechanism as the kar and maven scopes):

scope admin viewer
jdbc ds-create, ds-delete, execute, query ds-list, ds-info, ds-factories, tables
jms create, delete, send, consume, move connectionfactories, info, queues, topics, count, browse

Consistent with shell:exec and config:install, already restricted to admin.

Notes

  • The JMX side is already covered by the generic etc/jmx.acl.cfg (* = admin).
  • No URL blocklist is added: it is trivially bypassable and INIT etc. can be legitimate for an admin. The ACL is the trust boundary.

Tests

  • JdbcSshCommandSecurityTest and JmsSshCommandSecurityTest — verify a viewer and a manager cannot see the admin-only commands while karaf can, over SSH.
  • Manual updated (user-guide/security.adoc).

The jdbc and jms command scopes had no org.apache.karaf.command.acl.*
configuration. The command guard treats an unmatched command as allowed,
so any authenticated shell user (viewer role included) could run every
jdbc:* and jms:* command.

jdbc:ds-create and jms:create store a user-supplied URL into a
pax-jdbc-config / pax-jms-config factory configuration that is turned
into a live DataSource / ConnectionFactory. Several JDBC drivers run
code at connection time based on URL parameters (for instance H2
INIT=RUNSCRIPT), so creating a datasource is equivalent to arbitrary
code execution. jdbc:execute / jdbc:query run arbitrary SQL, and
jms:send / jms:consume / jms:move write to or destructively drain
broker destinations.

Add an ACL for each scope, provided by the jdbc / jms feature via a
<config> element under a shell conditional (same mechanism as the kar
and maven scopes):

  jdbc: ds-create, ds-delete, execute, query = admin;
        ds-list, ds-info, ds-factories, tables = viewer
  jms:  create, delete, send, consume, move = admin;
        connectionfactories, info, queues, topics, count, browse = viewer

This is consistent with shell:exec and config:install, which are
already restricted to admin. Add SSH command security itests for both
scopes.
@jbonofre jbonofre changed the title fix(jdbc,jms): add command ACLs for the jdbc and jms scopes fix(jdbc,jms): add command ACLs for the jdbc and jms scopes (karaf-4.4.x) Sep 8, 2026
@jbonofre
jbonofre force-pushed the command-acl-jdbc-jms-karaf-4.4.x branch from 5efcc18 to 4690b92 Compare September 8, 2026 17:43
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results

  660 files  +4    660 suites  +4   1h 10m 17s ⏱️ + 9m 15s
1 008 tests +2    962 ✅  - 1   43 💤 ±0  0 ❌ ±0  3 🔥 +3 
2 754 runs  +4  2 628 ✅  - 2  120 💤 ±0  0 ❌ ±0  6 🔥 +6 

For more details on these errors, see this check.

Results for commit 4690b92. ± Comparison against base commit 2880f87.

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