File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
lib/semmle/python/security/dataflow
src/experimental/Security/CWE-176 Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,18 @@ deprecated class Configuration extends TaintTracking::Configuration {
63
63
}
64
64
}
65
65
66
+ abstract private class NormalizationState extends string {
67
+ bindingset [ this ]
68
+ NormalizationState ( ) { any ( ) }
69
+ }
70
+
66
71
/** A state signifying that the file path has not been normalized. */
67
- class NotNormalized extends DataFlow :: FlowState {
72
+ class NotNormalized extends NormalizationState {
68
73
NotNormalized ( ) { this = "NotNormalized" }
69
74
}
70
75
71
76
/** A state signifying that the file path has been normalized, but not checked. */
72
- class NormalizedUnchecked extends DataFlow :: FlowState {
77
+ class NormalizedUnchecked extends NormalizationState {
73
78
NormalizedUnchecked ( ) { this = "NormalizedUnchecked" }
74
79
}
75
80
@@ -85,7 +90,7 @@ class NormalizedUnchecked extends DataFlow::FlowState {
85
90
* Such checks are ineffective in the `NotNormalized` state.
86
91
*/
87
92
module PathInjectionConfig implements DataFlow:: StateConfigSig {
88
- class FlowState = DataFlow :: FlowState ;
93
+ class FlowState = NormalizationState ;
89
94
90
95
predicate isSource ( DataFlow:: Node source , FlowState state ) {
91
96
source instanceof Source and state instanceof NotNormalized
Original file line number Diff line number Diff line change @@ -12,13 +12,18 @@ import semmle.python.dataflow.new.internal.TaintTrackingPrivate
12
12
import semmle.python.dataflow.new.RemoteFlowSources
13
13
import UnicodeBypassValidationCustomizations:: UnicodeBypassValidation
14
14
15
+ abstract private class ValidationState extends string {
16
+ bindingset [ this ]
17
+ ValidationState ( ) { any ( ) }
18
+ }
19
+
15
20
/** A state signifying that a logical validation has not been performed. */
16
- class PreValidation extends DataFlow :: FlowState {
21
+ class PreValidation extends ValidationState {
17
22
PreValidation ( ) { this = "PreValidation" }
18
23
}
19
24
20
25
/** A state signifying that a logical validation has been performed. */
21
- class PostValidation extends DataFlow :: FlowState {
26
+ class PostValidation extends ValidationState {
22
27
PostValidation ( ) { this = "PostValidation" }
23
28
}
24
29
@@ -29,7 +34,7 @@ class PostValidation extends DataFlow::FlowState {
29
34
* to track the requirement that a logical validation has been performed before the Unicode Transformation.
30
35
*/
31
36
private module UnicodeBypassValidationConfig implements DataFlow:: StateConfigSig {
32
- class FlowState = DataFlow :: FlowState ;
37
+ class FlowState = ValidationState ;
33
38
34
39
predicate isSource ( DataFlow:: Node source , FlowState state ) {
35
40
source instanceof RemoteFlowSource and state instanceof PreValidation
You can’t perform that action at this time.
0 commit comments