fix(security): pin Argo CD copyutil canary
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 5m50s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 5m50s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -29,6 +29,21 @@
|
||||
"container": "dex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"asset_id": "runtime-image:argocd-copyutil",
|
||||
"source_index_digest": "sha256:16b92ba472fbb9287459cc52e0ecff07288dff461209955098edb56ce866fe49",
|
||||
"platform_digest": "sha256:2f25a42949ea69c0dd33f4ce1918c6a01039d6c14a7ecc1d19088504a9d3e94f",
|
||||
"target_registry_digest": "sha256:8b7e25d7e6036d6750c5bda8920cbd80d8902c25771666f6767dc97bd7fab8fc",
|
||||
"push_ref": "registry.wooo.work/awoooi/runtime-mirror/argocd:v3.3.6-linux-amd64",
|
||||
"runtime_ref": "192.168.0.110:5000/awoooi/runtime-mirror/argocd@sha256:8b7e25d7e6036d6750c5bda8920cbd80d8902c25771666f6767dc97bd7fab8fc",
|
||||
"workload": {
|
||||
"kind": "deployment",
|
||||
"namespace": "argocd",
|
||||
"name": "argocd-dex-server",
|
||||
"container": "copyutil",
|
||||
"container_kind": "init_container"
|
||||
}
|
||||
},
|
||||
{
|
||||
"asset_id": "runtime-image:kured",
|
||||
"source_index_digest": "sha256:2c5d73bb4517a269def38a6cd54d34d82be81793bea9ff1bb35c6533515ad209",
|
||||
|
||||
@@ -47,7 +47,7 @@ class RuntimeImageMirrorControllerTest(unittest.TestCase):
|
||||
|
||||
self.assertEqual(policy.work_item_id, "AIA-P0-006-02A")
|
||||
self.assertEqual(policy.risk_level, "high")
|
||||
self.assertEqual(len(policy.images), 5)
|
||||
self.assertEqual(len(policy.images), 6)
|
||||
self.assertNotIn("github.com", raw)
|
||||
self.assertNotIn("ghcr.io", raw)
|
||||
self.assertIn('"external_pull_allowed": false', raw)
|
||||
@@ -71,9 +71,9 @@ class RuntimeImageMirrorControllerTest(unittest.TestCase):
|
||||
for image in policy.images
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
all(image.workload.container_kind == "container" for image in policy.images)
|
||||
)
|
||||
container_kinds = [image.workload.container_kind for image in policy.images]
|
||||
self.assertEqual(container_kinds.count("container"), 5)
|
||||
self.assertEqual(container_kinds.count("init_container"), 1)
|
||||
|
||||
def test_policy_loads_and_validates_init_container_kind(self) -> None:
|
||||
image = self._image_with_container_kind("init_container")
|
||||
@@ -103,6 +103,27 @@ class RuntimeImageMirrorControllerTest(unittest.TestCase):
|
||||
self.assertNotIn("ghcr.io", raw)
|
||||
self.assertIn('"external_pull_allowed": false', raw)
|
||||
|
||||
def test_argocd_copyutil_canary_matches_verified_staging_contract(self) -> None:
|
||||
policy = controller.load_policy(POLICY_PATH)
|
||||
staging = controller.load_staging_policy(STAGING_POLICY_PATH).images[0]
|
||||
canary = next(
|
||||
image
|
||||
for image in policy.images
|
||||
if image.asset_id == "runtime-image:argocd-copyutil"
|
||||
)
|
||||
|
||||
self.assertEqual(canary.source_index_digest, staging.source_index_digest)
|
||||
self.assertEqual(canary.platform_digest, staging.platform_digest)
|
||||
self.assertEqual(canary.push_ref, staging.push_ref)
|
||||
self.assertEqual(canary.workload, staging.workload)
|
||||
self.assertEqual(
|
||||
canary.target_registry_digest,
|
||||
"sha256:8b7e25d7e6036d6750c5bda8920cbd80d8902c25771666f6767dc97bd7fab8fc",
|
||||
)
|
||||
self.assertTrue(
|
||||
canary.runtime_ref.endswith("@" + canary.target_registry_digest)
|
||||
)
|
||||
|
||||
def test_policy_rejects_external_pull_and_mutable_runtime_ref(self) -> None:
|
||||
payload = json.loads(POLICY_PATH.read_text(encoding="utf-8"))
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
|
||||
Reference in New Issue
Block a user