jbonofre opened a new pull request, #3071: URL: https://github.com/apache/karaf/pull/3071
## Summary Backport of #3042 to `karaf-4.4.x`. - `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 the `feature` scope's command ACL, 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 already enforced 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 #2883 / #2884, 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. - Applied identically in the three places the `feature` ACL is defined on this branch: the standard assembly `feature.xml` (generates `etc/org.apache.karaf.command.acl.feature.cfg`), the `instance` `etc` template child instances receive, and the itest config fixture. - Adds `FeatureSshCommandSecurityTest#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. - There is **no JMX counterpart** — `FeaturesServiceMBean` exposes no `requirement-*` operation, so nothing to gate there. The only difference from the `main` commit is an added `import org.junit.Assume;` in `FeatureSshCommandSecurityTest`: on `karaf-4.4.x` the other methods in that test do not use `Assume`, so it was not already imported. ## Test plan - [x] `mvn -pl itests/test test-compile` passes (JDK 11) - [ ] Full PaxExam SSH itest suite (`itests/test`) run in CI -- 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]
