@vltpkg/query 1.0.0-rc.33 → 1.0.0-rc.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -6
- package/dist/parser.js +2 -1
- package/dist/pseudo/malware.d.ts +3 -16
- package/dist/pseudo/malware.js +11 -171
- package/dist/pseudo/vuln.d.ts +22 -0
- package/dist/pseudo/vuln.js +220 -0
- package/dist/pseudo.js +3 -3
- package/dist/types.d.ts +3 -2
- package/package.json +8 -8
- package/skills/dss-query/REFERENCE.md +8 -4
- package/skills/dss-query/SKILL.md +7 -7
- package/src/index.ts +21 -14
- package/src/parser.ts +2 -1
- package/src/pseudo/malware.ts +13 -221
- package/src/pseudo/vuln.ts +273 -0
- package/src/pseudo.ts +3 -3
- package/src/types.ts +3 -2
- package/tap-snapshots/test/pseudo/malware.ts.test.cjs +1 -170
- package/tap-snapshots/test/pseudo/vuln.ts.test.cjs +208 -0
- package/tap-snapshots/test/pseudo/vulnerable.ts.test.cjs +3 -1
- package/test/index.ts +8 -0
- package/test/pseudo/malware.ts +65 -312
- package/test/pseudo/vuln.ts +625 -0
- package/test/pseudo/vulnerable.ts +42 -35
- package/tsconfig.publish.tsbuildinfo +1 -1
- package/dist/pseudo/vulnerable.d.ts +0 -8
- package/dist/pseudo/vulnerable.js +0 -17
- package/src/pseudo/vulnerable.ts +0 -26
|
@@ -5,187 +5,18 @@
|
|
|
5
5
|
* Make sure to inspect the output below. Do not ignore changes!
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with
|
|
9
|
-
Object {
|
|
10
|
-
"edges": Array [
|
|
11
|
-
"a",
|
|
12
|
-
"e",
|
|
13
|
-
"e",
|
|
14
|
-
],
|
|
15
|
-
"nodes": Array [
|
|
16
|
-
"a",
|
|
17
|
-
"e",
|
|
18
|
-
],
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > filter out using unquoted param > must match snapshot 1`] = `
|
|
23
|
-
Object {
|
|
24
|
-
"edges": Array [
|
|
25
|
-
"b",
|
|
26
|
-
"f",
|
|
27
|
-
],
|
|
28
|
-
"nodes": Array [
|
|
29
|
-
"b",
|
|
30
|
-
"f",
|
|
31
|
-
],
|
|
32
|
-
}
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > filter using numbered param > must match snapshot 1`] = `
|
|
36
|
-
Object {
|
|
37
|
-
"edges": Array [
|
|
38
|
-
"a",
|
|
39
|
-
"e",
|
|
40
|
-
"e",
|
|
41
|
-
],
|
|
42
|
-
"nodes": Array [
|
|
43
|
-
"a",
|
|
44
|
-
"e",
|
|
45
|
-
],
|
|
46
|
-
}
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > greater than comparator with number (unquoted) > must match snapshot 1`] = `
|
|
50
|
-
Object {
|
|
51
|
-
"edges": Array [
|
|
52
|
-
"c",
|
|
53
|
-
"d",
|
|
54
|
-
],
|
|
55
|
-
"nodes": Array [
|
|
56
|
-
"c",
|
|
57
|
-
"d",
|
|
58
|
-
],
|
|
59
|
-
}
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > greater than comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
63
|
-
Object {
|
|
64
|
-
"edges": Array [
|
|
65
|
-
"c",
|
|
66
|
-
"d",
|
|
67
|
-
],
|
|
68
|
-
"nodes": Array [
|
|
69
|
-
"c",
|
|
70
|
-
"d",
|
|
71
|
-
],
|
|
72
|
-
}
|
|
73
|
-
`
|
|
74
|
-
|
|
75
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > greater than or equal to comparator with number (unquoted) > must match snapshot 1`] = `
|
|
76
|
-
Object {
|
|
77
|
-
"edges": Array [
|
|
78
|
-
"c",
|
|
79
|
-
"d",
|
|
80
|
-
],
|
|
81
|
-
"nodes": Array [
|
|
82
|
-
"c",
|
|
83
|
-
"d",
|
|
84
|
-
],
|
|
85
|
-
}
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > greater than or equal to comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
89
|
-
Object {
|
|
90
|
-
"edges": Array [
|
|
91
|
-
"c",
|
|
92
|
-
"d",
|
|
93
|
-
],
|
|
94
|
-
"nodes": Array [
|
|
95
|
-
"c",
|
|
96
|
-
"d",
|
|
97
|
-
],
|
|
98
|
-
}
|
|
99
|
-
`
|
|
100
|
-
|
|
101
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > less than comparator with number (unquoted) > must match snapshot 1`] = `
|
|
102
|
-
Object {
|
|
103
|
-
"edges": Array [
|
|
104
|
-
"a",
|
|
105
|
-
"b",
|
|
106
|
-
"e",
|
|
107
|
-
"e",
|
|
108
|
-
"f",
|
|
109
|
-
],
|
|
110
|
-
"nodes": Array [
|
|
111
|
-
"a",
|
|
112
|
-
"b",
|
|
113
|
-
"e",
|
|
114
|
-
"f",
|
|
115
|
-
],
|
|
116
|
-
}
|
|
117
|
-
`
|
|
118
|
-
|
|
119
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > less than comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
120
|
-
Object {
|
|
121
|
-
"edges": Array [
|
|
122
|
-
"a",
|
|
123
|
-
"b",
|
|
124
|
-
"e",
|
|
125
|
-
"e",
|
|
126
|
-
"f",
|
|
127
|
-
],
|
|
128
|
-
"nodes": Array [
|
|
129
|
-
"a",
|
|
130
|
-
"b",
|
|
131
|
-
"e",
|
|
132
|
-
"f",
|
|
133
|
-
],
|
|
134
|
-
}
|
|
135
|
-
`
|
|
136
|
-
|
|
137
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > less than or equal to comparator with number (unquoted) > must match snapshot 1`] = `
|
|
138
|
-
Object {
|
|
139
|
-
"edges": Array [
|
|
140
|
-
"a",
|
|
141
|
-
"b",
|
|
142
|
-
"e",
|
|
143
|
-
"e",
|
|
144
|
-
"f",
|
|
145
|
-
],
|
|
146
|
-
"nodes": Array [
|
|
147
|
-
"a",
|
|
148
|
-
"b",
|
|
149
|
-
"e",
|
|
150
|
-
"f",
|
|
151
|
-
],
|
|
152
|
-
}
|
|
153
|
-
`
|
|
154
|
-
|
|
155
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > less than or equal to comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
156
|
-
Object {
|
|
157
|
-
"edges": Array [
|
|
158
|
-
"a",
|
|
159
|
-
"b",
|
|
160
|
-
"e",
|
|
161
|
-
"e",
|
|
162
|
-
"f",
|
|
163
|
-
],
|
|
164
|
-
"nodes": Array [
|
|
165
|
-
"a",
|
|
166
|
-
"b",
|
|
167
|
-
"e",
|
|
168
|
-
"f",
|
|
169
|
-
],
|
|
170
|
-
}
|
|
171
|
-
`
|
|
172
|
-
|
|
173
|
-
exports[`test/pseudo/malware.ts > TAP > selects packages with a specific malware kind > parameterless :malware matches medium+ severity > must match snapshot 1`] = `
|
|
8
|
+
exports[`test/pseudo/malware.ts > TAP > selects packages with malware alerts > matches nodes with malware or gptMalware alerts > must match snapshot 1`] = `
|
|
174
9
|
Object {
|
|
175
10
|
"edges": Array [
|
|
176
11
|
"a",
|
|
177
12
|
"b",
|
|
178
|
-
"c",
|
|
179
13
|
"e",
|
|
180
14
|
"e",
|
|
181
|
-
"f",
|
|
182
15
|
],
|
|
183
16
|
"nodes": Array [
|
|
184
17
|
"a",
|
|
185
18
|
"b",
|
|
186
|
-
"c",
|
|
187
19
|
"e",
|
|
188
|
-
"f",
|
|
189
20
|
],
|
|
190
21
|
}
|
|
191
22
|
`
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/* IMPORTANT
|
|
2
|
+
* This snapshot file is auto-generated, but designed for humans.
|
|
3
|
+
* It should be checked into source control and tracked carefully.
|
|
4
|
+
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
|
|
5
|
+
* Make sure to inspect the output below. Do not ignore changes!
|
|
6
|
+
*/
|
|
7
|
+
'use strict'
|
|
8
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > filter out any node that does not have the vuln alert > must match snapshot 1`] = `
|
|
9
|
+
Object {
|
|
10
|
+
"edges": Array [
|
|
11
|
+
"a",
|
|
12
|
+
],
|
|
13
|
+
"nodes": Array [
|
|
14
|
+
"a",
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > filter out using unquoted param > must match snapshot 1`] = `
|
|
20
|
+
Object {
|
|
21
|
+
"edges": Array [
|
|
22
|
+
"b",
|
|
23
|
+
],
|
|
24
|
+
"nodes": Array [
|
|
25
|
+
"b",
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > filter using numbered param > must match snapshot 1`] = `
|
|
31
|
+
Object {
|
|
32
|
+
"edges": Array [
|
|
33
|
+
"a",
|
|
34
|
+
],
|
|
35
|
+
"nodes": Array [
|
|
36
|
+
"a",
|
|
37
|
+
],
|
|
38
|
+
}
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > greater than comparator with number (unquoted) > must match snapshot 1`] = `
|
|
42
|
+
Object {
|
|
43
|
+
"edges": Array [
|
|
44
|
+
"c",
|
|
45
|
+
"d",
|
|
46
|
+
"e",
|
|
47
|
+
"e",
|
|
48
|
+
"f",
|
|
49
|
+
],
|
|
50
|
+
"nodes": Array [
|
|
51
|
+
"c",
|
|
52
|
+
"d",
|
|
53
|
+
"e",
|
|
54
|
+
"f",
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > greater than comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
60
|
+
Object {
|
|
61
|
+
"edges": Array [
|
|
62
|
+
"c",
|
|
63
|
+
"d",
|
|
64
|
+
"e",
|
|
65
|
+
"e",
|
|
66
|
+
"f",
|
|
67
|
+
],
|
|
68
|
+
"nodes": Array [
|
|
69
|
+
"c",
|
|
70
|
+
"d",
|
|
71
|
+
"e",
|
|
72
|
+
"f",
|
|
73
|
+
],
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > greater than or equal to comparator with number (unquoted) > must match snapshot 1`] = `
|
|
78
|
+
Object {
|
|
79
|
+
"edges": Array [
|
|
80
|
+
"c",
|
|
81
|
+
"d",
|
|
82
|
+
"e",
|
|
83
|
+
"e",
|
|
84
|
+
"f",
|
|
85
|
+
],
|
|
86
|
+
"nodes": Array [
|
|
87
|
+
"c",
|
|
88
|
+
"d",
|
|
89
|
+
"e",
|
|
90
|
+
"f",
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
`
|
|
94
|
+
|
|
95
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > greater than or equal to comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
96
|
+
Object {
|
|
97
|
+
"edges": Array [
|
|
98
|
+
"c",
|
|
99
|
+
"d",
|
|
100
|
+
"e",
|
|
101
|
+
"e",
|
|
102
|
+
"f",
|
|
103
|
+
],
|
|
104
|
+
"nodes": Array [
|
|
105
|
+
"c",
|
|
106
|
+
"d",
|
|
107
|
+
"e",
|
|
108
|
+
"f",
|
|
109
|
+
],
|
|
110
|
+
}
|
|
111
|
+
`
|
|
112
|
+
|
|
113
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > less than comparator with number (unquoted) > must match snapshot 1`] = `
|
|
114
|
+
Object {
|
|
115
|
+
"edges": Array [
|
|
116
|
+
"a",
|
|
117
|
+
"b",
|
|
118
|
+
],
|
|
119
|
+
"nodes": Array [
|
|
120
|
+
"a",
|
|
121
|
+
"b",
|
|
122
|
+
],
|
|
123
|
+
}
|
|
124
|
+
`
|
|
125
|
+
|
|
126
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > less than comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
127
|
+
Object {
|
|
128
|
+
"edges": Array [
|
|
129
|
+
"a",
|
|
130
|
+
"b",
|
|
131
|
+
],
|
|
132
|
+
"nodes": Array [
|
|
133
|
+
"a",
|
|
134
|
+
"b",
|
|
135
|
+
],
|
|
136
|
+
}
|
|
137
|
+
`
|
|
138
|
+
|
|
139
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > less than or equal to comparator with number (unquoted) > must match snapshot 1`] = `
|
|
140
|
+
Object {
|
|
141
|
+
"edges": Array [
|
|
142
|
+
"a",
|
|
143
|
+
"b",
|
|
144
|
+
],
|
|
145
|
+
"nodes": Array [
|
|
146
|
+
"a",
|
|
147
|
+
"b",
|
|
148
|
+
],
|
|
149
|
+
}
|
|
150
|
+
`
|
|
151
|
+
|
|
152
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > less than or equal to comparator with string kind (quoted) > must match snapshot 1`] = `
|
|
153
|
+
Object {
|
|
154
|
+
"edges": Array [
|
|
155
|
+
"a",
|
|
156
|
+
"b",
|
|
157
|
+
],
|
|
158
|
+
"nodes": Array [
|
|
159
|
+
"a",
|
|
160
|
+
"b",
|
|
161
|
+
],
|
|
162
|
+
}
|
|
163
|
+
`
|
|
164
|
+
|
|
165
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > low matches both mildCVE and gptAnomaly > must match snapshot 1`] = `
|
|
166
|
+
Object {
|
|
167
|
+
"edges": Array [
|
|
168
|
+
"d",
|
|
169
|
+
"f",
|
|
170
|
+
],
|
|
171
|
+
"nodes": Array [
|
|
172
|
+
"d",
|
|
173
|
+
"f",
|
|
174
|
+
],
|
|
175
|
+
}
|
|
176
|
+
`
|
|
177
|
+
|
|
178
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > medium matches both potentialVulnerability and gptSecurity > must match snapshot 1`] = `
|
|
179
|
+
Object {
|
|
180
|
+
"edges": Array [
|
|
181
|
+
"c",
|
|
182
|
+
"e",
|
|
183
|
+
"e",
|
|
184
|
+
],
|
|
185
|
+
"nodes": Array [
|
|
186
|
+
"c",
|
|
187
|
+
"e",
|
|
188
|
+
],
|
|
189
|
+
}
|
|
190
|
+
`
|
|
191
|
+
|
|
192
|
+
exports[`test/pseudo/vuln.ts > TAP > selects packages with vulnerability alerts > parameterless :vuln matches medium+ severity > must match snapshot 1`] = `
|
|
193
|
+
Object {
|
|
194
|
+
"edges": Array [
|
|
195
|
+
"a",
|
|
196
|
+
"b",
|
|
197
|
+
"c",
|
|
198
|
+
"e",
|
|
199
|
+
"e",
|
|
200
|
+
],
|
|
201
|
+
"nodes": Array [
|
|
202
|
+
"a",
|
|
203
|
+
"b",
|
|
204
|
+
"c",
|
|
205
|
+
"e",
|
|
206
|
+
],
|
|
207
|
+
}
|
|
208
|
+
`
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* Make sure to inspect the output below. Do not ignore changes!
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
exports[`test/pseudo/vulnerable.ts > TAP >
|
|
8
|
+
exports[`test/pseudo/vulnerable.ts > TAP > :vulnerable alias works the same as :vuln > parameterless :vulnerable matches severity >= medium > must match snapshot 1`] = `
|
|
9
9
|
Object {
|
|
10
10
|
"edges": Array [
|
|
11
|
+
"a",
|
|
11
12
|
"e",
|
|
12
13
|
"e",
|
|
13
14
|
],
|
|
14
15
|
"nodes": Array [
|
|
16
|
+
"a",
|
|
15
17
|
"e",
|
|
16
18
|
],
|
|
17
19
|
}
|
package/test/index.ts
CHANGED
|
@@ -374,6 +374,14 @@ t.test('Query.hasSecuritySelectors', async t => {
|
|
|
374
374
|
Query.hasSecuritySelectors(':unmaintained'),
|
|
375
375
|
'should return true',
|
|
376
376
|
)
|
|
377
|
+
t.ok(
|
|
378
|
+
Query.hasSecuritySelectors(':vuln'),
|
|
379
|
+
'should return true for :vuln',
|
|
380
|
+
)
|
|
381
|
+
t.ok(
|
|
382
|
+
Query.hasSecuritySelectors(':vulnerable'),
|
|
383
|
+
'should return true for :vulnerable',
|
|
384
|
+
)
|
|
377
385
|
t.notOk(Query.hasSecuritySelectors(':foo'), 'should return false')
|
|
378
386
|
t.notOk(Query.hasSecuritySelectors(':has'), 'should return false')
|
|
379
387
|
})
|