Skip to content

Commit c3e1592

Browse files
committed
Use AccessPath and AccessPathToken more
1 parent 54a0c03 commit c3e1592

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,23 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
140140

141141
/** Provides a query predicate to check the MaD models for validation errors. */
142142
module ModelValidation {
143+
private import codeql.dataflow.internal.AccessPathSyntax as AccessPathSyntax
144+
145+
private predicate getRelevantAccessPath(string path) {
146+
summaryModel(_, _, _, _, _, _, path, _, _, _, _) or
147+
summaryModel(_, _, _, _, _, _, _, path, _, _, _) or
148+
sinkModel(_, _, _, _, _, _, path, _, _, _) or
149+
sourceModel(_, _, _, _, _, _, path, _, _, _)
150+
}
151+
152+
private module MkAccessPath = AccessPathSyntax::AccessPath<getRelevantAccessPath/1>;
153+
154+
class AccessPath = MkAccessPath::AccessPath;
155+
156+
class AccessPathToken = MkAccessPath::AccessPathToken;
157+
143158
private string getInvalidModelInput() {
144-
exists(string pred, AccessPath input, string part |
159+
exists(string pred, AccessPath input, AccessPathToken part |
145160
sinkModel(_, _, _, _, _, _, input, _, _, _) and pred = "sink"
146161
or
147162
summaryModel(_, _, _, _, _, _, input, _, _, _, _) and pred = "summary"
@@ -159,7 +174,7 @@ module ModelValidation {
159174
}
160175

161176
private string getInvalidModelOutput() {
162-
exists(string pred, string output, string part |
177+
exists(string pred, AccessPath output, AccessPathToken part |
163178
sourceModel(_, _, _, _, _, _, output, _, _, _) and pred = "source"
164179
or
165180
summaryModel(_, _, _, _, _, _, _, output, _, _, _) and pred = "summary"

0 commit comments

Comments
 (0)