Skip to content

Commit a686d44

Browse files
committed
twoliter: add check-advisories task to lint BRSAs
Lint BRSAs for non-ASCII characters that may be included in advisory information in a new task, check-advisories. Also ensure that each directory under "advisories" in a project has an associated tag on the project Add this to the list in the meta task "check" Signed-off-by: Gavin Inglis <[email protected]>
1 parent 2519e56 commit a686d44

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

twoliter/embedded/Makefile.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ done
416416
[tasks.check]
417417
dependencies = [
418418
"check-cargo-version",
419+
"check-advisories",
419420
"unit-tests",
420421
"check-fmt",
421422
"check-lints",
@@ -540,6 +541,31 @@ fi
540541
'''
541542
]
542543

544+
# Task to lint Bottlerocket Security Advisories by checking for non-ASCII characters
545+
# and verifying that each versioned directory under "advisories" has a corresponding
546+
# tag on the Twoliter project this task runs against.
547+
[tasks.check-advisories]
548+
script_runner = "bash"
549+
script = [
550+
'''
551+
if find advisories -name '*.toml' -type f >/dev/null 2>&1 ; then
552+
export LC_ALL=C
553+
if grep --include '*.toml' -R -l -P ['\x80'-'\xFF'] advisories ; then
554+
echo "error: found non-ASCII characters in advisories" >&2
555+
exit 1
556+
fi
557+
558+
for version in $(find advisories/* -type d -not -path advisories/staging); do
559+
grep v$(basename ${version})$ <(PAGER= git tag)
560+
if [ "$?" -ne 0 ]; then
561+
echo "error: no corresponding tag found for ${version} directory"
562+
exit 1
563+
fi
564+
done
565+
fi
566+
'''
567+
]
568+
543569
[tasks.check-golangci-lint]
544570
script = [
545571
'''

0 commit comments

Comments
 (0)