Skip to content

Commit e960bd9

Browse files
author
Max Schaefer
committed
JavaScript: Make configuration IDs explicit in the API.
1 parent 8f1c5db commit e960bd9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

javascript/ql/src/Security/Summaries/Shared.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import javascript
66

77
/**
8-
* Holds if `config` matches `spec`, that is, either `spec` is the name of `config`
8+
* Holds if `config` matches `spec`, that is, either `spec` is the ID of `config`
99
* or `spec` is the empty string and `config` is an arbitrary configuration.
1010
*/
1111
predicate configSpec(DataFlow::Configuration config, string spec) {
12-
config.toString() = spec
12+
config.getId() = spec
1313
or
1414
spec = ""
1515
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ abstract class Configuration extends string {
8686
bindingset[this]
8787
Configuration() { any() }
8888

89+
/**
90+
* Gets the unique identifier of this configuration among all data flow tracking
91+
* configurations.
92+
*/
93+
string getId() { result = this }
94+
8995
/**
9096
* Holds if `source` is a relevant data flow source for this configuration.
9197
*/

0 commit comments

Comments
 (0)