Skip to content

Warn on access/modify of $SAFE, and remove effects of modifying $SAFE#2476

Merged
jeremyevans merged 12 commits intoruby:masterfrom
jeremyevans:safe-warn
Nov 17, 2019
Merged

Warn on access/modify of $SAFE, and remove effects of modifying $SAFE#2476
jeremyevans merged 12 commits intoruby:masterfrom
jeremyevans:safe-warn

Conversation

@jeremyevans
Copy link
Copy Markdown
Contributor

This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd. We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.

This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Ruby 2.7 deprecates taint and it no longer has an effect.
Ruby 2.7 deprecates taint and it no longer has an effect.
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

Still untaint the tmpdir object on Ruby <2.7, as returning
a tainted string there could cause problems.
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
rb_eval_cmd takes a safe level, and now that $SAFE is deprecated,
it should be deprecated as well.

Replace with rb_eval_cmd_kw, which takes a keyword flag.  Switch
the two callers to this function.
@jeremyevans jeremyevans merged commit 4c7dc9f into ruby:master Nov 17, 2019
@jeremyevans jeremyevans deleted the safe-warn branch November 17, 2019 23:00
kamipo added a commit to kamipo/sqlite3-ruby that referenced this pull request Nov 21, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

https://buildkite.com/rails/rails/builds/65054#5aa2db21-569d-4202-99cd-a8323cab583e/6-8
kamipo added a commit to kamipo/ruby-pg that referenced this pull request Nov 21, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

https://buildkite.com/rails/rails/builds/65054#14bdbd8c-d935-4b80-8842-c81266a1a34e/6-8
kamipo added a commit to kamipo/tzinfo that referenced this pull request Nov 21, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

https://buildkite.com/rails/rails/builds/65069#dddcc2a1-a23c-4bc2-9eaf-351295244d1f/991-993
kamipo added a commit to kamipo/mysql2 that referenced this pull request Nov 21, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
kamipo added a commit to kamipo/tzinfo that referenced this pull request Nov 24, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

This is an alternative of tzinfo#108.
sodabrew pushed a commit to brianmario/mysql2 that referenced this pull request Dec 1, 2019
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
BrianHawley added a commit to BrianHawley/rbtree3 that referenced this pull request Jan 19, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

The format of Proc inspect has changed too. Adjusted the affected test.

[Fixes kyrylo#6]
BrianHawley added a commit to BrianHawley/rbtree3 that referenced this pull request Jan 19, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

The format of Proc inspect has changed too. Adjusted the affected test.

[Fixes kyrylo#6]
BrianHawley added a commit to BrianHawley/rbtree3 that referenced this pull request Jan 19, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

The format of Proc inspect has changed too. Adjusted the affected test.

[Fixes kyrylo#6]
BrianHawley added a commit to BrianHawley/rbtree3 that referenced this pull request Jan 20, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned with deprecation messages.

The format of Proc inspect has changed too. Adjusted the affected test.

[Fixes kyrylo#6]
snehaso pushed a commit to fac/mysql2 that referenced this pull request Jan 21, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
snehaso pushed a commit to fac/mysql2 that referenced this pull request Jan 21, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
snehaso pushed a commit to fac/mysql2 that referenced this pull request Jan 22, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
snehaso pushed a commit to fac/mysql2 that referenced this pull request Jan 22, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.
rangeroob pushed a commit to rangeroob/sqlite3-ruby-static that referenced this pull request Apr 12, 2020
The Ruby core team decided to deprecate the taint mechanism in Ruby 2.7
and will remove that in Ruby 3.

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

In Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always
considered untainted), and are now warned deprecation message.

https://buildkite.com/rails/rails/builds/65054#5aa2db21-569d-4202-99cd-a8323cab583e/6-8
(cherry picked from commit 0894fba)
raj-sharan added a commit to raj-sharan/ruby-odbc that referenced this pull request Jul 3, 2023
The taint mechanism was deprecated in Ruby 2.7 and removed in Ruby 3.0
    
https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476
    
From Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always considered untainted), and are now removed.
raj-sharan added a commit to raj-sharan/ruby-odbc that referenced this pull request Jul 3, 2023
The taint mechanism was deprecated in Ruby 2.7 and removed in Ruby 3.0

https://bugs.ruby-lang.org/issues/16131
ruby/ruby#2476

From Ruby 2.7, `Object#{taint,untaint,trust,untrust}` and related
functions in the C-API no longer have an effect (all objects are always considered untainted), and are now removed.

Changes taken from https://github.com/vhermecz/ruby-odbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant