fix: further isolate jars/wars by ensuring gems are not loaded from user home/default locations - #648
Merged
Conversation
…ser home/defualt locations The current semantics allow RubyGems to re-calculate GEM_PATH to its default semantics which would include `Gem.default_path` which otherwise allows gems to load from a host Gem.user_dir. This is totally undesirable for warbler's purposes, which are to make jars/wars self contained - they should be able to load everything from inside the jar. There is some risk that this breaks some edge cases not properly handled by warbler, where people are installing on host to workaround issues with correct packaging of extensions, however we need to fix these issues properly without corrupting isolation by default. I think the "escape hatch" of disabling `override_gem_home` is probably enough to opt out of this, but will re-evaluate if issues are reported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current semantics allow RubyGems to re-calculate GEM_PATH to its default semantics which would include
Gem.default_pathwhich otherwise allows gems to load from a host Gem.user_dir. This is totally undesirable for warbler's purposes, which are
to make jars/wars self contained - they should be able to load everything from inside the jar.
There is some risk that this breaks some edge cases not properly handled by warbler, where people
are installing on host to workaround issues with correct packaging of extensions, however we need
to fix these issues properly without corrupting isolation by default. I think the "escape hatch" of
disabling
override_gem_homeis probably enough to opt out of this, but will re-evaluate if issuesare reported.
Note that related issues have been addressed over time via the below issues, however now Rubygems (and bundler) is more intrsinsically baked into the JRubies we support and we only officially support using Warbler via JRuby itself (not CRuby); so the approach can be simplified somewhat.