mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Ruby: fix another SystemCommandExecution::isShellInterpreted implementation
This commit is contained in:
@@ -62,9 +62,9 @@ module PosixSpawn {
|
||||
// is shell interpreted unless there is another argument with a string
|
||||
// constant value.
|
||||
override predicate isShellInterpreted(DataFlow::Node arg) {
|
||||
this.argument(arg) and
|
||||
not exists(DataFlow::Node otherArg |
|
||||
otherArg != arg and
|
||||
this.argument(arg) and
|
||||
this.argument(otherArg) and
|
||||
otherArg.asExpr().getConstantValue().isString(_)
|
||||
)
|
||||
|
||||
@@ -5,11 +5,13 @@ import codeql.ruby.DataFlow
|
||||
query predicate systemCalls(
|
||||
PosixSpawn::SystemCall call, DataFlow::Node arg, boolean shellInterpreted
|
||||
) {
|
||||
arg = call.getAnArgument() and
|
||||
if call.isShellInterpreted(arg) then shellInterpreted = true else shellInterpreted = false
|
||||
call.isShellInterpreted(arg) and shellInterpreted = true
|
||||
or
|
||||
not call.isShellInterpreted(arg) and arg = call.getAnArgument() and shellInterpreted = false
|
||||
}
|
||||
|
||||
query predicate childCalls(PosixSpawn::ChildCall call, DataFlow::Node arg, boolean shellInterpreted) {
|
||||
arg = call.getAnArgument() and
|
||||
if call.isShellInterpreted(arg) then shellInterpreted = true else shellInterpreted = false
|
||||
call.isShellInterpreted(arg) and shellInterpreted = true
|
||||
or
|
||||
not call.isShellInterpreted(arg) and arg = call.getAnArgument() and shellInterpreted = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user