taint-checking

What are tainted objects, and when should we untaint them?

試著忘記壹切 提交于 2019-12-04 08:25:10
问题 When do Ruby objects need to be made tainted and when should we untaint them? How does the concept of tainted object make a Ruby script run in safe mode? Can anyone elaborate on this to make the concept clear with some code snippets? 回答1: What is Tainted? User input is tainted, by definition. For example: string = gets string.tainted? # => true You can also manually taint an object. string = 'Not yet tainted.' string.tainted? # => false (string = 'Explicitly taint me!').taint string.tainted?

What are tainted objects, and when should we untaint them?

坚强是说给别人听的谎言 提交于 2019-12-02 23:03:26
When do Ruby objects need to be made tainted and when should we untaint them? How does the concept of tainted object make a Ruby script run in safe mode? Can anyone elaborate on this to make the concept clear with some code snippets? What is Tainted? User input is tainted, by definition. For example: string = gets string.tainted? # => true You can also manually taint an object. string = 'Not yet tainted.' string.tainted? # => false (string = 'Explicitly taint me!').taint string.tainted? # => true Why Untaint an Object? Generally, you would untaint an object only after you validate and/or