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 @@ -579,6 +579,8 @@ common:remote-envoy-engflow --config=rbe-envoy-engflow
579
579
common:remote-cache-envoy-engflow --config=common-envoy-engflow
580
580
common:remote-cache-envoy-engflow --config=cache-envoy-engflow
581
581
582
+ common:cves --//tools/dependency:cve-data=//tools/dependency:cve-data-dir
583
+
582
584
# Specifies the rustfmt.toml for all rustfmt_test targets.
583
585
build --@rules_rust//rust/settings:rustfmt.toml=//:rustfmt.toml
584
586
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 @@ -152,11 +152,29 @@ envoy_genjson(
152
152
)
153
153
154
154
filegroup (
155
- name = "cve-data" ,
155
+ name = "cve-data-dir " ,
156
156
srcs = glob (["cve_data/*.json" ]),
157
157
visibility = ["//visibility:public" ],
158
158
)
159
159
160
+ genrule (
161
+ name = "placeholder" ,
162
+ outs = ["PLACEHOLDER.txt" ],
163
+ cmd = "echo '' > $@" ,
164
+ )
165
+
166
+ filegroup (
167
+ name = "empty-directory" ,
168
+ srcs = [":placeholder" ], # default fallback
169
+ visibility = ["//visibility:public" ],
170
+ )
171
+
172
+ label_flag (
173
+ name = "cve-data" ,
174
+ build_setting_default = ":empty-directory" ,
175
+ visibility = ["//visibility:public" ],
176
+ )
177
+
160
178
sh_binary (
161
179
name = "cves" ,
162
180
srcs = ["cves.sh" ],
@@ -192,6 +210,18 @@ genrule(
192
210
export JQ_VERSION_UTILS="$(location :version.jq)"
193
211
export CVES_IGNORED="$(location :ignored-cves.json)"
194
212
export CVES="$(locations :cve-data)"
213
+ read -ra CVELIST <<< "$$CVES"
214
+ HAS_JSON=false
215
+ for f in "$${CVELIST[@]}"; do
216
+ if [[ "$$f" == *.json ]]; then
217
+ HAS_JSON=true
218
+ break
219
+ fi
220
+ done
221
+ if [[ "$$HAS_JSON" != true ]]; then
222
+ echo "No CVE data set, perhaps use --config=cves?" >&2
223
+ exit 1
224
+ fi
195
225
$(location :cves) \
196
226
> $@ || :
197
227
""" ,
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