Project

General

Profile

Actions

Bug #1732

closed

Inconsistency in Transference of Inherited Traits ('Tainted' and 'Untrusted') with #join

Added by runpaint (Run Paint Run Run) almost 15 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-07-05 trunk 23958) [i686-linux]
Backport:
[ruby-core:24152]

Description

=begin
Array#join transfers self's taintedness and trustworthiness to its return value. If an Array is tainted, so is the concatenation of its elements:

['a'].taint.join.tainted?
=> true
['a'].untrust.join.untrusted?
=> true

However, other Enumerables with #join methods do not pass said traits to their offspring:

{'a' => 'b'}.taint.join.tainted?
=> false
{'a' => 'b'}.untrust.join.untrusted?
=> false

require 'set'
=> true
Set.new(['a','b']).taint.join.tainted?
=> false
Set.new(['a','b']).untrust.join.untrusted?
=> false

class E; include Enumerable; def initialize(*a); @e=a; end; def each; @e.each{|e| yield e}; end; end
=> nil
E.new('a','b').taint.join.tainted?
=> false
E.new('a','b').untrust.join.untrusted?
=> false
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0