Compare commits

..
Author SHA1 Message Date
chrnx 9d82ec0f1f Merge pull request 'ci: move the audit off the release gate and onto a schedule' (#10) from ci/audit-out-of-the-release-gate into main
CI / build (push) Successful in 11s
Release → dist.tar.gz / package (push) Has been skipped
Promote → GitHub / push-github (push) Successful in 4s
Reviewed-on: #10
2026-08-07 22:02:12 +00:00
chrnx 6fbff8eab9 Merge branch 'main' into ci/audit-out-of-the-release-gate
CI / build (pull_request) Successful in 12s
2026-08-07 21:59:46 +00:00
chrnx 3772222118 Merge pull request 'chore: version 26.8.1-beta.0 and clear the nanoid advisory' (#9) from chore/version-26.8.1-beta.0 into main
Promote → GitHub / push-github (push) Successful in 5s
CI / build (push) Successful in 11s
Reviewed-on: #9
2026-08-07 21:59:35 +00:00
chrnx aa279c31f1 ci: move the audit off the release gate and onto a schedule
CI / build (pull_request) Failing after 9s
Two advisories landed in this tree in a single day — js-yaml in the morning,
nanoid a couple of hours later. Neither had anything to do with a code change.
A release gated on `npm audit` fails by calendar date, and it fails at the
exact moment there is least time to judge whether a fix is safe.

What ships from here is built HTML, CSS and JS. Astro, js-yaml and nanoid are
build-time tools that never reach a visitor; the advisories in question need
control over build inputs to matter, and an attacker with that has already won.

So the release gate drops to `critical` — a tripwire for the catastrophic case,
not a trigger for routine noise. Nothing is lowered anywhere else: ci.yml still
blocks every PR at moderate, which is where there is time and context to fix.

The new scheduled audit is what makes that safe rather than negligent. Monday
mornings on Gitea, filing an internal issue when something turns up, with a
dedup check so a weekly cron cannot open 52 copies. Learning about a
vulnerability and being unable to publish stop being the same event.

`workflow_dispatch` is included so it can be run and verified on demand.
2026-08-07 16:54:48 -05:00
chrnx 6a19f2981a chore: version 26.8.1-beta.0 and clear the nanoid advisory
CI / build (pull_request) Successful in 12s
v26.8.0-beta.0 was released on 2026-08-03 and `verify:release` requires the
tag to equal `v${package.json.version}` exactly. Re-tagging the same version
would work — `prepare` deletes and recreates the release on purpose — but it
would silently replace the August 3 archive with different content, leaving
two deploys behind one version number and a rollback that means nothing.

CalVer has a patch digit for this, so: 26.8.1-beta.0.

Also bumps nanoid to 3.3.18. GHSA-2v37-7h3g-55p8 (high) was published after
the js-yaml fix landed and would have failed the release audit gate on its
own. Non-breaking, and in scope here since it blocks the very release this
version exists to enable.

Verified: `npm audit --audit-level=moderate` reports 0 vulnerabilities,
`npm run check` passes, `RELEASE_TAG=v26.8.1-beta.0 npm run verify:release`
passes and the old tag is correctly rejected.
2026-08-07 16:49:39 -05:00
chrnx 67a1b48394 Merge pull request 'feat: add privacy-friendly analytics (GoatCounter)' (#7) from feat/analytics into main
Promote → GitHub / push-github (push) Successful in 5s
CI / build (push) Successful in 11s
Reviewed-on: #7
2026-08-07 19:49:02 +00:00
4 changed files with 72 additions and 7 deletions

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
name: Dependency audit
# Weekly, on GITEA ONLY — this is maintenance, so it belongs in the internal tracker.
#
# This is the counterpart that makes release.yml's relaxed gate safe rather than
# negligent. Advisories still get found; they just arrive as an issue on Monday
# morning instead of as a failed release on a Friday afternoon. Learning about a
# vulnerability and being unable to publish should not be the same event.
on:
schedule:
- cron: '0 13 * * 1' # Mondays, 07:00 America/Mexico_City
workflow_dispatch: # so it can be run — and tested — on demand
jobs:
audit:
if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm ci
- name: Audit
id: audit
run: |
if npm audit --audit-level=moderate > audit.txt 2>&1; then
echo 'clean=true' >> "$GITHUB_OUTPUT"
else
echo 'clean=false' >> "$GITHUB_OUTPUT"
fi
cat audit.txt
- name: File an issue
if: steps.audit.outputs.clean == 'false'
env:
GT_TOKEN: ${{ github.token }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TITLE: 'Dependency advisories: npm audit is failing'
run: |
set -eu
# One open issue at a time. A weekly cron must not file 52 duplicates.
open=$(curl -sSL -H "Authorization: token $GT_TOKEN" \
"$API/issues?state=open&type=issues" \
| jq --arg t "$TITLE" '[.[] | select(.title == $t)] | length')
if [ "$open" != "0" ]; then
echo "An issue is already open. Nothing to file."
exit 0
fi
body=$(printf '`npm audit --audit-level=moderate` failed on the scheduled run.\n\nThe release gate does not fail on this by design — see the comment in `release.yml`. A static site ships built HTML, not `node_modules`, so a build-time advisory does not reach a visitor. This issue is how it reaches you instead.\n\nFix it in a normal PR, on your own schedule.\n\n```\n%s\n```\n' "$(head -c 4000 audit.txt)")
jq -n --arg t "$TITLE" --arg b "$body" '{title: $t, body: $b}' \
| curl -sS -X POST -H "Authorization: token $GT_TOKEN" \
-H 'Content-Type: application/json' -d @- "$API/issues" > /dev/null
echo "Issue filed."
+9 -1
View File
@@ -24,7 +24,15 @@ jobs:
- name: Validate release tag - name: Validate release tag
run: npm run verify:release run: npm run verify:release
- run: npm ci - run: npm ci
- run: npm audit --audit-level=moderate # Deliberately `critical`, not `moderate`. npm audit reads a live advisory feed,
# so a release gated on it fails by calendar date rather than by anything the
# release changed — and it fails at the exact moment there is least time to judge
# whether a fix is safe. What ships here is built HTML, CSS and JS: Astro, js-yaml
# and friends are build-time tools that never reach a visitor. `critical` keeps a
# tripwire for the catastrophic case without breaking releases on routine noise.
# Moderate and up still gate every PR in ci.yml, and audit.yml files an issue on a
# schedule, so advisories still surface — just not as a broken release.
- run: npm audit --audit-level=critical
- run: npm run check - run: npm run check
- name: Package dist/ - name: Package dist/
run: tar -czf "$ARCHIVE_NAME" -C dist . run: tar -czf "$ARCHIVE_NAME" -C dist .
+5 -5
View File
@@ -1,12 +1,12 @@
{ {
"name": "green-tea-site", "name": "green-tea-site",
"version": "26.8.0-beta.0", "version": "26.8.1-beta.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "green-tea-site", "name": "green-tea-site",
"version": "26.8.0-beta.0", "version": "26.8.1-beta.0",
"dependencies": { "dependencies": {
"@astrojs/mdx": "^7.0.5", "@astrojs/mdx": "^7.0.5",
"@astrojs/rss": "^4.0.19", "@astrojs/rss": "^4.0.19",
@@ -4822,9 +4822,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.16", "version": "3.3.18",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
"integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "green-tea-site", "name": "green-tea-site",
"type": "module", "type": "module",
"version": "26.8.0-beta.0", "version": "26.8.1-beta.0",
"engines": { "engines": {
"node": ">=22.12.0" "node": ">=22.12.0"
}, },