test_every_action_is_pinned_by_commit_sha¶
Tests › tests/test_hosting.py
What this test is for
Why it exists
Workflows and the composite action: `owner/action@<40-hex sha>` or a local path.
Verifies REQ-DDB-WIKI-039
Given
files = [ *(REPO / ".github" / "workflows").glob("*.yml"), *(REPO / ".github" / "actions").rglob("action.yml"), ]loose = [ (f.relative_to(REPO).as_posix(), use) for f in files for use in _uses(yaml.safe_load(f.read_text())) if not use.startswith("./") and not _SHA.match(use) ]
When
- —
Then
- ✓ any("actions" in f.parts for f in files) holds
- ✓ loose equals []
What this test is for
Why it exists
S2, 1.1.0 AUDIT. A mutable ref means the code that runs in CI is chosen by whoever can move that ref, and `pypa/gh-action-pypi-publish@release/v1` was a BRANCH in the job holding the publishing credential — a force-push to it publishes anything it likes as this project. A local `./.github/workflows/...` call is exempt: it names this repository at this commit.
Verifies REQ-DDB-WIKI-039
Given
offenders = [ f"{where}: {ref}" for where, ref in _action_refs() if not ref.startswith("./") and not _SHA_RE.match(ref.partition("@")[2].split()[0]) ]
When
- —
Then
- ✓ offenders is false
tests/test_hosting.py:52 · its file's page
What it checks (2)
assert any("actions" in f.parts for f in files), "the composite action must exist"not attributedassert loose == [], f"actions not pinned by commit SHA: {loose}"observes_usesvialoose
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_every_action_is_pinned_by_commit_sha→_usesWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
tests/test_packaging.py:307 · its file's page
What it checks (1)
assert not offenders, ( "these action references are mutable, so the code CI runs is chosen by whoever can " f"move the ref: {offenders}" )observes_action_refsviaoffenders
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_every_action_is_pinned_by_commit_sha→_action_refsWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-WIKI-039 | catalog | unknown |