Safer loading for translation repositories#97
Open
renchap wants to merge 1 commit intogrosser:masterfrom
Open
Conversation
- Do not use a relative path for require, as it fails with safe mode enabled. - Check the repository type against a whitelist of existing repositories This fixes the two specs marked as pending on Ruby 2.x
grosser
reviewed
Aug 17, 2017
|
|
||
| class_name = type.to_s.split('_').map(&:capitalize).join | ||
| unless FastGettext::TranslationRepository.constants.map{|c|c.to_s}.include?(class_name) | ||
| require "fast_gettext/translation_repository/#{type}" |
Owner
|
being able to load any kind of backend was meant as a feature ... |
Contributor
Author
|
A I think this may be a bug in rubygems similar to ruby/rubygems#1265 |
Owner
|
That was merged ... so upgrade rubygems ?
ruby/rubygems#1268
…On Thu, Aug 17, 2017 at 9:15 AM, Renaud Chaput ***@***.***> wrote:
A SecurityError is raised when using require "fast_gettext/translation_
repository/#{type}".untaint.
I think this may be a bug in rubygems similar to ruby/rubygems#1265
<ruby/rubygems#1265>
I need to investigate further why this is happening if relying on
$LOAD_PATH is wanted.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAsZ9ty2tWuQDVBXwVPVTXK3LhTnUu1ks5sZGcTgaJpZM4O5_C_>
.
|
Contributor
Author
|
Yes this one has been merged, but the problem still occurs with a recent Rubygem. |
Owner
|
... silly workaround would be to not allow outside loading if running in
safe mode ?
... should be good enough for the 99% case ...
…On Thu, Aug 17, 2017 at 9:31 AM, Renaud Chaput ***@***.***> wrote:
Yes this one has been merged, but the problem still occurs with a recent
Rubygem.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAsZzdimS60MlM9ctzmtzkfhzrKwRenks5sZGrtgaJpZM4O5_C_>
.
|
Contributor
Author
|
I will try to debug it and find out the real cause |
ddd5db9 to
eb5d893
Compare
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.
This fixes the two specs marked as pending on Ruby 2.x.
I am not 100% sure here about the relative path. Are there some wanted cases where the previous require will require another file when using the
LOAD_PATH?__dir__and%i[]are only available in Ruby 2.x. I do not think this will be a problem.