Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jb1/improper array index #58

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ predicate predictableInstruction(Instruction instr) {
}

module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { isFlowSource(source, _) }
predicate isSource(DataFlow::Node source) {
isFlowSource(source, _) and
not source.getLocation().getFile().getRelativePath().regexpMatch("(.*/)?tests?/.*")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not have other ways of doing this (like some kind of filtering from Liquid post sarif generation)? If not, that's kind of crazy because we would need to add something like this to all of our queries, right? Or am I missing something

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and usually we wouldn't make such a change and just use the post-analysis finding filtering, however if a CodeQL rule generates over 2GB of data for an individual rule, the CLI will throw an exception and not complete and we are seeing instances of this. More detail in DM.

}

predicate isBarrier(DataFlow::Node node) {
hasUpperBound(node.asExpr())
Expand Down Expand Up @@ -117,7 +120,8 @@ module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
module ImproperArrayIndexValidation = TaintTracking::Global<ImproperArrayIndexValidationConfig>;

from
ImproperArrayIndexValidation::PathNode source, ImproperArrayIndexValidation::PathNode sink,
ImproperArrayIndexValidation::PathNode source,
ImproperArrayIndexValidation::PathNode sink,
string sourceType
where
ImproperArrayIndexValidation::flowPath(source, sink) and
Expand Down