Skip to content

Commit dcb1da3

Browse files
committed
Extend documentation
1 parent 4963caf commit dcb1da3

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

python/ql/src/experimental/semmle/python/Concepts.qll

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,35 @@ private import semmle.python.dataflow.new.RemoteFlowSources
1414
private import semmle.python.dataflow.new.TaintTracking
1515
private import experimental.semmle.python.Frameworks
1616

17+
/** Provides classes for modeling HTTP Header APIs. */
1718
module HeaderDeclaration {
19+
/**
20+
* A data-flow node that collects functions setting HTTP Headers' content.
21+
*
22+
* Extend this class to model new APIs. If you want to refine existing API models,
23+
* extend `HeaderDeclaration` instead.
24+
*/
1825
abstract class Range extends DataFlow::Node {
19-
abstract DataFlow::Node getHeaderInputNode();
26+
/**
27+
* Gets the argument containing the header value.
28+
*/
29+
abstract DataFlow::Node getHeaderInput();
2030
}
2131
}
2232

33+
/**
34+
* A data-flow node that collects functions setting HTTP Headers' content.
35+
*
36+
* Extend this class to model new APIs. If you want to refine existing API models,
37+
* extend `HeaderDeclaration` instead.
38+
*/
2339
class HeaderDeclaration extends DataFlow::Node {
2440
HeaderDeclaration::Range range;
2541

2642
HeaderDeclaration() { this = range }
2743

28-
DataFlow::Node getHeaderInputNode() { result = range.getHeaderInputNode() }
44+
/**
45+
* Gets the argument containing the header value.
46+
*/
47+
DataFlow::Node getHeaderInput() { result = range.getHeaderInput() }
2948
}

python/ql/src/experimental/semmle/python/security/injection/HTTPHeaders.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import semmle.python.dataflow.new.DataFlow
44
import semmle.python.dataflow.new.TaintTracking
55
import semmle.python.dataflow.new.RemoteFlowSources
66

7+
/**
8+
* A taint-tracking configuration for detecting HTTP Header injections.
9+
*/
710
class HeaderInjectionFlowConfig extends TaintTracking::Configuration {
811
HeaderInjectionFlowConfig() { this = "HeaderInjectionFlowConfig" }
912

1013
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
1114

1215
override predicate isSink(DataFlow::Node sink) {
13-
sink = any(HeaderDeclaration headerDeclaration).getHeaderInputNode()
16+
sink = any(HeaderDeclaration headerDeclaration).getHeaderInput()
1417
}
1518
}

0 commit comments

Comments
 (0)