Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 8a306af

Browse files
Sauyon Leesmowton
authored andcommitted
Make HTTP::ResponseWriter handle PostUpdateNodes in getANode
1 parent 3817ae8 commit 8a306af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ql/src/semmle/go/Concepts.qll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,12 @@ module HTTP {
366366
* extend `HTTP::ResponseWriter` instead.
367367
*/
368368
abstract class Range extends Variable {
369-
/** Gets a data-flow node that is a use of this response writer. */
369+
/**
370+
* Gets a data-flow node that is a use of this response writer.
371+
*
372+
* Note that `PostUpdateNode`s for nodes that this predicate gets do not need to be
373+
* included, as they are handled by the concrete `ResponseWriter`'s `getANode`.
374+
*/
370375
abstract DataFlow::Node getANode();
371376
}
372377
}
@@ -392,7 +397,10 @@ module HTTP {
392397
Redirect getARedirect() { result.getResponseWriter() = this }
393398

394399
/** Gets a data-flow node that is a use of this response writer. */
395-
DataFlow::Node getANode() { result = self.getANode() }
400+
DataFlow::Node getANode() {
401+
result = self.getANode() or
402+
result.(DataFlow::PostUpdateNode).getPreUpdateNode() = self.getANode()
403+
}
396404
}
397405

398406
/** Provides a class for modeling new HTTP header-write APIs. */

0 commit comments

Comments
 (0)