Skip to content

Restrict feature:requirement-add and feature:requirement-remove to admin role - #3042

Open
jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:restrict-feature-requirement-acl
Open

jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:restrict-feature-requirement-acl

Conversation

@jbonofre

Copy link
Copy Markdown
Member

Problem

feature:requirement-add adds a provisioning requirement that the resolver installs and starts exactly like feature:install — a bundle:<uri> requirement downloads and starts an arbitrary bundle, and a feature:<name> requirement installs that feature. feature:requirement-remove is the uninstall equivalent.

Neither command had an entry in etc/org.apache.karaf.command.acl.feature.cfg, so an SSH user with only the viewer role could reach RequirementAdd/RequirementRemove and have Karaf download, install, start or uninstall arbitrary attacker-supplied bundles and features — bypassing the admin-only ACL on feature:install, feature:uninstall and bundle:install. The installed bundle then runs with the Karaf process's authority (CWE-863).

This is the same class as the feature:repo-add -i / feature:repo-remove -u bypass fixed in #2883, on sibling commands that fix did not cover.

Fix

Gate both commands to the admin role, mirroring install/uninstall. A plain name-only rule is sufficient: unlike repo-add/repo-remove (where only -i/-u are dangerous and need an option-specific regex), requirement-add and requirement-remove mutate provisioning state on every invocation.

The ACL is updated in the three places it lives:

  • assemblies/features/standard/src/main/feature/feature.xml — the standard features descriptor that generates etc/org.apache.karaf.command.acl.feature.cfg in every distribution
  • instance/.../etc/org.apache.karaf.command.acl.feature.cfg — the copy child instances receive
  • itests/test/src/test/filtered-resources/etc/feature.xml — the itest fixture (kept in sync, as in Restrict feature:repo-add -i and feature:repo-remove -u to admin role #2883)

Scope

Testing

FeatureSshCommandSecurityTest gains testFeatureRequirementCommandSecurityViaSsh, asserting a viewer is denied both commands (surfaces as Command not found, same as feature:install) while admin is allowed. The user guide ACL section is updated.

Verified locally against a freshly rebuilt distribution:

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- FeatureSshCommandSecurityTest

…min role

feature:requirement-add adds a provisioning requirement that the
resolver installs and starts exactly like feature:install -- a
"bundle:<uri>" requirement downloads and starts an arbitrary bundle,
and a "feature:<name>" requirement installs that feature.
feature:requirement-remove is the uninstall equivalent. Neither
command had an ACL entry, so any SSH user with just the viewer role
could reach RequirementAdd/RequirementRemove and have Karaf install,
start or uninstall arbitrary attacker-supplied bundles and features,
bypassing the admin-only ACL on feature:install/feature:uninstall
(and bundle:install).

This is the same class as the feature:repo-add -i / feature:repo-remove
-u bypass fixed in apache#2883, on sibling commands that fix did not cover.

Gate both commands to the admin role, mirroring install/uninstall. A
plain name-only rule is enough: unlike repo-add/repo-remove (where only
-i/-u are dangerous and need an option-specific regex), requirement-add
and requirement-remove mutate provisioning state on every invocation.

The ACL is updated in the three places it lives: the standard features
descriptor that generates etc/org.apache.karaf.command.acl.feature.cfg
in every distribution, the copy child instances receive, and the itest
fixture. FeatureSshCommandSecurityTest gains a method asserting a viewer
is denied both commands while admin is allowed, and the user guide is
updated.
@github-actions

Copy link
Copy Markdown

Test Results

  729 files  ±0    729 suites  ±0   1h 4m 6s ⏱️ + 1m 9s
1 079 tests +1    945 ✅ +1  134 💤 ±0  0 ❌ ±0 
3 237 runs  +3  2 835 ✅ +3  402 💤 ±0  0 ❌ ±0 

Results for commit 0514e55. ± Comparison against base commit 05aa121.

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