Skip to content

Commit e6d245d

Browse files
committed
Shared, rust: Add option to disable reads steps as taint steps in model generator
1 parent 17f8c67 commit e6d245d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rust/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ module ModelGeneratorCommonInput implements
113113
c.(SingletonContentSet).getContent() instanceof ElementContent
114114
}
115115

116+
predicate applyReadStepsAsTaintSteps() { none() }
117+
116118
string partialModelRow(Callable api, int i) { i = 0 and result = api.getCanonicalPath() }
117119

118120
string partialNeutralModelRow(Callable api, int i) { result = partialModelRow(api, i) }

shared/mad/codeql/mad/modelgenerator/internal/ModelGeneratorImpl.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ signature module ModelGeneratorCommonInputSig<LocationSig Location, InputSig<Loc
115115
*/
116116
predicate containerContent(Lang::ContentSet c);
117117

118+
/** Holds if read steps should heuristically be applied as taint steps. */
119+
default predicate applyReadStepsAsTaintSteps() { any() }
120+
118121
/**
119122
* Gets the parameter position of the return kind, if any.
120123
*/
@@ -1061,6 +1064,7 @@ module MakeModelGeneratorFactory<
10611064
private predicate isRelevantTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
10621065
exists(DataFlow::ContentSet f |
10631066
DataFlow::readStep(node1, f, node2) and
1067+
applyReadStepsAsTaintSteps() and
10641068
// Partially restrict the content types used for intermediate steps.
10651069
(not exists(getUnderlyingContentType(f)) or isRelevantTypeInContent(f))
10661070
)

0 commit comments

Comments
 (0)