feat(cve-gate): no image goes out with a new fixable critical or high CVE
CI / Tests, lint (pull_request) Successful in 13s
CI / Tests, lint (pull_request) Successful in 13s
The release gate of NetOrk/netork#1390. The verdict answers "does a rebuild improve on the pin?"; a release needs the other question: does the candidate bring a critical or high CVE that the last release of the same image does not have and that has a fix? Both inventories go to netOrk's matcher in one call (kb-server's POST /api/v1/match, one state of its data), and only new and fixable blocks. A new one without a fix is listed: nobody can close it yet. No verdict never passes, and an empty NETORK_LICENSE_KEY is said so before Trivy runs. kb.netork.io's 401 and 403 come from the licence server's forward-auth and now say what they mean: a licence key where a kb API key belongs, an unknown key, or a plan without feature_match.
This commit is contained in:
1 parent
adf80a7131
commit
1a7319bac4
10 files changed
+640
-10
No files matched your search
+16
-1
@@ -20,7 +20,7 @@ ACTIONS = sorted((ROOT / "actions").glob("*/action.yml"))
|
||||
def test_the_actions():
|
||||
names = [a.parent.name for a in ACTIONS]
|
||||
|
||||
assert names == ["bump", "judge", "sign", "verdict", "verify-base"]
|
||||
assert names == ["bump", "cve-gate", "judge", "sign", "verdict", "verify-base"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("action", ACTIONS, ids=lambda a: a.parent.name)
|
||||
@@ -50,6 +50,21 @@ def test_a_verdict_that_could_not_be_reached_fails_the_step():
|
||||
assert "cat report.md" in step["run"].splitlines()
|
||||
|
||||
|
||||
def test_the_cve_gate_fails_the_step_when_it_blocks_or_cannot_judge():
|
||||
"""The gate's exit code is the step's: 1 for a new fixable CVE, 2 for no verdict
|
||||
(an empty NETORK_LICENSE_KEY included). The report reaches the log either way."""
|
||||
spec = yaml.safe_load((ROOT / "actions/cve-gate/action.yml").read_text())
|
||||
[step] = spec["runs"]["steps"]
|
||||
lines = step["run"].splitlines()
|
||||
|
||||
assert {"release", "candidate", "arch"} <= set(spec["inputs"])
|
||||
assert spec["outputs"]["passed"]["value"] == "${{ steps.gate.outputs.passed }}"
|
||||
assert "python3 -m image_tools.cve_gate" in step["run"]
|
||||
assert "cat cve-gate.md" in lines
|
||||
assert lines[-1] == 'exit "$status"'
|
||||
assert "NETORK_LICENSE_KEY" in spec["description"] and "secrets." not in step["run"]
|
||||
|
||||
|
||||
def test_bumping_needs_its_token_from_the_caller():
|
||||
text = (ROOT / "actions/bump/action.yml").read_text()
|
||||
|
||||
|
||||
Reference in new issue
Block a user