mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Ruby: String.try_convert isn't value-preserving
`String.try_convert` can convert arbitrary objects to strings, which obviously isn't value-preserving.
This commit is contained in:
@@ -47,7 +47,7 @@ module String {
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[0]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = true
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,9 @@ end
|
||||
|
||||
def m_try_convert
|
||||
a = source "a"
|
||||
sink String.try_convert(a) # $ hasValueFlow=a
|
||||
b = source 1
|
||||
sink String.try_convert(a) # $ hasTaintFlow=a
|
||||
sink String.try_convert(b) # $ hasTaintFlow=1
|
||||
end
|
||||
|
||||
def m_format
|
||||
|
||||
Reference in New Issue
Block a user