Skip to content

ci(lint): cache dprint plugins and pin plugin integrity checksum#180

Open
DevSecNinja wants to merge 1 commit into
ci/lint-dprint-reliabilityfrom
ci/dprint-plugin-cache-pin
Open

ci(lint): cache dprint plugins and pin plugin integrity checksum#180
DevSecNinja wants to merge 1 commit into
ci/lint-dprint-reliabilityfrom
ci/dprint-plugin-cache-pin

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

Stacked on #179 (base = ci/lint-dprint-reliability). GitHub will auto-retarget this to
main once #179 merges. Review/merge #179 first.

Why

The reusable lint.yml dprint job intermittently hangs (2 min → up to the 6 h default)
because dprint downloads and compiles the markdown WASM plugin from plugins.dprint.dev
on every run
and the plugin cache is never persisted. This PR adds the caching + integrity
piece, split out from #179 (which keeps the pure install_args/timeout hygiene).

What changed

.github/workflows/lint.yml — cache ~/.cache/dprint in the dprint job, keyed on the hash
of the repo's dprint config. The markdown WASM plugin is fetched + compiled once and reused,
removing the per-run network dependency that causes the hang.

config-sync/files/dprint.json (synced to all consumer repos) — pin the plugin with its
sha256 integrity checksum (markdown-0.21.1.wasm@<sha256>) so a tampered or swapped plugin is
rejected. Verified locally: correct hash → exit 0, wrong hash → exit 12.

.renovate/customManagers.json5 — new custom manager tracks dprint plugin versions against
their GitHub releases (dprint/dprint-plugin-<name>), so version bumps still surface
automatically.

⚠️ Tradeoff (checksum + Renovate)

Renovate has no native dprint manager and cannot recompute the WASM sha256. So when the
custom manager opens a plugin-version bump, the @<sha256> becomes stale and the dprint check
on that PR fails until the hash is refreshed with dprint config update. That red check is
the intended signal. If fully hands-off plugin updates are preferred over integrity pinning, drop
the @<sha256> from config-sync/files/dprint.json — the cache alone still fixes the hang.

The new actions/cache action is SHA-pinned (v5.0.5) and kept current by the GitHub Actions
manager.

Validation

actionlint ✅ · yamllint ✅ · dprint config parse ✅ · customManagers.json5 JSON5 ✅ ·
regex extracts markdowndprint/dprint-plugin-markdown @ 0.21.1 ✅. Committed through
lefthook hooks (no --no-verify).

Cache ~/.cache/dprint in the dprint job so the markdown WASM plugin is fetched
and compiled once instead of on every run (the cause of multi-minute dprint
hangs when plugins.dprint.dev is slow). Pin the plugin with its sha256
integrity checksum so a tampered or swapped plugin is rejected, and add a
Renovate custom manager that tracks dprint plugin versions against their GitHub
releases. Renovate cannot recompute the WASM checksum, so a plugin-bump PR will
fail the dprint check until the hash is refreshed with 'dprint config update'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant