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 @@ -554,6 +554,8 @@ common:remote-envoy-engflow --config=rbe-envoy-engflow
554
554
common:remote-cache-envoy-engflow --config=common-envoy-engflow
555
555
common:remote-cache-envoy-engflow --config=cache-envoy-engflow
556
556
557
+ common:cves --//tools/dependency:cve-data=//tools/dependency:cve-data-dir
558
+
557
559
#############################################################################
558
560
# debug: Various Bazel debugging flags
559
561
#############################################################################
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 @@ -154,11 +154,29 @@ envoy_genjson(
154
154
)
155
155
156
156
filegroup (
157
- name = "cve-data" ,
157
+ name = "cve-data-dir " ,
158
158
srcs = glob (["cve_data/*.json" ]),
159
159
visibility = ["//visibility:public" ],
160
160
)
161
161
162
+ genrule (
163
+ name = "placeholder" ,
164
+ outs = ["PLACEHOLDER.txt" ],
165
+ cmd = "echo '' > $@" ,
166
+ )
167
+
168
+ filegroup (
169
+ name = "empty-directory" ,
170
+ srcs = [":placeholder" ], # default fallback
171
+ visibility = ["//visibility:public" ],
172
+ )
173
+
174
+ label_flag (
175
+ name = "cve-data" ,
176
+ build_setting_default = ":empty-directory" ,
177
+ visibility = ["//visibility:public" ],
178
+ )
179
+
162
180
sh_binary (
163
181
name = "cves" ,
164
182
srcs = ["cves.sh" ],
@@ -194,6 +212,18 @@ genrule(
194
212
export JQ_VERSION_UTILS="$(location :version.jq)"
195
213
export CVES_IGNORED="$(location :ignored-cves.json)"
196
214
export CVES="$(locations :cve-data)"
215
+ read -ra CVELIST <<< "$$CVES"
216
+ HAS_JSON=false
217
+ for f in "$${CVELIST[@]}"; do
218
+ if [[ "$$f" == *.json ]]; then
219
+ HAS_JSON=true
220
+ break
221
+ fi
222
+ done
223
+ if [[ "$$HAS_JSON" != true ]]; then
224
+ echo "No CVE data set, perhaps use --config=cves?" >&2
225
+ exit 1
226
+ fi
197
227
$(location :cves) \
198
228
> $@ || :
199
229
""" ,
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