Project

General

Profile

Bug #14075

File.dirname("path without dir".taint) returns untainted string

Added by znz (Kazuhiro NISHIYAMA) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:83646]

Description

Is this intentional?

% ruby -e 'p [File.dirname("foo/bar".taint).tainted?, File.dirname("hoge".taint).tainted?]'
[true, false]

History

Updated by hkdnet (Ko Sato) over 1 year ago

I found that File.split also returns untainted string with a tainted argument.

$ ruby -e 'p File.split("foo/bar".taint).map(&:tainted?); p File.split("hoge".taint).map(&:tainted?)'
[true, true]
[false, true]
#2

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

I think it is intended.
dirname for a path without directory is ".", and this does not come from the argument string.

Also available in: Atom PDF