Skip to content

Commit 77d1900

Browse files
committed
Identify temporary vulnerability exclusions in sections in .grype.yaml
1 parent c49855f commit 77d1900

2 files changed

Lines changed: 92 additions & 20 deletions

File tree

.grype.yaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22
# ignore rules for grype, with justification
33
ignore:
44

5+
# {{{ BEGIN VULNERABILITIES WE ARE STILL MONITORING
6+
# Please add temporary/undecided vulnerability exclusions there,
7+
# as opposed to vulnerabilities that we are confident we can exclude.
8+
9+
# go compiler bug introduces potential unverified memory access wr loops with induction variables on under or overflow
10+
- vulnerability: CVE-2026-27143
11+
12+
# system dep, what can we do?
13+
- vulnerability: CVE-2025-68121
14+
package:
15+
name: podman
16+
- vulnerability: CVE-2025-68121
17+
package:
18+
location: /usr/bin/podman
19+
- vulnerability: CVE-2025-68121
20+
package:
21+
location: "/usr/libexec/podman/**"
22+
23+
# }}} END VULNERABILITIES WE ARE STILL MONITORING
24+
25+
# Please place vulnerabilities we have decided upon here.
26+
# Don't add a blanket ignore for a location but use the `exclude:` field at the end of this file.
27+
528
# go crypto/tls vulnerability: programs not used with TLS
629
- vulnerability: CVE-2025-68121
730
package:
@@ -43,20 +66,6 @@ ignore:
4366
package:
4467
location: /var/lib/grafana/plugins/grafana-opensearch-datasource/gpx_opensearch-datasource_linux_amd64
4568

46-
# go compiler bug introduces potential unverified memory access wr loops with induction variables on under or overflow
47-
- vulnerability: CVE-2026-27143
48-
49-
# system dep, what can we do?
50-
- vulnerability: CVE-2025-68121
51-
package:
52-
name: podman
53-
- vulnerability: CVE-2025-68121
54-
package:
55-
location: /usr/bin/podman
56-
- vulnerability: CVE-2025-68121
57-
package:
58-
location: "/usr/libexec/podman/**"
59-
6069
# go crypto/tls vulnerability: programs run by users not admins
6170
- vulnerability: CVE-2025-68121
6271
package:
@@ -83,11 +92,6 @@ ignore:
8392
- package: # opensearch
8493
location: /var/lib/podman/.local/share/containers/storage/overlay/6042fe893e2746bb7637efe59d35909d895c9060b43950db261e692ad3dfb834/diff/usr/lib64/libpython2.7.so.1.0
8594

86-
# kernel rescue image: won't be booted
87-
# CVE-2021-43267, CVE-2021-47378, ...
88-
- package:
89-
location: /boot/vmlinuz-0-rescue-*
90-
9195
# CVE-2023-24531 `go env` command is not used
9296
- vulnerability: CVE-2023-24531
9397
package:
@@ -186,6 +190,19 @@ ignore:
186190
package:
187191
location: /var/www/ood/apps/sys/dashboard/Gemfile.lock
188192

189-
# Exclude podman images from scan, pending MySQL+OpenSearch+Filebeat upgrade
190193
exclude:
194+
# {{{ BEGIN TEMPORARY EXCLUSIONS
195+
# Please add temporary/undecided path exclusions there.
196+
197+
# Exclude podman images from scan, pending MySQL+OpenSearch+Filebeat upgrade
191198
- /var/lib/podman/.local/share/**
199+
200+
# }}} END TEMPORARY EXCLUSIONS
201+
202+
# Please add permanent exclusions here.
203+
# If a file can be excluded because it's not used, just remove it
204+
# from the image in `cleanup.yml`, or replace it with a no-op script like we did for
205+
# rclone.
206+
207+
# kernel rescue image: won't be booted
208+
- /boot/vmlinuz-0-rescue-*

dev/remove-tmp-grype-exclusions.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Remove identified sections from .grype.yaml
4+
"""
5+
6+
import argparse
7+
import logging
8+
import re
9+
import sys
10+
11+
IGNORED_SECTIONS = set(
12+
[
13+
"VULNERABILITIES WE ARE STILL MONITORING",
14+
"TEMPORARY EXCLUSIONS",
15+
]
16+
)
17+
18+
19+
def main():
20+
parser = argparse.ArgumentParser(
21+
description="Remove identified sections from .grype.yaml",
22+
epilog="Redirect output to a new file, like .grype.clean.yaml and call grype with it..."
23+
)
24+
parser.add_argument("grype_yaml", type=argparse.FileType("r", encoding="utf-8"), help=".grype.yaml to modify")
25+
parser.add_argument("-v", "--verbose", action="store_true", help="verbose output")
26+
27+
args = parser.parse_args()
28+
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO, stream=sys.stderr)
29+
30+
section = None
31+
ignore = False
32+
for line in args.grype_yaml:
33+
if section is None:
34+
if m := re.fullmatch(r"""# \{\{\{ BEGIN (.+)\n""", line):
35+
section = m.group(1)
36+
if ignore := section in IGNORED_SECTIONS:
37+
logging.debug("Found starting line for section %s, ignoring until end", section)
38+
else:
39+
logging.debug("Found starting line for section %s, not ignoring", section)
40+
else:
41+
sys.stdout.write(line)
42+
elif m := re.fullmatch(r"""# \}\}\} END %s\n""" % re.escape(section), line):
43+
logging.debug("Found ending line for section %s, will output next lines", section)
44+
section = None
45+
ignore = False
46+
elif not ignore:
47+
logging.debug("In non-ignored section %s, outputting line %s", section, line)
48+
sys.stdout.write(line)
49+
else:
50+
logging.debug("In section %s. Ignoring line %s", section, line)
51+
return 0
52+
53+
54+
if __name__ == "__main__":
55+
sys.exit(main())

0 commit comments

Comments
 (0)