Method: Object#taint
- Defined in:
- object.c
#taint ⇒ Object
Mark the object as tainted.
Objects that are marked as tainted will be restricted from various built-in methods. This is to prevent insecure data, such as command-line arguments or strings read from Kernel#gets, from inadvertently compromising the users system.
To check whether an object is tainted, use #tainted?
You should only untaint a tainted object if your code has inspected it and determined that it is safe. To do so use #untaint
In $SAFE level 3, all newly created objects are tainted and you can’t untaint objects.
950 951 952 953 954 955 956 957 958 |
# File 'object.c', line 950
VALUE
rb_obj_taint(VALUE obj)
{
if (!OBJ_TAINTED(obj)) {
rb_check_frozen(obj);
OBJ_TAINT(obj);
}
return obj;
}
|