Skip to content

Commit 8ef4821

Browse files
committed
Python: Remove references to FlowStateString.
1 parent a1068ce commit 8ef4821

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

python/ql/lib/semmle/python/security/dataflow/PathInjectionQuery.qll

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,18 @@ deprecated class Configuration extends TaintTracking::Configuration {
6363
}
6464
}
6565

66+
abstract private class NormalizationState extends string {
67+
bindingset[this]
68+
NormalizationState() { any() }
69+
}
70+
6671
/** A state signifying that the file path has not been normalized. */
67-
class NotNormalized extends DataFlow::FlowState {
72+
class NotNormalized extends NormalizationState {
6873
NotNormalized() { this = "NotNormalized" }
6974
}
7075

7176
/** A state signifying that the file path has been normalized, but not checked. */
72-
class NormalizedUnchecked extends DataFlow::FlowState {
77+
class NormalizedUnchecked extends NormalizationState {
7378
NormalizedUnchecked() { this = "NormalizedUnchecked" }
7479
}
7580

@@ -85,7 +90,7 @@ class NormalizedUnchecked extends DataFlow::FlowState {
8590
* Such checks are ineffective in the `NotNormalized` state.
8691
*/
8792
module PathInjectionConfig implements DataFlow::StateConfigSig {
88-
class FlowState = DataFlow::FlowState;
93+
class FlowState = NormalizationState;
8994

9095
predicate isSource(DataFlow::Node source, FlowState state) {
9196
source instanceof Source and state instanceof NotNormalized

python/ql/src/experimental/Security/CWE-176/UnicodeBypassValidationQuery.qll

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ import semmle.python.dataflow.new.internal.TaintTrackingPrivate
1212
import semmle.python.dataflow.new.RemoteFlowSources
1313
import UnicodeBypassValidationCustomizations::UnicodeBypassValidation
1414

15+
abstract private class ValidationState extends string {
16+
bindingset[this]
17+
ValidationState() { any() }
18+
}
19+
1520
/** A state signifying that a logical validation has not been performed. */
16-
class PreValidation extends DataFlow::FlowState {
21+
class PreValidation extends ValidationState {
1722
PreValidation() { this = "PreValidation" }
1823
}
1924

2025
/** A state signifying that a logical validation has been performed. */
21-
class PostValidation extends DataFlow::FlowState {
26+
class PostValidation extends ValidationState {
2227
PostValidation() { this = "PostValidation" }
2328
}
2429

@@ -29,7 +34,7 @@ class PostValidation extends DataFlow::FlowState {
2934
* to track the requirement that a logical validation has been performed before the Unicode Transformation.
3035
*/
3136
private module UnicodeBypassValidationConfig implements DataFlow::StateConfigSig {
32-
class FlowState = DataFlow::FlowState;
37+
class FlowState = ValidationState;
3338

3439
predicate isSource(DataFlow::Node source, FlowState state) {
3540
source instanceof RemoteFlowSource and state instanceof PreValidation

0 commit comments

Comments
 (0)