@@ -18,21 +18,7 @@ abstract class CqlInjectionSink extends DataFlow::Node {
1818class CqlClauseWithStringConcatParameter instanceof CqlClause {
1919 CqlClauseWithStringConcatParameter ( ) {
2020 exists ( DataFlow:: Node queryParameter |
21- (
22- if this instanceof CqlInsertClause or this instanceof CqlUpsertClause
23- then
24- queryParameter = this .getArgument ( ) .flow ( )
25- or
26- /*
27- * Account for cases where an object with a string concatenation is passed. e.g.
28- * ``` javascript
29- * let insertQuery = INSERT.into`SomeEntity`.entries({col1: "column_" + col});
30- * ```
31- */
32-
33- queryParameter = this .getArgument ( ) .flow ( ) .( SourceNode ) .getAPropertyWrite ( ) .getRhs ( )
34- else queryParameter = this .getArgument ( ) .flow ( )
35- ) and
21+ queryParameter = this .getArgument ( ) .flow ( ) and
3622 exists ( StringConcatenation:: getAnOperand ( queryParameter ) )
3723 )
3824 }
@@ -95,10 +81,7 @@ class StringConcatParameterOfCqlRunMethodQueryArgument extends CqlInjectionSink
9581 * concatenation expression. e.g.
9682 * ``` javascript
9783 * cds.read("Entity1").where(`ID=${id}`); // Notice the surrounding parentheses!
98- * cds.create("Entity1").entries({id: "" + id});
9984 * cds.update("Entity1").set("col1 = col1" + amount).where("col1 = " + id);
100- * cds.insert("Entity1").entries({id: "" + id});
101- * cds.upsert("Entity1").entries({id: "" + id});
10285 * cds.delete("Entity1").where("ID =" + id);
10386 * ```
10487 */
@@ -121,18 +104,14 @@ class CqlShortcutMethodCallWithStringConcat instanceof CqlShortcutMethodCall {
121104 * A string concatenation expression included in a CQL shortcut method call. e.g.
122105 * ``` javascript
123106 * cds.read("Entity1").where(`ID=${id}`); // Notice the surrounding parentheses!
124- * cds.create("Entity1").entries({id: "" + id});
125107 * cds.update("Entity1").set("col1 = col1" + amount).where("col1 = " + id);
126- * cds.insert("Entity1").entries({id: "" + id});
127- * cds.upsert("Entity1").entries({id: "" + id});
128108 * cds.delete("Entity1").where("ID =" + id);
129109 * ```
130110 * This class captures the string concatenation expressions appearing above:
131111 * 1. `ID=${id}`
132- * 2. `"" + id`
133- * 3. `"col1 = col1" + amount`
134- * 4. `"col1 = " + id`
135- * 5. `"ID =" + id`
112+ * 2. `"col1 = col1" + amount`
113+ * 3. `"col1 = " + id`
114+ * 4. `"ID =" + id`
136115 */
137116class StringConcatParameterOfCqlShortcutMethodCall extends CqlInjectionSink {
138117 CqlShortcutMethodCallWithStringConcat cqlShortcutMethodCallWithStringConcat ;
0 commit comments