jbonofre opened a new pull request, #3042: URL: https://github.com/apache/karaf/pull/3042
## 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 #2883) ## Scope - There is **no JMX counterpart** — `FeaturesServiceMBean` exposes no `requirement-*` operation, so nothing to gate there. - Read-only (`requirement-list`) and non-install commands are left open, keeping the change tightly scoped like #2883. ## 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 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
