safe_ruby icon indicating copy to clipboard operation
safe_ruby copied to clipboard

Fix for ruby 3.3.0

Open mattlindsey opened this issue 1 year ago • 7 comments

Fixes #4

Commenting out line 45 in method_whitelist.rb fixes the problem, but I don't understand enough to know if that is a valid fix.
It may certainly break something, so does anyone have any ideas?

Also, I just tried other examples like SafeRuby.eval('system("rm *")') and seem to still be getting the marshal file error, so it might be a different problem...

mattlindsey avatar Feb 16 '24 19:02 mattlindsey

@theycallmeswift Do you have merge authority to the repo? :)

andreibondarev avatar Feb 16 '24 19:02 andreibondarev

There are still issues since following test works for ruby 2.x.x but gives marshal file error in > 3.0.0:

expect(SafeRuby.eval("x = String.new('zzz')")).to eq 'zzz'

mattlindsey avatar Feb 17 '24 13:02 mattlindsey

Sorry all, I'm not really maintaining this library anymore. Happy to transfer it to someone else who would take better care of it :)

ukutaht avatar Feb 19 '24 08:02 ukutaht

Alternatively, feel free to fork

ukutaht avatar Feb 19 '24 08:02 ukutaht

Changes required to make this work.

  1. Fork and Change all Marshal to YAML
  2. Add this in an initializer
module YAML
    class << self
      alias_method :load, :unsafe_load
    end
end

It will work

ausangshukla avatar Apr 08 '24 15:04 ausangshukla

@ausangshukla have to disagree.

Marshall is working fine for me under Ruby 3.3.0 and 3.3.2.

I have pulled this code into my own library folder and run the specs, and they all pass.

the existing changes in this PR seem at a glance to be sufficient.

It would be great if someone had the bandwidth to take this over and add a tests workflow as it's hard to keep track of changes versus test success.

merefield avatar Jun 04 '24 11:06 merefield

I have forked on gitlab/defmastership with a mirror on github

  • merged https://github.com/mattlindsey/safe_ruby/tree/update-deps to fix issue #4
  • add a GitLab CI/CD (I don't know GitHub actions, and i'm fluent with Gitlab CICD :) )
  • add some rubocop inspection and most rubocop remarks fixes.

I agree to take the lead on this Gem... and push a fixed 1.0.5 on rubygems.org

@ukutaht let me know if you agree.

jeromeag avatar Aug 02 '24 13:08 jeromeag