开发者

how can I load a file while $SAFE = 1

开发者 https://www.devze.com 2023-01-30 07:11 出处:网络
I am attempting to get the following to work fi开发者_运维问答lename = File.expand_path(\"./script\")

I am attempting to get the following to work

fi开发者_运维问答lename = File.expand_path("./script")
filename.taint
$SAFE = 1
load(filename)

From what I understand this should work based on the ruby documentation. However I receive

 `load': Insecure operation - load (SecurityError)

I am obviously missing something but I can't figure out what it is.


Turns out I didn't pay enough attention to the documentation

filename = File.expand_path("./script.rb")
puts filename.untaint
$SAFE = 1
load(filename)
0

精彩评论

暂无评论...
验证码 换一张
取 消