Skip to content

Commit ab2d6f7

Browse files
committed
Ruby: Exclude vendored library parameters from taint sources.
1 parent d045392 commit ab2d6f7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • ruby/ql/lib/codeql/ruby/frameworks/core

ruby/ql/lib/codeql/ruby/frameworks/core/Gem.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ module Gem {
9090
result = this.getAPublicModule().getStmt(_).(SingletonClass)
9191
}
9292

93+
/** Holds if this gem is vendored in this codebase. */
94+
predicate isVendored() { File.super.getParentContainer+().getBaseName() = "vendor" }
95+
9396
/** Gets a parameter from an exported method, which is an input to this gem. */
9497
DataFlow::ParameterNode getAnInputParameter() {
9598
exists(MethodBase method |
@@ -107,6 +110,7 @@ module Gem {
107110
DataFlow::ParameterNode getALibraryInput() {
108111
exists(GemSpec spec |
109112
exists(spec.getName()) and // we only consider `.gemspec` files that have a name
113+
not spec.isVendored() and // if the gem is vendored its parameters are not external inputs
110114
result = spec.getAnInputParameter()
111115
)
112116
}

0 commit comments

Comments
 (0)