File tree 3 files changed +15
-32
lines changed
src/queries/security/CWE-022
3 files changed +15
-32
lines changed Original file line number Diff line number Diff line change @@ -269,14 +269,7 @@ module Cryptography {
269
269
270
270
/** Provides classes for modeling path-related APIs. */
271
271
module Path {
272
- /**
273
- * A data-flow node that performs path normalization. This is often needed in order
274
- * to safely access paths.
275
- */
276
- class PathNormalization extends DataFlow:: Node instanceof PathNormalization:: Range {
277
- /** Gets an argument to this path normalization that is interpreted as a path. */
278
- DataFlow:: Node getPathArg ( ) { result = super .getPathArg ( ) }
279
- }
272
+ final class PathNormalization = PathNormalization:: Range ;
280
273
281
274
/** Provides a class for modeling new path normalization APIs. */
282
275
module PathNormalization {
Original file line number Diff line number Diff line change @@ -720,6 +720,15 @@ module RustDataFlow implements InputSig<Location> {
720
720
not isSpecialContentSet ( cs )
721
721
}
722
722
723
+ /**
724
+ * Holds if `cs` is used to encode a special operation as a content component, but should not
725
+ * be treated as an ordinary content component.
726
+ */
727
+ private predicate isSpecialContentSet ( ContentSet cs ) {
728
+ cs instanceof TOptionalStep or
729
+ cs instanceof TOptionalBarrier
730
+ }
731
+
723
732
pragma [ nomagic]
724
733
private predicate fieldAssignment ( Node node1 , Node node2 , FieldContent c ) {
725
734
exists ( AssignmentExprCfgNode assignment , FieldExprCfgNode access |
@@ -1110,16 +1119,6 @@ private module Cached {
1110
1119
name = any ( FlowSummaryImpl:: Private:: AccessPathToken tok ) .getAnArgument ( "OptionalBarrier" )
1111
1120
}
1112
1121
1113
- /**
1114
- * Holds if `cs` is used to encode a special operation as a content component, but should not
1115
- * be treated as an ordinary content component.
1116
- */
1117
- cached
1118
- predicate isSpecialContentSet ( ContentSet cs ) {
1119
- cs instanceof TOptionalStep or
1120
- cs instanceof TOptionalBarrier
1121
- }
1122
-
1123
1122
/** Holds if `n` is a flow source of kind `kind`. */
1124
1123
cached
1125
1124
predicate sourceNode ( Node n , string kind ) { n .( FlowSummaryNode ) .isSource ( kind , _) }
Original file line number Diff line number Diff line change @@ -22,20 +22,11 @@ import codeql.rust.security.TaintedPathExtensions
22
22
import TaintedPathFlow:: PathGraph
23
23
private import codeql.rust.Concepts
24
24
25
- abstract private class NormalizationState extends string {
26
- bindingset [ this ]
27
- NormalizationState ( ) { any ( ) }
28
- }
29
-
30
- /** A state signifying that the file path has not been normalized. */
31
- class NotNormalized extends NormalizationState {
32
- NotNormalized ( ) { this = "NotNormalized" }
33
- }
34
-
35
- /** A state signifying that the file path has been normalized, but not checked. */
36
- class NormalizedUnchecked extends NormalizationState {
37
- NormalizedUnchecked ( ) { this = "NormalizedUnchecked" }
38
- }
25
+ newtype NormalizationState =
26
+ /** A state signifying that the file path has not been normalized. */
27
+ NotNormalized ( ) or
28
+ /** A state signifying that the file path has been normalized, but not checked. */
29
+ NormalizedUnchecked ( )
39
30
40
31
/**
41
32
* This configuration uses two flow states, `NotNormalized` and `NormalizedUnchecked`,
You can’t perform that action at this time.
0 commit comments