Using pluginmanager to remove plugins can result in deleting required gems
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 88
Description
The dependency specification for gems/plugins is shared in logstash between the logstash core gemspec and the Gemfile. The dependencies for example the plugin manager are not necessarily codified in the core gemspec. This leads to a situation where modification of the gem environment with the pluginmanager can result in a broken/damaged gem environment. For example:
```
docker run -d --name psych-bug --entrypoint sleep docker.elastic.co/logstash/logstash:9.3.6 infinity
docker exec psych-bug bin/logstash-plugin remove logstash-filter-translate
```
Note the line in the output:
```
cleaned orphaned dependency psych (5.3.1)
```
Now try to install a plugin:
```
docker exec psych-bug bin/logstash-plugin install logstash-filter-translate
```
This never completes. It prints:
```
`Error Errno::ENOENT, retrying 1/10` and then
fails with `java.lang.OutOfMemoryError: Java heap space`.
```
In this case we do not explicitly declare psych as a dependency of the pluginmanager. Instead it is relied upon by the plugin gemspec which transitively satisfies the dependency. We should audit the gemspec and Gemfile and ensure that all the dependencies for logstash and the logstash entrypoints like the pluginmanager are explicitly defined and not reliant on transitive deps from plugins as the user is able to modify their plugin env.
Contributor guide
Research direction
Start by comparing the Logstash core gemspec and Gemfile, then reproduce the Docker commands using bin/logstash-plugin to observe psych being removed. Audit dependencies for Logstash and entrypoints such as the plugin manager; done means removing a plugin does not delete required gems and installing it completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100