This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-16
lines changed Expand file tree Collapse file tree 1 file changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,32 @@ def ignoring_warnings
14
14
result
15
15
end
16
16
17
- def with_safe_set_to_level_that_triggers_security_errors
18
- result = nil
17
+ # In Ruby 2.7 taint was removed and has no effect, whilst SAFE warns that it
18
+ # has no effect and will become a normal varible in 3.0.
19
+ if RUBY_VERSION >= '2.7'
20
+ def with_safe_set_to_level_that_triggers_security_errors
21
+ yield
22
+ end
23
+ else
24
+ def with_safe_set_to_level_that_triggers_security_errors
25
+ result = nil
19
26
20
- orig_safe = $SAFE
21
- Thread . new do
22
- ignoring_warnings { $SAFE = SAFE_LEVEL_THAT_TRIGGERS_SECURITY_ERRORS }
23
- result = yield
24
- end . join
27
+ orig_safe = $SAFE
28
+ Thread . new do
29
+ ignoring_warnings { $SAFE = SAFE_LEVEL_THAT_TRIGGERS_SECURITY_ERRORS }
30
+ result = yield
31
+ end . join
25
32
26
- # $SAFE is not supported on Rubinius
27
- # In Ruby 2.6, $SAFE became a global variable; previously it was local to a thread.
28
- unless defined? ( Rubinius ) || SAFE_IS_GLOBAL_VARIABLE
29
- # $SAFE should not have changed in this thread.
30
- expect ( $SAFE) . to eql orig_safe
31
- end
33
+ # $SAFE is not supported on Rubinius
34
+ # In Ruby 2.6, $SAFE became a global variable; previously it was local to a thread.
35
+ unless defined? ( Rubinius ) || SAFE_IS_GLOBAL_VARIABLE
36
+ # $SAFE should not have changed in this thread.
37
+ expect ( $SAFE) . to eql orig_safe
38
+ end
32
39
33
- result
34
- ensure
35
- $SAFE = orig_safe if orig_safe && SAFE_IS_GLOBAL_VARIABLE
40
+ result
41
+ ensure
42
+ $SAFE = orig_safe if orig_safe && SAFE_IS_GLOBAL_VARIABLE
43
+ end
36
44
end
37
45
end
You can’t perform that action at this time.
0 commit comments