You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deps-scan: report drift on .pre-commit-config.yaml hook revs (#62)
* deps-scan: report drift on .pre-commit-config.yaml hook revs
Adds a new section to .github/scripts/dependency-scan.sh that walks
every repo: block in .pre-commit-config.yaml, asks the upstream Git
host for the highest semver-shaped tag, and reports drift when the
pinned rev: is older. Today every hook in the project's config is on
GitHub, so the lookup uses GET /repos/{owner}/{repo}/tags
unauthenticated — one call per hook is well under the 60 req/h public
limit, no GITHUB_TOKEN coupling needed. Hooks pinned to SHAs, hosted
off GitHub, or sitting under repo: local / repo: meta sentinels are
silently skipped (same pattern as the AWS-creds-gated checks).
New helpers in .github/scripts/lib_dependency_scan.sh:
- extract_precommit_hooks: parses the YAML and emits repo|rev pairs
- get_latest_precommit_hook_release: GitHub-tags lookup with semver
filtering (drops -rc/-beta and date-tagged repos)
Wired into the summary, no-drift early-exit, temp-file cleanup, and
the Markdown report that the deps-scan workflow turns into a GitHub
issue. Also updated .github/CI.md, CONTRIBUTING.md, and the BATS
README to mention the new surface; the BATS suite gets 14 new tests
(6 for the YAML extractor, 8 for the GitHub-API helper using a
PATH-shimmed curl for the network-less branches) bringing the
dep-scan file to 88 tests and the BATS folder to 299 across 9 files.
The presentation deck was refreshed to match the new test counts.
* chore(pre-commit): bump ruff to v0.15.13 and mirrors-mypy to v2.1.0
Picked up by the new pre-commit-hook section of dependency-scan.sh.
Confirmed locally: ruff-format and ruff (legacy alias) still pass on
the full tree at the new rev. The mirrors-mypy v1→v2 jump is the
mirror repo's own versioning scheme and shipped no behavioural change
to the published hook config — entry, language, types_or, args, and
require_serial are byte-identical between v1.19.1 and v2.1.0; the
underlying mypy version follows mypy's own release cadence as before.
The mypy hook in our config has a pre-existing latent issue
(pass_filenames: false with no positional target) that fails on
both v1.19.1 and v2.1.0. Out of scope for this bump — flagged
separately.
* chore(docker): bump python base from 3.14.4 to 3.14.5
Picks up the Debian 13.4 base refresh, which fixes
CVE-2026-27135 (libnghttp2-14 1.64.0-1.1 → 1.64.0-1.1+deb13u1).
Trivy was flagging this on health-monitor, manifest-processor, and
queue-processor; bumping inference-monitor and Dockerfile.dev too
since they share the same base and the same CVE.
3.14.5 is the fifth maintenance release on the 3.14 line and
ships ~113 bugfixes since 3.14.4. No 3.14.x source-incompatible
changes; aws-cdk-lib's LAMBDA_PYTHON_RUNTIME stays on PYTHON_3_14.
Skipped .gitlab-ci.yml on purpose — the file is marked frozen
reference (see top-of-file banner) and the deps-scan workflow
only walks .github/workflows/, so it doesn't double-flag this.
* ci(security): scan Dockerfile.dev in trivy container-scan matrix
Adds a sixth row to the security:trivy:container-scan matrix so the
contributor-side dev image is rebuilt and CVE-scanned on every push
and PR, alongside the four service images and helm-installer.
Why per-PR (not weekly cve-scan): the dev container is what
contributors run gco / cdk / kubectl out of locally, so a CVE there
matters as soon as it lands. Same trigger semantics as the rest of
security.yml, same Trivy invocation, same artifact retention.
Build cost: one extra ~3-5 min image build per run, parallelised
with the other matrix legs and cached via type=gha (scope=dev), so
incremental rebuilds are cheap once the cache is warm.
* ci(dev): pin npm to 11.14.1 for reproducible builds
The nodesource nodejs apt package doesn't pin npm to a specific
patch — it ships whatever was current when the apt cache was last
refreshed — so the dev image's npm version drifts every rebuild.
Pin npm the same way Dockerfile.dev already pins CDK CLI, kubectl,
AWS CLI v2, and Docker CLI: explicit ARG NPM_VERSION, single
`npm install -g npm@${NPM_VERSION}` step, easy for deps-scan to
flag drift on.
NPM_VERSION joins the existing pin family — wiring it into the
deps-scan allowlist + helper lookup follows in a separate commit.
Side benefit: this clears Trivy CVE-2026-33671. npm 11.12.1 (the
version that currently ships with Node 24.x via nodesource) bundles
picomatch@4.0.3 transitively through tinyglobby; npm 11.13.0+
bundles picomatch@4.0.4, which is on the fixed-versions list.
* deps-scan: track NPM_VERSION pin in Dockerfile.dev
Adds NPM_VERSION to the Dockerfile.dev pin allowlist in
extract_dockerfile_pins so it shows up in the deps-scan report,
plus an NPM_VERSION branch in check_dockerfile_pin that hits
registry.npmjs.org/npm/latest (same source as CDK_VERSION) for
the upstream check.
Six pins are now tracked across rebuilds: NODE_MAJOR, NPM_VERSION,
CDK_VERSION, KUBECTL_VERSION, AWSCLI_VERSION, DOCKER_VERSION. The
"finds all five pins" BATS test grew to six and a new test asserts
the NPM_VERSION value is bare semver (no v-prefix) so it concatenates
cleanly into npm install -g npm@${NPM_VERSION}.
Bumps the BATS file to 90 tests. Presentation deck refreshed to
match the new test count.
Copy file name to clipboardExpand all lines: .github/CI.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,8 +162,10 @@ Ecosystems tracked:
162
162
| Helm charts |`lambda/helm-installer/charts.yaml`| Uses `helm show chart` for OCI charts and `helm search repo` for traditional repos |
163
163
| EKS add-ons |`addon_name`/`addon_version` pairs extracted from `gco/stacks/constants.py`| Requires AWS credentials (via OIDC). The script pre-flights `sts get-caller-identity`; without valid creds the add-on section is explicitly **skipped** and the report notes why — everything else still runs |
164
164
| Aurora PostgreSQL engine |`AURORA_POSTGRES_VERSION_DISPLAY` from `gco/stacks/constants.py`| Requires AWS credentials (via OIDC). Queries `rds describe-db-engine-versions` for the latest minor release within the same major line |
165
+
| Pre-commit hooks |`repo:` / `rev:` blocks in `.pre-commit-config.yaml`| Calls `GET /repos/{owner}/{repo}/tags` on GitHub for each hook and reports drift when our pinned `rev:` is older than the highest semver-shaped tag. Unauthenticated; SHA pins and non-GitHub repos are skipped silently |
165
166
| CDK enum constants |`LAMBDA_PYTHON_RUNTIME` and `AURORA_POSTGRES_VERSION` from `gco/stacks/constants.py`| Introspects the installed `aws-cdk-lib` (the `deps-scan` workflow installs the latest) for `aws_lambda.Runtime.PYTHON_X_Y` and `aws_rds.AuroraPostgresEngineVersion.VER_X_Y` and reports drift when our pinned enum is older than the highest member exposed by the library. Skipped with a note when `aws-cdk-lib` isn't importable |
166
167
| Python release |`LAMBDA_PYTHON_RUNTIME` (the major Python version we standardise on across Lambdas) | Queries `https://endoflife.date/api/python.json` for the highest currently-supported stable cycle and reports drift compared to the `LAMBDA_PYTHON_RUNTIME` constant. Public endpoint, no AWS creds |
168
+
| Pre-commit hooks |`repo:` / `rev:` pairs in `.pre-commit-config.yaml`| Queries `api.github.com/repos/<owner>/<repo>/tags` for each hook and compares against the pinned `rev:`. Uses `GITHUB_TOKEN` for the authenticated rate limit when CI runs the workflow. SHA-pinned hooks and non-GitHub repos are silently skipped — no false drift |
167
169
168
170
Images matching `gco/*` are skipped (we build those). Non-semver tags (`latest`, branch names, SHAs) are ignored.
169
171
@@ -203,6 +205,7 @@ The console output shows each surface's drift inline. To trigger the exact workf
203
205
-**New Helm chart** — nothing to change; the script walks every entry in `lambda/helm-installer/charts.yaml`.
204
206
-**New EKS add-on** — add the constant in `gco/stacks/constants.py` and reference it in `regional_stack.py`. The scanner imports from the constants module.
205
207
-**New Aurora engine version** — update `AURORA_POSTGRES_VERSION` and `AURORA_POSTGRES_VERSION_DISPLAY` in `gco/stacks/constants.py`.
208
+
-**New pre-commit hook** — nothing to change; `extract_precommit_hooks` walks every `repo:` block in `.pre-commit-config.yaml` and the GitHub-tags lookup picks up the hook automatically (as long as the upstream lives on GitHub and tags semver-shaped releases).
206
209
-**New CDK enum constant** — add the constant in `gco/stacks/constants.py`, then add a comparison block in `dependency-scan.sh`'s "Checking CDK enum constants" section that calls a new `get_latest_<name>` helper from `lib_dependency_scan.sh`. Pattern-match the existing `LAMBDA_PYTHON_RUNTIME` and `AURORA_POSTGRES_VERSION` blocks.
0 commit comments