Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
chore(deps): track compose images and flag a stale node:22-slim digest
Yudhi Armyndharis259752eecadb
diff --git a/.github/dependabot.yml b/.github/dependabot.ymlindex aa47e7f52..d5d7c3703 100644--- a/.github/dependabot.yml+++ b/.github/dependabot.yml@@ -146,9 +146,13 @@ updates:labels:- ci- # Base images (Dockerfile) + the compose stack's pinned images (socket-proxy, postgres,- # redis, minio). Keeps the security-critical docker-socket-proxy pin and the datastore- # images moving instead of drifting on a stale tag.+ # Base image (Dockerfile only: node:22-slim@digest in both stages). This ecosystem does not+ # read docker-compose.yml; the entry below does. It proposes a tag bump when an allowed one+ # exists and otherwise a refreshed 22-slim digest. The digest pinned on 2026-08-13 still+ # stayed for weeks while the tag moved, so the base-image-drift job in security-scan.yml+ # backstops a refresh that is late or left unmerged: it fails once the pin differs from what+ # the tag serves and either the tag has served that image for 7 or more days, or for 3 or+ # more days with the pin last changed 28 or more days ago.- package-ecosystem: dockerdirectory: /schedule:@@ -161,7 +165,35 @@ updates:ignore:# A Node major moves by hand, together with the CI Node version, the @types/node ignore above# and the amd64/arm64 build and browser-launch smoke (#783 proposed 26 before its LTS date,- # #1684 proposed 25, which never became one). Digest refreshes of node:22-slim and the other- # images still come through.+ # #1684 proposed 25, which never became one). Digest refreshes of node:22-slim are not+ # affected by this ignore.- dependency-name: "node"update-types: ["version-update:semver-major"]++ # The compose stack's pinned images (docker-compose.yml): socket-proxy, postgres, redis, minio.+ # A postgres, redis or minio bump fails src/modules/docker/compose-parity.spec.ts until the same+ # tag is set in src/modules/docker/docker.service.ts; that failure is intended, so edit both on+ # the Dependabot branch. tecnativa/docker-socket-proxy has no such mirror and no CI gate on its+ # behaviour: review its release notes against the allow-list in docker-compose.yml and re-run+ # scripts/smoke-test-docker-proxy.sh by hand before merging one.+ - package-ecosystem: docker-compose+ directory: /+ schedule:+ interval: weekly+ day: monday+ open-pull-requests-limit: 3+ labels:+ - dependencies+ - docker+ ignore:+ # A PostgreSQL major cannot open the previous major's data directory: a 16 -> 17 bump merged+ # as-is stops every existing openwa-postgres volume from starting. It moves by hand, with a+ # dump/restore or pg_upgrade note.+ - dependency-name: "postgres"+ update-types: ["version-update:semver-major"]+ # Redis 8 changes the license and must stay in step with the CI service containers+ # (ci.yml, release.yml), which no ecosystem updates. A deliberate, by-hand move.+ - dependency-name: "redis"+ update-types: ["version-update:semver-major"]+ # Being replaced (#1729), and the registry no longer serves the image.+ - dependency-name: "minio/minio"diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.ymlindex c38142dfc..927c315cb 100644--- a/.github/workflows/security-scan.yml+++ b/.github/workflows/security-scan.yml@@ -64,6 +64,58 @@ jobs:- name: Security audit (dashboard)run: cd dashboard && npm audit --audit-level=high+ # Dependabot proposes refreshed node:22-slim digests, yet the pin has trailed the tag for weeks+ # (a refresh that is late or left unmerged), and a stale base ages silently: Node patch releases+ # and Debian fixes that the image scan below does not flag (medium/low, or not yet fixed upstream)+ # stay out. This compares the pin with what the tag serves today. The tag can sit unchanged for+ # weeks, so the pin's age alone cannot tell a late refresh from a tag that moved yesterday: the+ # run fails only once the tag has served the newer image for 7 days (a Monday Dependabot run has+ # seen it), or once the pin is 28 days old and the tag has served the newer image for 3 days (the+ # Wednesday scan then follows a Monday run that saw it). The first move after a quiet month still+ # gets its Monday run, and a tag that keeps moving holds a stale pin only while every move lands+ # in the three days before a scan.+ base-image-drift:+ name: Base image drift+ runs-on: ubuntu-latest+ timeout-minutes: 10+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7+ with:+ # The pin's age comes from git history; a shallow clone would date every pin to today.+ fetch-depth: 0++ - name: Compare the Dockerfile pin with node:22-slim+ run: |+ pins=$(grep -oE 'node:22-slim@sha256:[0-9a-f]{64}' Dockerfile | sort -u)+ if [ "$(printf '%s\n' "$pins" | grep -c .)" -ne 1 ]; then+ echo "::error file=Dockerfile::expected one node:22-slim digest shared by both stages, found: ${pins:-none}"+ exit 1+ fi+ pinned=${pins#node:22-slim@}+ # A registry outage or rate limit is not drift.+ if ! live=$(docker buildx imagetools inspect docker.io/node:22-slim --format '{{.Manifest.Digest}}'); then+ echo "::warning::could not resolve docker.io/node:22-slim; drift not checked this run"+ exit 0+ fi+ if [ "$pinned" = "$live" ]; then+ echo "node:22-slim pin is current: $pinned"+ exit 0+ fi+ # The live image's build time stands in for when the tag moved; the push follows it by minutes.+ if ! created=$(docker buildx imagetools inspect docker.io/node:22-slim --format '{{json .Image}}' |+ jq -er '.["linux/amd64"].created | sub("\\.[0-9]+"; "") | fromdateiso8601'); then+ echo "::warning::could not read when node:22-slim $live was built; drift not checked this run"+ exit 0+ fi+ live_days=$(( ($(date +%s) - created) / 86400 ))+ age_days=$(( ($(date +%s) - $(git log -1 --format=%ct -G 'node:22-slim@sha256' -- Dockerfile)) / 86400 ))+ if [ "$live_days" -lt 7 ] && { [ "$age_days" -lt 28 ] || [ "$live_days" -lt 3 ]; }; then+ echo "::notice::node:22-slim moved to $live $live_days day(s) ago; the $age_days-day-old pin $pinned is inside the grace"+ exit 0+ fi+ echo "::error file=Dockerfile::node:22-slim pin $pinned is $age_days days old and the tag now serves $live; refresh both FROM lines"+ exit 1+# Mirrors the release.yml `image-scan` job, minus the staging ref: this scans the image the# release pipeline actually promoted, on both architectures.image-scan:diff --git a/Dockerfile b/Dockerfileindex a0b864791..c5c87f5bc 100644--- a/Dockerfile+++ b/Dockerfile@@ -10,9 +10,12 @@# The per-arch runtime deps are installed natively in the target-platform production stage below.# NOTE: $BUILDPLATFORM requires BuildKit (CI uses buildx; modern `docker build`/compose default to it).# The digest pins the multi-arch node:22-slim index, so every build starts from the same immutable-# base; dependabot's docker ecosystem proposes the new digest when the tag moves. Update tag and-# digest together.-FROM --platform=$BUILDPLATFORM docker.io/node:22-slim@sha256:d649c27dae7ba0137b3cef5dd75baa422c08dc3d9e3fc0c23dfb172dc3cc6436 AS builder+# base. Dependabot proposes a refreshed digest when the tag moves; if none has arrived, refresh by+# hand (`docker buildx imagetools inspect docker.io/node:22-slim`). The base-image-drift job in+# security-scan.yml fails once the pin differs from what the tag serves and either the tag has+# served that image for 7 or more days, or for 3 or more days with the pin last changed 28 or more+# days ago. Update both stages together.+FROM --platform=$BUILDPLATFORM docker.io/node:22-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c AS builderWORKDIR /app@@ -59,7 +62,7 @@ RUN npm run build && npm run dashboard:ci -- --include=dev && npm run dashboard:# ===== Stage 2: Production =====# Same digest-pinned node:22-slim base as the builder stage.-FROM docker.io/node:22-slim@sha256:d649c27dae7ba0137b3cef5dd75baa422c08dc3d9e3fc0c23dfb172dc3cc6436 AS production+FROM docker.io/node:22-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c AS production# Run the app with production defaults from the first boot: an unset NODE_ENV selects the# development branch of the CORS/Swagger/DTO-error-detail/default-secret hardening (main.ts@@ -221,8 +224,9 @@ RUN npm ci --omit=dev --ignore-scripts \# Replace the npm the base image bundles. npm is not on the request path — the entrypoint runs# `node dist/main` — but it stays in the image because the operator runbooks drive it# (`docker exec openwa npm run cli …`, `npm run export`), and its own bundled dependency tree is-# what the release image scan reports. node:22-slim currently ships npm 10.9.8, whose bundle-# carries a critical node-tar advisory plus sigstore/picomatch ones; npm 12 fixes all three.+# what the release image scan reports. node:22-slim ships npm 10.9 (10.9.9 at the pinned digest),+# whose bundle has carried a critical node-tar advisory plus sigstore/picomatch ones; npm 12 fixes+# all three.# Deliberately AFTER `npm ci`, so the application tree is still resolved by the npm the lockfile# was generated with and only the global CLI is swapped. Pinned to the exact patch release —# a floating npm@12 would make the image's bundled npm tree depend on when the build happened.diff --git a/docs/04-security-design.md b/docs/04-security-design.mdindex 30fae4f45..5b1699935 100644--- a/docs/04-security-design.md+++ b/docs/04-security-design.md@@ -689,7 +689,7 @@ npm audit --json > audit-report.json```yaml# .github/dependabot.yml, root npm ecosystem only (the file also covers /dashboard,-# github-actions and docker). The comment above each ignore is omitted here.+# github-actions, docker and docker-compose). The comment above each ignore is omitted here.version: 2updates:- package-ecosystem: npm@@ -733,7 +733,7 @@ tar-stream from 3.2.1). Each ignore's reason and lift condition is the comment a### Security Scanning in CI-> **Aspirational template — not in the repo.** There is no Snyk and no CodeQL workflow today. The actual dependency check is a dedicated `audit` job ("Security audit") in `ci.yml`, on push/PR. It is deliberately its own job rather than a step inside Lint: an advisory published against an unrelated dependency would otherwise abort the job before ESLint, the type-check and the drift gates ever ran. It runs `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/`. Both fence `high` rather than `critical`, because the `overrides` in `package.json` clear the root tree's existing HIGH advisories, so the threshold fences regressions. `check:audit` applies that threshold per advisory instead of all-or-nothing: an advisory with no patched version can be excused by id in `scripts/check-audit.mjs`, with its reason and its removal condition recorded beside it, rather than dropping the whole job to `critical` — and an allowlist entry whose advisory has since gone fails the job too, so an exception cannot outlive its cause. The dashboard keeps the plain form: it has nothing to excuse and stays the stricter of the two. Between releases, `.github/workflows/security-scan.yml` (Scheduled Security Scan) repeats that job every Wednesday at 03:00 UTC and on demand, together with the release Trivy scan against the published `latest` image on amd64 and arm64. The workflow below is a recommended setup to add if you want Snyk and SAST; its scheduled `npm audit` is already covered by `security-scan.yml`.+> **Aspirational template — not in the repo.** There is no Snyk and no CodeQL workflow today. The actual dependency check is a dedicated `audit` job ("Security audit") in `ci.yml`, on push/PR. It is deliberately its own job rather than a step inside Lint: an advisory published against an unrelated dependency would otherwise abort the job before ESLint, the type-check and the drift gates ever ran. It runs `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/`. Both fence `high` rather than `critical`, because the `overrides` in `package.json` clear the root tree's existing HIGH advisories, so the threshold fences regressions. `check:audit` applies that threshold per advisory instead of all-or-nothing: an advisory with no patched version can be excused by id in `scripts/check-audit.mjs`, with its reason and its removal condition recorded beside it, rather than dropping the whole job to `critical` — and an allowlist entry whose advisory has since gone fails the job too, so an exception cannot outlive its cause. The dashboard keeps the plain form: it has nothing to excuse and stays the stricter of the two. Between releases, `.github/workflows/security-scan.yml` (Scheduled Security Scan) repeats that job every Wednesday at 03:00 UTC and on demand, together with the release Trivy scan against the published `latest` image on amd64 and arm64, and a `base-image-drift` job that fails when the Dockerfile's two `node:22-slim` FROM digests disagree, or when the pin differs from what the tag serves today and either the tag has served that image for 7 or more days, or for 3 or more days with the pin last changed 28 or more days ago. The workflow below is a recommended setup to add if you want Snyk and SAST; its scheduled `npm audit` is already covered by `security-scan.yml`.```yaml# .github/workflows/security.ymldiff --git a/docs/10-devops-infrastructure.md b/docs/10-devops-infrastructure.mdindex 16458ac15..c3d378439 100644--- a/docs/10-devops-infrastructure.md+++ b/docs/10-devops-infrastructure.md@@ -327,7 +327,11 @@ environments and no auto-deploy on merge.gates with a weekly run (Wednesdays 03:00 UTC, plus `workflow_dispatch`): it re-runs the exact`audit` job against the current dependency trees and the release workflow's `image-scan` againstthe published `latest` image on both architectures. A newly published advisory therefore turns-something red within days instead of waiting for the next push or release.+something red within days instead of waiting for the next push or release. A third job,+`base-image-drift`, fails when the two `node:22-slim` FROM lines in the `Dockerfile` pin different+digests, or when the pin differs from what the tag serves today and either the tag has served that+image for 7 or more days, or for 3 or more days with the pin last changed 28 or more days ago; merge+the pending Dependabot digest refresh, or refresh both FROM lines by hand.## 10.4 Deployment Architecturediff --git a/docs/16-risk-management.md b/docs/16-risk-management.mdindex fb24b5ac6..4e69aeae6 100644--- a/docs/16-risk-management.md+++ b/docs/16-risk-management.md@@ -312,7 +312,7 @@ Dependencies (`whatsapp-web.js`, Puppeteer, NestJS, etc.) may have vulnerabiliti**Mitigation Strategies:**-> **Current state:** the real dependency check is a dedicated `audit` job in `ci.yml` running `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/` (on push and PR); it is deliberately split out of the `Lint` job so a newly published advisory cannot abort the other quality gates. `check:audit` keeps the `high` threshold but applies it per advisory, so one with no patched version can be excused by id in `scripts/check-audit.mjs` — with its reason and removal condition recorded, and a stale entry failing the job — instead of lowering the bar for everything. `release.yml` repeats both and additionally runs a Trivy image scan (`CRITICAL,HIGH`, `ignore-unfixed`) against an explicit `.trivyignore` before the release tags are promoted. Dependabot PRs cover npm for `/` and `/dashboard` (weekly), GitHub Actions (monthly) and Docker base/compose images (weekly), with version-pinned ignores (seven in the root tree, two in `/dashboard`) whose reasons and lift conditions are recorded in `.github/dependabot.yml`. Between releases, `.github/workflows/security-scan.yml` (Scheduled Security Scan) runs every Wednesday at 03:00 UTC and on demand: it repeats the `audit` job and the release Trivy scan against the published `latest` image on amd64 and arm64, so an advisory those gates would block fails a run within a week of being published; the amd64 Chrome for Testing binary stays outside what Trivy can see (see `.trivyignore`). There is **no** Snyk integration. The workflow below is a recommended enhancement to add Snyk; its scheduled `npm audit` is already covered by `security-scan.yml`.+> **Current state:** the real dependency check is a dedicated `audit` job in `ci.yml` running `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/` (on push and PR); it is deliberately split out of the `Lint` job so a newly published advisory cannot abort the other quality gates. `check:audit` keeps the `high` threshold but applies it per advisory, so one with no patched version can be excused by id in `scripts/check-audit.mjs` — with its reason and removal condition recorded, and a stale entry failing the job — instead of lowering the bar for everything. `release.yml` repeats both and additionally runs a Trivy image scan (`CRITICAL,HIGH`, `ignore-unfixed`) against an explicit `.trivyignore` before the release tags are promoted. Dependabot PRs cover npm for `/` and `/dashboard` (weekly), GitHub Actions (monthly), the Dockerfile base image and the `docker-compose.yml` images (weekly; PostgreSQL and Redis majors and MinIO ignored), with version-pinned ignores (seven in the root tree, two in `/dashboard`) whose reasons and lift conditions are recorded in `.github/dependabot.yml`. Between releases, `.github/workflows/security-scan.yml` (Scheduled Security Scan) runs every Wednesday at 03:00 UTC and on demand: it repeats the `audit` job and the release Trivy scan against the published `latest` image on amd64 and arm64, so an advisory those gates would block fails a run within a week of being published; the amd64 Chrome for Testing binary stays outside what Trivy can see (see `.trivyignore`). Its `base-image-drift` job fails when the Dockerfile's two `node:22-slim` FROM digests disagree, or when the pin differs from what the tag serves today and either the tag has served that image for 7 or more days, or for 3 or more days with the pin last changed 28 or more days ago; it backstops a Dependabot digest refresh that is late or left unmerged. There is **no** Snyk integration. The workflow below is a recommended enhancement to add Snyk; its scheduled `npm audit` is already covered by `security-scan.yml`.```yaml# .github/workflows/security.yml@@ -345,9 +345,9 @@ jobs:| ----------------------------------------------------------------------------------------- | ---------------------------- || npm audit (`high`, per-advisory allowlist via `check:audit`; dedicated `audit` job in CI) | Every push / PR || Trivy image scan (`CRITICAL,HIGH`, `.trivyignore`) | Every release |-| Scheduled Security Scan (audit + Trivy on the published `latest` image, amd64 and arm64) | Weekly (Wednesday 03:00 UTC) |+| Scheduled Security Scan (audit, Trivy on `latest` amd64 and arm64, base-image drift) | Weekly (Wednesday 03:00 UTC) || Snyk scan | Not configured (planned) |-| Dependabot PRs (npm: `/` and `/dashboard`; docker) | Weekly |+| Dependabot PRs (npm: `/` and `/dashboard`; docker; docker-compose) | Weekly || Dependabot PRs (github-actions) | Monthly || Major updates | Reviewed manually || Security patches | Immediate |diff --git a/src/common/docs-ci-jobs.spec.ts b/src/common/docs-ci-jobs.spec.tsindex f2bc1f4b7..a87a1772f 100644--- a/src/common/docs-ci-jobs.spec.ts+++ b/src/common/docs-ci-jobs.spec.ts@@ -1,5 +1,8 @@-import { readFileSync } from 'node:fs';+import { spawnSync } from 'node:child_process';+import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';import { join } from 'node:path';+import * as yaml from 'js-yaml';/*** `docs/09-testing-strategy.md` §9.6 restates the jobs in `.github/workflows/ci.yml` so a contributor@@ -73,3 +76,159 @@ describe('docs/09 §9.6 matches the CI workflow', () => {expect(listed?.[1].split('/')).toEqual(needsOf('build'));});});++/**+ * `docs/10` §10.3 lists what the Scheduled Security Scan runs. A job added to that workflow can turn+ * the weekly run red, so a reader who meets the failure must find the job named there.+ */+describe('docs/10 names every Scheduled Security Scan job', () => {+ const read = (...parts: string[]): string => readFileSync(join(__dirname, '..', '..', ...parts), 'utf8');++ it('mentions each job id in backticks', () => {+ const yaml = read('.github', 'workflows', 'security-scan.yml');+ const jobs = [...yaml.slice(yaml.indexOf('\njobs:\n')).matchAll(/^ {2}([a-z][a-z0-9-]*):$/gm)].map(m => m[1]);+ const doc = read('docs', '10-devops-infrastructure.md');+ const paragraph = doc.slice(doc.indexOf('`.github/workflows/security-scan.yml`'), doc.indexOf('## 10.4'));++ expect(jobs.length).toBeGreaterThan(1);+ expect(jobs.filter(job => !paragraph.includes(`\`${job}\``))).toEqual([]);+ });+});++/**+ * docs/04 and docs/16 describe `base-image-drift` in prose. It fails on either of two conditions, and+ * the docs/16 policy table lists what the weekly run checks, so a reader who meets a red run must find+ * both the job and the condition that tripped it.+ */+describe('docs/04 and docs/16 describe the base-image-drift job in full', () => {+ const read = (...parts: string[]): string => readFileSync(join(__dirname, '..', '..', ...parts), 'utf8');++ it.each(['04-security-design.md', '16-risk-management.md'])('%s gives both failure conditions', file => {+ const lines = read('docs', file)+ .split('\n')+ .filter(line => line.includes('`base-image-drift`'));++ expect(lines.length).toBeGreaterThan(0);+ for (const line of lines) {+ expect(line).toMatch(/FROM digests disagree/);+ expect(line).toMatch(+ /served that image for 7 or more days, or for 3 or more days with the pin last changed 28 or more days ago/,+ );+ }+ });++ it('lists the drift check in the docs/16 policy table row', () => {+ const row = read('docs', '16-risk-management.md')+ .split('\n')+ .find(line => line.startsWith('| Scheduled Security Scan'));++ expect(row).toMatch(/base-image drift/);+ });+});++/**+ * The drift step runs against stubbed `docker` and `git`, so its grace can be checked without a+ * registry. node:22-slim can sit unchanged for weeks, so an old pin says nothing on its own: the run+ * must wait until the tag has served the new image long enough for a Monday Dependabot run to see it.+ */+describe('base-image-drift grace', () => {+ const PIN = 'a'.repeat(64);+ const LIVE = 'b'.repeat(64);+ const DAY = 86400;++ // The step reads the image build time with real jq; without it every run takes the "could not+ // read" branch and the failing cases report a bare status mismatch. Fail by name instead of skipping.+ beforeAll(() => {+ if (spawnSync('jq', ['--version']).status !== 0) {+ throw new Error('jq is required: the base-image-drift step parses the image build time with it');+ }+ });++ const script = (): string => {+ const doc = yaml.load(+ readFileSync(join(__dirname, '..', '..', '.github', 'workflows', 'security-scan.yml'), 'utf8'),+ ) as {+ jobs: Record<string, { steps: { name?: string; run?: string }[] }>;+ };+ const step = doc.jobs['base-image-drift'].steps.find(+ s => s.name === 'Compare the Dockerfile pin with node:22-slim',+ );+ if (!step?.run) throw new Error('drift step not found');+ return step.run;+ };++ const run = (opts: {+ live: string;+ liveDays: number | null;+ pinDays: number;+ }): { status: number | null; out: string } => {+ const dir = mkdtempSync(join(tmpdir(), 'drift-'));+ try {+ const bin = join(dir, 'bin');+ mkdirSync(bin);+ const now = Math.floor(Date.now() / 1000);+ const image =+ opts.liveDays === null+ ? '{}'+ : JSON.stringify({+ 'linux/amd64': {+ created: new Date((now - opts.liveDays * DAY) * 1000).toISOString().replace('Z', '123456Z'),+ },+ });+ writeFileSync(+ join(dir, 'Dockerfile'),+ `FROM docker.io/node:22-slim@sha256:${PIN} AS builder\nFROM docker.io/node:22-slim@sha256:${PIN}\n`,+ );+ const stubs: Record<string, string> = {+ docker: `case "$*" in *Manifest.Digest*) echo sha256:${opts.live} ;; *) echo '${image}' ;; esac`,+ git: `echo ${now - opts.pinDays * DAY}`,+ };+ for (const [name, body] of Object.entries(stubs)) {+ writeFileSync(join(bin, name), `#!/bin/sh\n${body}\n`);+ chmodSync(join(bin, name), 0o755);+ }+ const res = spawnSync('bash', ['-e', '-c', script()], {+ cwd: dir,+ env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },+ encoding: 'utf8',+ });+ return { status: res.status, out: res.stdout + res.stderr };+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ };++ it('passes when the pin matches the tag', () => {+ expect(run({ live: PIN, liveDays: 0, pinDays: 90 }).status).toBe(0);+ });++ it('passes when an old pin meets a tag that moved yesterday', () => {+ const res = run({ live: LIVE, liveDays: 1, pinDays: 21 });+ expect(res.status).toBe(0);+ expect(res.out).toContain('::notice::');+ });++ it('fails once the tag has served the new image for a week', () => {+ const res = run({ live: LIVE, liveDays: 8, pinDays: 21 });+ expect(res.status).toBe(1);+ expect(res.out).toContain('::error file=Dockerfile::');+ });++ it('fails a pin 28 or more days old once the tag has served the new image for 3 days', () => {+ expect(run({ live: LIVE, liveDays: 3, pinDays: 30 }).status).toBe(1);+ });++ // The pin's age counts from when it was set, not from when it went stale: a tag quiet for a month+ // that moved yesterday must still wait for the Monday Dependabot run.+ it('passes the first move after a quiet month until a Dependabot run has seen it', () => {+ const res = run({ live: LIVE, liveDays: 1, pinDays: 30 });+ expect(res.status).toBe(0);+ expect(res.out).toContain('::notice::');+ });++ it('skips the run when the build time of the live image cannot be read', () => {+ const res = run({ live: LIVE, liveDays: null, pinDays: 21 });+ expect(res.status).toBe(0);+ expect(res.out).toContain('::warning::');+ });+});