mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
fix(update): drop image_tag suppressions when a version source moves the tag
The docker updater drops the image_tag CVE suppressions of every service it moves to another version. The version-sources updater did not, so each bump left suppressions that named the old tag, and TestCveSuppressions rejected the pull request: PR 1707 moved bigbluebutton from v3.0.39 to v4.0.2 and failed on 10 stale entries. apply_updates now drops them for every service whose version moved. The drop runs after every pin of the file moved, because the pins are addressed by their collected line and the drop removes lines. Replaying PR 1707's bumps on main's bigbluebutton file moves the same 11 pins and leaves no TestCveSuppressions problem. Accepted security finding (unchanged): B603 on utils/update/source.py, reviewed 2026-11-07. 🎯 Fix: 95 % 💥 Break: 2 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 93 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ae42b9ab4
commit
9d982a7fd1
2 files changed
+66
No files matched your search
@@ -110,6 +110,35 @@ bundle:
|
||||
pattern: 'part (v[0-9.]+-v[0-9.]+)'
|
||||
"""
|
||||
|
||||
SUPPRESSED = """\
|
||||
---
|
||||
first:
|
||||
image: example/first
|
||||
version: "v1.0.0"
|
||||
update:
|
||||
type: npm
|
||||
package: first
|
||||
security:
|
||||
suppressions:
|
||||
# nocheck: cve stale tag
|
||||
- image_tag: "v1.0.0"
|
||||
until: 2026-11-30
|
||||
# nocheck: cve accepted
|
||||
- id: CVE-2026-1234
|
||||
until: 2026-11-30
|
||||
second:
|
||||
image: example/second
|
||||
version: "v2.0.0"
|
||||
update:
|
||||
type: npm
|
||||
package: second
|
||||
security:
|
||||
suppressions:
|
||||
# nocheck: cve stale tag
|
||||
- image_tag: "v2.0.0"
|
||||
until: 2026-11-30
|
||||
"""
|
||||
|
||||
|
||||
def _repo(services: str = SERVICES) -> Path:
|
||||
tmp = Path(tempfile.mkdtemp())
|
||||
@@ -198,6 +227,32 @@ class TestOutdated(unittest.TestCase):
|
||||
self.assertEqual(module.outdated([self._entry(root)], root), [])
|
||||
|
||||
|
||||
class TestSuppressions(unittest.TestCase):
|
||||
def test_a_moved_version_drops_its_image_tag_suppressions_and_every_pin_moves(
|
||||
self,
|
||||
) -> None:
|
||||
root = _repo(SUPPRESSED)
|
||||
latest = {"first": "v1.1.0", "second": "v2.1.0"}
|
||||
with (
|
||||
mock.patch.object(module, "manifest_exists", return_value=True),
|
||||
mock.patch.object(
|
||||
module,
|
||||
"candidates",
|
||||
side_effect=lambda entry, _: [latest[entry.entity]],
|
||||
),
|
||||
):
|
||||
updates = module.outdated(module.collect_entries(root), root)
|
||||
module.apply_updates(updates)
|
||||
|
||||
config = root / "roles" / "web-app-example" / ROLE_FILE_META_SERVICES
|
||||
written = config.read_text() # nocheck: cache-read just rewritten here
|
||||
self.assertIn('version: "v1.1.0"', written)
|
||||
self.assertIn('version: "v2.1.0"', written)
|
||||
self.assertNotIn("image_tag", written)
|
||||
self.assertIn("id: CVE-2026-1234", written)
|
||||
self.assertEqual(written.count("security:"), 1)
|
||||
|
||||
|
||||
class TestTemplate(unittest.TestCase):
|
||||
def _outdated(self, services: str, upstream: str) -> list[str]:
|
||||
root = _repo(services)
|
||||
|
||||
Reference in new issue
Block a user