[ruby-core:96254] Re: [Ruby master Feature#16131] Remove $SAFE, taint and trust

Eric Wong <[email protected]>
Newsgroups gmane.comp.lang.ruby.core
Message-ID <20191216031055.GA7227@dcvr>
> https://bugs.ruby-lang.org/issues/16131

"curses" gem needs to be updated, I emailed Shugo about it a few
weeks ago but no response.  See attached patch.
(I don't use JavaScript or agree to GitHub Terms of Service).

For C extensions, I recommend just deprecating with a
compile-time warning in C, NOT runtime.  Regular Ruby users
installing C ext gems may not be able to do anything about it.


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
0001-drop-rb_safe_level-check.patch (text/x-diff, 2.5 KB)
From d316c4345524ea73de437a4a6900a2de9a339775 Mon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Sat, 30 Nov 2019 01:45:21 +0000
Subject: [PATCH] drop rb_safe_level check

Current version of Ruby 2.7.0dev constantly warns about
rb_safe_level being deprecated.
---
 ext/curses/curses.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index c70ea62..78284ec 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -221,8 +221,6 @@ no_window(void)
 }
 
 #define GetWINDOW(obj, winp) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted window");\
     TypedData_Get_Struct((obj), struct windata, &windata_type, (winp));\
     if ((winp)->window == 0) no_window();\
 } while (0)
@@ -1448,8 +1446,6 @@ no_mevent(void)
 }
 
 #define GetMOUSE(obj, data) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted mouse");\
     TypedData_Get_Struct((obj), struct mousedata, &mousedata_type, (data));\
     if ((data)->mevent == 0) no_mevent();\
 } while (0)
@@ -3044,8 +3040,6 @@ no_item(void)
 }
 
 #define GetITEM(obj, itemp) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted item");\
     TypedData_Get_Struct((obj), struct itemdata, &itemdata_type, (itemp));\
     if ((itemp)->item == 0) no_item();\
 } while (0)
@@ -3244,8 +3238,6 @@ no_menu(void)
 }
 
 #define GetMENU(obj, menup) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted menu");\
     TypedData_Get_Struct((obj), struct menudata, &menudata_type, (menup));\
     if ((menup)->menu == 0) no_menu();\
 } while (0)
@@ -3716,8 +3708,6 @@ no_field(void)
 }
 
 #define GetFIELD(obj, fieldp) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted field");\
     TypedData_Get_Struct((obj), struct fielddata, &fielddata_type, (fieldp));\
     if ((fieldp)->field == 0) no_field();\
 } while (0)
@@ -4163,8 +4153,6 @@ no_form(void)
 }
 
 #define GetFORM(obj, formp) do {\
-    if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted form");\
     TypedData_Get_Struct((obj), struct formdata, &formdata_type, (formp));\
     if ((formp)->form == 0) no_form();\
 } while (0)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.