File tree Expand file tree Collapse file tree 4 files changed +45
-2
lines changed Expand file tree Collapse file tree 4 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -582,6 +582,8 @@ common:remote-envoy-engflow --config=rbe-envoy-engflow
582
582
common:remote-cache-envoy-engflow --config=common-envoy-engflow
583
583
common:remote-cache-envoy-engflow --config=cache-envoy-engflow
584
584
585
+ common:cves --//tools/dependency:cve-data=//tools/dependency:cve-data-dir
586
+
585
587
# Specifies the rustfmt.toml for all rustfmt_test targets.
586
588
build --@rules_rust//rust/settings:rustfmt.toml=//:rustfmt.toml
587
589
Original file line number Diff line number Diff line change 42
42
"${{ steps.vars.outputs.cve-data-path }}"
43
43
- name : Run CVE dependency scanner
44
44
run : |
45
- bazel test --config=ci //tools/dependency:cve_test
45
+ bazel test --config=ci --config=cves //tools/dependency:cve_test
Original file line number Diff line number Diff line change @@ -155,11 +155,29 @@ envoy_genjson(
155
155
)
156
156
157
157
filegroup (
158
- name = "cve-data" ,
158
+ name = "cve-data-dir " ,
159
159
srcs = glob (["cve_data/*.json" ]),
160
160
visibility = ["//visibility:public" ],
161
161
)
162
162
163
+ genrule (
164
+ name = "placeholder" ,
165
+ outs = ["PLACEHOLDER.txt" ],
166
+ cmd = "echo '' > $@" ,
167
+ )
168
+
169
+ filegroup (
170
+ name = "empty-directory" ,
171
+ srcs = [":placeholder" ], # default fallback
172
+ visibility = ["//visibility:public" ],
173
+ )
174
+
175
+ label_flag (
176
+ name = "cve-data" ,
177
+ build_setting_default = ":empty-directory" ,
178
+ visibility = ["//visibility:public" ],
179
+ )
180
+
163
181
sh_binary (
164
182
name = "cves" ,
165
183
srcs = ["cves.sh" ],
@@ -195,6 +213,18 @@ genrule(
195
213
export JQ_VERSION_UTILS="$(location :version.jq)"
196
214
export CVES_IGNORED="$(location :ignored-cves.json)"
197
215
export CVES="$(locations :cve-data)"
216
+ read -ra CVELIST <<< "$$CVES"
217
+ HAS_JSON=false
218
+ for f in "$${CVELIST[@]}"; do
219
+ if [[ "$$f" == *.json ]]; then
220
+ HAS_JSON=true
221
+ break
222
+ fi
223
+ done
224
+ if [[ "$$HAS_JSON" != true ]]; then
225
+ echo "No CVE data set, perhaps use --config=cves?" >&2
226
+ exit 1
227
+ fi
198
228
$(location :cves) \
199
229
> $@ || :
200
230
""" ,
Original file line number Diff line number Diff line change @@ -31,6 +31,17 @@ JQ_VERSION_LIBDIR="$(dirname "$JQ_VERSION_UTILS")"
31
31
32
32
read -ra CVES <<< " $CVES"
33
33
34
+ for f in " ${CVES[@]} " ; do
35
+ if [[ " $f " == * .json ]]; then
36
+ HAS_JSON=true
37
+ break
38
+ fi
39
+ done
40
+ if [[ " $HAS_JSON " != true ]]; then
41
+ echo " No CVE data set, perhaps use --config=cves?" >&2
42
+ exit 1
43
+ fi
44
+
34
45
parse_cves () {
35
46
# Stream the cves checking against the deps and then slurp the results into a single json object
36
47
# cat "${CVEPATH}/"*.json \
You can’t perform that action at this time.
0 commit comments