Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aea365c

Browse files
committed
adjust API naming
1 parent 5063e38 commit aea365c

2 files changed

Lines changed: 36 additions & 24 deletions

File tree

javascript/ql/src/semmle/javascript/Promises.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private module PromiseFlow {
150150
this = promise
151151
}
152152

153-
override predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) {
153+
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
154154
prop = resolveField() and
155155
pred = promise.getResolveParameter().getACall().getArgument(0) and
156156
succ = this
@@ -163,7 +163,7 @@ private module PromiseFlow {
163163
succ = this
164164
}
165165

166-
override predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) {
166+
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
167167
// Copy the value of a resolved promise to the value of this promise.
168168
prop = resolveField() and
169169
pred = promise.getResolveParameter().getACall().getArgument(0) and
@@ -180,13 +180,13 @@ private module PromiseFlow {
180180
this = promise
181181
}
182182

183-
override predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) {
183+
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
184184
prop = resolveField() and
185185
pred = promise.getValue() and
186186
succ = this
187187
}
188188

189-
override predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) {
189+
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
190190
// Copy the value of a resolved promise to the value of this promise.
191191
prop = resolveField() and
192192
pred = promise.getValue() and
@@ -207,7 +207,7 @@ private module PromiseFlow {
207207
operand.getEnclosingExpr() = await.getOperand()
208208
}
209209

210-
override predicate load(DataFlow::Node pred, DataFlow::Node succ, string prop) {
210+
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
211211
prop = resolveField() and
212212
succ = this and
213213
pred = operand
@@ -226,7 +226,7 @@ private module PromiseFlow {
226226
this.getMethodName() = "then"
227227
}
228228

229-
override predicate load(DataFlow::Node pred, DataFlow::Node succ, string prop) {
229+
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
230230
prop = resolveField() and
231231
pred = getReceiver() and
232232
succ = getCallback(0).getParameter(0)
@@ -236,7 +236,7 @@ private module PromiseFlow {
236236
succ = getCallback(1).getParameter(0)
237237
}
238238

239-
override predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) {
239+
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
240240
not exists(this.getArgument(1)) and
241241
prop = rejectField() and
242242
pred = getReceiver() and
@@ -248,7 +248,7 @@ private module PromiseFlow {
248248
succ = this
249249
}
250250

251-
override predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) {
251+
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
252252
prop = resolveField() and
253253
pred = getCallback([0..1]).getAReturn() and
254254
succ = this
@@ -267,13 +267,13 @@ private module PromiseFlow {
267267
this.getMethodName() = "catch"
268268
}
269269

270-
override predicate load(DataFlow::Node pred, DataFlow::Node succ, string prop) {
270+
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
271271
prop = rejectField() and
272272
pred = getReceiver() and
273273
succ = getCallback(0).getParameter(0)
274274
}
275275

276-
override predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) {
276+
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
277277
prop = resolveField() and
278278
pred = getReceiver().getALocalSource() and
279279
succ = this
@@ -284,7 +284,7 @@ private module PromiseFlow {
284284
succ = this
285285
}
286286

287-
override predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) {
287+
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
288288
prop = rejectField() and
289289
pred = getCallback(0).getExceptionalReturn() and
290290
succ = this
@@ -303,7 +303,7 @@ private module PromiseFlow {
303303
this.getMethodName() = "finally"
304304
}
305305

306-
override predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) {
306+
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
307307
(prop = resolveField() or prop = rejectField()) and
308308
pred = getReceiver() and
309309
succ = this
@@ -314,7 +314,7 @@ private module PromiseFlow {
314314
succ = this
315315
}
316316

317-
override predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) {
317+
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
318318
prop = rejectField() and
319319
pred = getCallback(0).getExceptionalReturn() and
320320
succ = this

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,25 @@ abstract class Configuration extends string {
225225
}
226226

227227
/**
228+
* EXPERIMENTAL. This API may change in the future.
229+
*
228230
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
229231
*/
230232
predicate isAdditionalStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
231233

232234
/**
235+
* EXPERIMENTAL. This API may change in the future.
236+
*
233237
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
234238
*/
235239
predicate isAdditionalLoadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
236240

237241
/**
242+
* EXPERIMENTAL. This API may change in the future.
243+
*
238244
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
239245
*/
240-
predicate isAdditionalCopyPropertyStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
246+
predicate isAdditionalLoadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
241247
none()
242248
}
243249
}
@@ -487,22 +493,28 @@ abstract class AdditionalFlowStep extends DataFlow::Node {
487493
}
488494

489495
/**
496+
* EXPERIMENTAL. This API may change in the future.
497+
*
490498
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
491499
*/
492500
cached
493-
predicate store(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
501+
predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
494502

495503
/**
504+
* EXPERIMENTAL. This API may change in the future.
505+
*
496506
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
497507
*/
498508
cached
499-
predicate load(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
509+
predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
500510

501511
/**
512+
* EXPERIMENTAL. This API may change in the future.
513+
*
502514
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
503515
*/
504516
cached
505-
predicate copyProperty(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
517+
predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) { none() }
506518
}
507519

508520
/**
@@ -607,7 +619,7 @@ private predicate exploratoryFlowStep(
607619
basicLoadStep(pred, succ, _) or
608620
isAdditionalStoreStep(pred, succ, _, cfg) or
609621
isAdditionalLoadStep(pred, succ, _, cfg) or
610-
isAdditionalCopyPropertyStep(pred, succ, _, cfg) or
622+
isAdditionalLoadStoreStep(pred, succ, _, cfg) or
611623
// the following two disjuncts taken together over-approximate flow through
612624
// higher-order calls
613625
callback(pred, succ) or
@@ -830,7 +842,7 @@ private predicate reachesReturn(
830842
private predicate isAdditionalLoadStep(
831843
DataFlow::Node pred, DataFlow::Node succ, string prop, DataFlow::Configuration cfg
832844
) {
833-
any(AdditionalFlowStep s).load(pred, succ, prop)
845+
any(AdditionalFlowStep s).loadStep(pred, succ, prop)
834846
or
835847
cfg.isAdditionalLoadStep(pred, succ, prop)
836848
}
@@ -841,20 +853,20 @@ private predicate isAdditionalLoadStep(
841853
private predicate isAdditionalStoreStep(
842854
DataFlow::Node pred, DataFlow::Node succ, string prop, DataFlow::Configuration cfg
843855
) {
844-
any(AdditionalFlowStep s).store(pred, succ, prop)
856+
any(AdditionalFlowStep s).storeStep(pred, succ, prop)
845857
or
846858
cfg.isAdditionalStoreStep(pred, succ, prop)
847859
}
848860

849861
/**
850862
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
851863
*/
852-
private predicate isAdditionalCopyPropertyStep(
864+
private predicate isAdditionalLoadStoreStep(
853865
DataFlow::Node pred, DataFlow::Node succ, string prop, DataFlow::Configuration cfg
854866
) {
855-
any(AdditionalFlowStep s).copyProperty(pred, succ, prop)
867+
any(AdditionalFlowStep s).loadStoreStep(pred, succ, prop)
856868
or
857-
cfg.isAdditionalCopyPropertyStep(pred, succ, prop)
869+
cfg.isAdditionalLoadStoreStep(pred, succ, prop)
858870
}
859871

860872
/**
@@ -895,7 +907,7 @@ private predicate reachableFromStoreBase(
895907
(
896908
flowStep(mid, cfg, nd, newSummary)
897909
or
898-
isAdditionalCopyPropertyStep(mid, nd, prop, cfg) and
910+
isAdditionalLoadStoreStep(mid, nd, prop, cfg) and
899911
newSummary = PathSummary::level()
900912
) and
901913
summary = oldSummary.appendValuePreserving(newSummary)

0 commit comments

Comments
 (0)