Skip to content

Commit 468a780

Browse files
committed
Docstrings and comments
1 parent 13691d4 commit 468a780

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CAPCqlInjectionQuery.qll

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import advanced_security.javascript.frameworks.cap.CQL
44
import advanced_security.javascript.frameworks.cap.RemoteFlowSources
55
import advanced_security.javascript.frameworks.cap.dataflow.FlowSteps
66

7+
/**
8+
* A CQL clause parameterized with a string concatentation expression.
9+
*/
710
class CqlClauseWithStringConcatParameter instanceof CqlClause {
811
CqlClauseWithStringConcatParameter() {
912
exists(DataFlow::Node queryParameter |
@@ -23,6 +26,10 @@ class CqlClauseWithStringConcatParameter instanceof CqlClause {
2326
string toString() { result = super.toString() }
2427
}
2528

29+
/**
30+
* A CQL shortcut method call (`read`, `create`, ...) parameterized with a string
31+
* concatenation expression.
32+
*/
2633
class CqlShortcutMethodCallWithStringConcat instanceof CqlShortcutMethodCall {
2734
CqlShortcutMethodCallWithStringConcat() {
2835
exists(StringConcatenation::getAnOperand(super.getAQueryParameter()))
@@ -33,6 +40,10 @@ class CqlShortcutMethodCallWithStringConcat instanceof CqlShortcutMethodCall {
3340
string toString() { result = super.toString() }
3441
}
3542

43+
/**
44+
* A CQL parser call (cds.ql, cds.parse.cql, ...) parameterized with a string
45+
* conatenation expression.
46+
*/
3647
class CqlClauseParserCallWithStringConcat instanceof CqlClauseParserCall {
3748
CqlClauseParserCallWithStringConcat() {
3849
exists(StringConcatenation::getAnOperand(super.getCdlString()))
@@ -57,6 +68,7 @@ class CqlInjectionConfiguration extends TaintTracking::Configuration {
5768
node = queryRunnerCall.(CqlQueryRunnerCall).getAQueryParameter()
5869
)
5970
or
71+
/* 3. An await expression that */
6072
exists(AwaitExpr await, CqlClauseWithStringConcatParameter cqlClauseWithStringConcat |
6173
node = await.flow() and
6274
await.getOperand() = cqlClauseWithStringConcat.(CqlClause).asExpr()
@@ -67,12 +79,12 @@ class CqlInjectionConfiguration extends TaintTracking::Configuration {
6779

6880
override predicate isAdditionalTaintStep(DataFlow::Node start, DataFlow::Node end) {
6981
/*
70-
* 1.
82+
* 1. Given a call to a CQL parser, jump from the argument to the parser call itself.
7183
*/
7284

73-
exists(CqlClauseParserCallWithStringConcat cqlParseCallWithStringConcat |
74-
start = cqlParseCallWithStringConcat.(CqlClauseParserCall).getAnArgument() and
75-
end = cqlParseCallWithStringConcat
85+
exists(CqlClauseParserCall cqlParserCall |
86+
start = cqlParserCall.(CqlClauseParserCall).getAnArgument() and
87+
end = cqlParserCall
7688
)
7789
or
7890
/*
@@ -111,4 +123,3 @@ class CqlInjectionConfiguration extends TaintTracking::Configuration {
111123
)
112124
}
113125
}
114-

javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CDS.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ class CqlRunMethodCall extends CqlQueryRunnerCall {
857857
override DataFlow::Node getAQueryParameter() { result = this.getArgument(0) }
858858
}
859859

860+
/**
861+
* A [CRUD-style call](https://cap.cloud.sap/docs/node.js/core-services#crud-style-api)
862+
* that translates to running a CQL query internally.
863+
*/
860864
class CqlShortcutMethodCall extends CqlQueryRunnerCall {
861865
CqlShortcutMethodCall() {
862866
this.getMethodName() = ["read", "create", "update", "delete", "insert", "upsert"]

javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CQL.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import DataFlow
33
import advanced_security.javascript.frameworks.cap.CDS
44

55
/**
6-
* Objects from the SQL-like fluent API
7-
* this is the set of clauses that acts as the base of a statement
6+
* Objects from the SQL-like fluent API that forms the basis of constructing
7+
* a CQL clause.
88
*/
99
class CqlQueryBase extends VarRef {
1010
CqlQueryBase() {

0 commit comments

Comments
 (0)