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 @@ -150,11 +150,29 @@ envoy_genjson(
150
150
)
151
151
152
152
filegroup (
153
- name = "cve-data" ,
153
+ name = "cve-data-dir " ,
154
154
srcs = glob (["cve_data/*.json" ]),
155
155
visibility = ["//visibility:public" ],
156
156
)
157
157
158
+ genrule (
159
+ name = "placeholder" ,
160
+ outs = ["PLACEHOLDER.txt" ],
161
+ cmd = "echo '' > $@" ,
162
+ )
163
+
164
+ filegroup (
165
+ name = "empty-directory" ,
166
+ srcs = [":placeholder" ], # default fallback
167
+ visibility = ["//visibility:public" ],
168
+ )
169
+
170
+ label_flag (
171
+ name = "cve-data" ,
172
+ build_setting_default = ":empty-directory" ,
173
+ visibility = ["//visibility:public" ],
174
+ )
175
+
158
176
sh_binary (
159
177
name = "cves" ,
160
178
srcs = ["cves.sh" ],
@@ -190,6 +208,18 @@ genrule(
190
208
export JQ_VERSION_UTILS="$(location :version.jq)"
191
209
export CVES_IGNORED="$(location :ignored-cves.json)"
192
210
export CVES="$(locations :cve-data)"
211
+ read -ra CVELIST <<< "$$CVES"
212
+ HAS_JSON=false
213
+ for f in "$${CVELIST[@]}"; do
214
+ if [[ "$$f" == *.json ]]; then
215
+ HAS_JSON=true
216
+ break
217
+ fi
218
+ done
219
+ if [[ "$$HAS_JSON" != true ]]; then
220
+ echo "No CVE data set, perhaps use --config=cves?" >&2
221
+ exit 1
222
+ fi
193
223
$(location :cves) \
194
224
> $@ || :
195
225
""" ,
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