feat(security): scan this module, and make its own pin check unfoolable - #6
Merged
Conversation
Two things, found one because of the other.
**This repository has never been scanned.** `GET /code-scanning/analyses`
returns `no analysis found` and default setup is `not-configured`. Python is 75%
of the tree and `actions` covers seven deployment workflows that hold apply and
rollback authority. Four of the six public modules are in this state; the other
three are being fixed alongside.
**The catalog parser accepted a file no YAML parser will load.** Adding the
CodeQL caller meant declaring it in `catalog/actions.yml`, and the entry went in
mis-indented by two spaces. `yaml.safe_load` refuses that file outright —
`expected <block end>, but found '-'` — and `validate_module.sh` printed OK.
The reason is in the code this commit replaces: it stripped every line and
looked for `- name:` anywhere, so indentation carried no meaning. A structurally
broken catalog read "fine", and every pin comparison below it ran against
whatever that tolerant scan happened to produce. The check could not tell a
valid catalog from a corrupt one — the same trap as a duplicate YAML key that
`safe_load` swallows while the real validator refuses it.
The module ships no dependencies and CI installs none, so the fix is not PyYAML.
It reads by column and refuses any other shape, plus two invariants worth
stating: an empty registry is a failure rather than a vacuous pass, and a SHA
that is not 40 characters is a failure.
Each guard was proved to refuse bad input rather than merely to pass on good:
mis-indented entry -> catalog/actions.yml:23: catalog entries are exactly …
12-character SHA -> records a 12-character SHA, expected 40
empty actions list -> declares no actions; refusing to pass a check with
nothing to check
and the corrected catalog passes. Pinned to `0.1.4` at the commit that tag
resolves to; see NDDev-OpenNetwork/ci-workflows#45 for why the estate's other
pins cannot be copied.
Verified with `scripts/validate_module.sh` (10 contract tests OK) and actionlint
1.7.12 clean.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things, and the second was found only because of the first.
1. This repository has never been scanned
GET /code-scanning/analysesreturnsno analysis found; default setup isnot-configured. Python is 75% of the tree andactionscovers seven deployment workflows holding apply and rollback authority.Four of the six public modules are in this state — github-device-sync (#25), github-actions (#138), cd-workflows (here) and agent-runtime (#4) — the entire Go control plane plus this one. Secret scanning and push protection were
disabledon all six; both are free for public repositories and are now on.2. This module's pin check accepted a catalog no YAML parser will load
Declaring the new caller in
catalog/actions.ymlput the entry in mis-indented by two spaces.yaml.safe_loadrefuses that file outright:scripts/validate_module.shprinted OK.The parser it replaces stripped every line and looked for
- name:anywhere, so indentation carried no meaning at all. A structurally broken catalog read "fine", and every pin comparison below ran against whatever that tolerant scan produced. The check could not distinguish a valid catalog from a corrupt one — which is the same trap as a duplicate YAML key thatsafe_loadswallows while the real validator refuses it.This is the check added to stop pin comments drifting, so it silently mis-reading its own registry is worth more than the cosmetic error that exposed it.
The module ships no dependencies and CI installs none, so the answer is not PyYAML. It now reads by column and refuses any other shape, with two invariants added: an empty registry fails rather than passing vacuously, and a SHA that is not 40 characters fails.
Each guard proved to refuse, not merely to pass
catalog/actions.yml:23: catalog entries are exactly …sha: "b50364e2a415"records a 12-character SHA, expected 40actions:with no entriesdeclares no actions; refusing to pass a check with nothing to checkVerification
scripts/validate_module.sh→ 10 contract tests OK, pin check OKPinned to
0.1.4at the commit that tag resolves to; see NDDev-OpenNetwork/ci-workflows#45 for why the estate's other pins cannot be copied. Left out ofrequired_contextsuntil it has a green run onmain.