File tree Expand file tree Collapse file tree 4 files changed +15
-33
lines changed
src/queries/security/CWE-022
test/query-tests/security/CWE-022 Expand file tree Collapse file tree 4 files changed +15
-33
lines changed Original file line number Diff line number Diff line change @@ -269,14 +269,7 @@ module Cryptography {
269269
270270/** Provides classes for modeling path-related APIs. */
271271module 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 ;
280273
281274 /** Provides a class for modeling new path normalization APIs. */
282275 module PathNormalization {
Original file line number Diff line number Diff line change @@ -720,6 +720,15 @@ module RustDataFlow implements InputSig<Location> {
720720 not isSpecialContentSet ( cs )
721721 }
722722
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+
723732 pragma [ nomagic]
724733 private predicate fieldAssignment ( Node node1 , Node node2 , FieldContent c ) {
725734 exists ( AssignmentExprCfgNode assignment , FieldExprCfgNode access |
@@ -1110,16 +1119,6 @@ private module Cached {
11101119 name = any ( FlowSummaryImpl:: Private:: AccessPathToken tok ) .getAnArgument ( "OptionalBarrier" )
11111120 }
11121121
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-
11231122 /** Holds if `n` is a flow source of kind `kind`. */
11241123 cached
11251124 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
2222import TaintedPathFlow:: PathGraph
2323private import codeql.rust.Concepts
2424
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 ( )
3930
4031/**
4132 * This configuration uses two flow states, `NotNormalized` and `NormalizedUnchecked`,
Original file line number Diff line number Diff line change 1- qltest_cargo_check : true
21qltest_dependencies :
32 - poem = { version = "3.1.7" }
You can’t perform that action at this time.
0 commit comments