Skip to content

feat(vigutils): warn seven days before a security exception expires - #1555

Merged
c-vigo merged 6 commits into
devfrom
feature/1552-warn-before-exception-expiry
Aug 20, 2026
Merged

c-vigo merged 6 commits into
devfrom
feature/1552-warn-before-exception-expiry

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Security exception expiries surfaced only as a hard failure on the day
after
. check-expirations runs in all PR CI (ci.yml:441, :524), in
pre-commit, as the first step of both nightly security-scan.yml lanes and in
the release train (release.yml:906) — so one lapsed block reds every open
branch, both scan lanes and the release path at once, with zero prior warning.
That happened three times in two months (#1260, #1481, #1547), each time on a
date a human had chosen deliberately weeks earlier. The information existed;
nothing surfaced it.

This adds a seven-day advance notice. It is a notice, not a gate: the hard
gate is untouched.

Type of Change

  • feat -- New feature
  • ci -- CI/CD pipeline changes
  • docs -- Documentation only
  • test -- Adding or updating tests

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

1. check-expirations --warn-days N and --json
(packages/vig-utils/src/vig_utils/check_expirations.py)

  • --warn-days N emits ::warning:: annotations (stderr, like the existing
    ::error:: ones) for entries falling due within N days, inclusive.
    It never changes an exit code: an entry inside the window is still valid, and
    an already-expired entry still exits 1 exactly as today.
  • --json prints {"expired": [...], "expiring": [...]} on stdout, each record
    {"id", "file", "expiration", "days_left"} (days_left is negative for an
    expired entry). It replaces the human summary line so stdout is pure JSON,
    and it is still emitted on the failing (expired) run, where a caller needs it
    most.
  • The two flags compose. A new classify_entries() holds the single
    classification rule; check_file() is re-expressed through it and keeps its
    exact contract, so the module stays the single parser of the Expiration:
    grammar.
  • Default behaviour is byte-identical — no existing call site moves.

2. A third issue class in .github/workflows/security-scan.yml (not a new
workflow — that job already carries the main/dev matrix, issues: write,
the label bootstrap and the ref-distinct dedup pattern from #1548)

  • Placed before the blocking Validate .vulnixignore exception expirations
    step, so an already-red register still reports what is coming next. A notice
    scheduled after it would go silent exactly on the runs that need it.
  • Covers all three registers — .vulnixignore, .trivyignore and
    .github/dependency-review-allow.txt. The nightly gate reads only the first,
    but the other two red every branch just as hard (curl 8.20.0 CVE exception batch expired 2026-07-22 — check-expirations now blocks all CI #1260 was a .trivyignore
    case).
  • Opens one deduplicated issue per (matrix ref x distinct upcoming expiry
    date)
    : Security exception register (dev): exceptions expire 2026-09-02.
    Per-date because a date maps 1:1 to one combined review pass and staggered
    dates then get their own issues — reinforcing the "stagger across weeks" rule
    rather than flattening it. Dedup reuses the existing
    gh issue list --state open --label security-scan --search "\"$TITLE\" in:title"
    lookup, with an exact-title filter on top because GitHub's search tokenises a
    date and would otherwise let one date's open issue suppress another's.
  • continue-on-error: true and every gh failure degrades to a ::warning::
    — the step can never turn a green nightly scan red. The hard gate stays the
    validation step.
  • The body lists only that date's entries, then states the anti-blind-extension
    standard (read the latest findings delta first, delete what the pin
    advance cleared, a renewal is a re-verification not a date bump) and links
    docs/CONTAINER_SECURITY.md.

3. Docs — new Advance notice, one grid period ahead subsection in
docs/CONTAINER_SECURITY.md, inside the exception-register section and right
after the Wednesday-grid rationale it depends on. It states explicitly that this
is a notice and the gate is unchanged, and repeats the anti-blind-extension rule
(the notice deliberately arrives before the week's findings delta exists).
SECURITY.md:88 ("Expired entries fail CI via the check-expirations utility")
is still exactly true, so it is left alone.

Why 7 days

One expiry-grid period. docs/CONTAINER_SECURITY.md puts every Expiration: on
a Wednesday so an entry turns red on the Thursday after the week's Renovate
nixpkgs bump and the first nightly findings delta. A 7-day lead lands the
notice on a Wednesday too, one full Renovate cycle ahead: notice Wed, bump
merges Mon/Tue, nightly delta Tue/Wed, act Wed, red Thu.

Changelog Entry

### Added

- **A security exception now gives seven days' notice before it fails
  everything** ([#1552](https://github.com/vig-os/devkit/issues/1552))
  - `check-expirations` runs in all PR CI, in pre-commit, in both nightly scan
    lanes and in the release train, so one lapsed block reds every open branch
    at once — three times in two months
    ([#1260](https://github.com/vig-os/devkit/issues/1260),
    [#1481](https://github.com/vig-os/devkit/issues/1481),
    [#1547](https://github.com/vig-os/devkit/issues/1547)) — with no prior
    signal, even though every date had been chosen deliberately weeks earlier
  - `check-expirations` gains `--warn-days N` (emit `::warning::` annotations
    for entries falling due within N days, exit code untouched) and `--json`
    (emit the `expired`/`expiring` classification on stdout). The flags compose,
    and they keep the utility the single parser of the `Expiration:` grammar —
    no caller re-implements it
  - The nightly `security-scan` gains a third, non-failing issue class: one
    deduplicated notice per scanned ref per distinct upcoming expiry date,
    titled `Security exception register (<ref>): exceptions expire <date>`,
    covering `.vulnixignore`, `.trivyignore` **and**
    `.github/dependency-review-allow.txt`
  - The step runs *before* the blocking validation step, so an already-red
    register still reports what is coming next, and it is `continue-on-error`
    so a missed notice can never turn a green scan red
  - Seven days is one expiry-grid period: dates land on a Wednesday, so the
    notice does too, one full Renovate cycle ahead of the red. The issue body
    spells out that a renewal is a re-verification, not a date bump — read the
    findings delta, delete what the pin advance cleared — because the notice
    deliberately arrives before that data exists
  - Default behaviour is unchanged: no existing call site, exit code or output
    moves

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

TDD evidence

Six commits, each phase its own commit:

Commit Phase
050fe043 test(vigutils): pin --warn-days and --json on check-expirations RED
3170a59a feat(vigutils): add --warn-days and --json to check-expirations GREEN
4ae883a6 test(workflows): pin the seven-day exception expiry notice on security-scan RED
bb35a932 ci(security-scan): open an advance notice 7 days before an exception expires GREEN
727c19ab docs(security): document the seven-day exception expiry notice docs
9b1a831c docs(changelog): record the security exception expiry advance notice changelog

RED, utility — ImportError: cannot import name 'classify_entries', 1 collection error.
GREEN, utility — 25 passed in packages/vig-utils/tests/test_check_expirations.py.

RED, workflow — 7 failed in the new tests/test_workflow_expiry_notice.py
(AssertionError: no matching step found in security-scan.yml), while the three
existing #1548 tests passed.
GREEN, workflow — 10 passed across both workflow-shape files.

tests/test_workflow_scan_failure_reporting.py::_reporting_step matched the
first step containing gh issue create, which the new step would have shadowed
— it now also requires a failure() guard, which the notice step deliberately
does not carry. Caught by running the full suite, not by the hook suite.

Verification output

Full test suite — 1645 passed, 20 skipped, 2 warnings in 282.61s.

Default behaviour unchanged (the contract every existing call site relies on):

$ uv run check-expirations .trivyignore .vulnixignore
Validated 32 exception(s) across 2 file(s)   # exit 0

A test pins stdout to exactly Validated 2 exception(s) across 1 file(s)\n with
empty stderr on a default run.

Real registers, real today (2026-08-20), 7-day window — nothing due, as
expected: 29 of 33 entries sit on 2026-09-02, 13 days out.

$ check-expirations --warn-days 7 --json .trivyignore .vulnixignore .github/dependency-review-allow.txt
{"expired": [], "expiring": []}              # exit 0

Same registers with today injected to 2026-08-26 (7 days before that
cliff) — 29 entries reported across all three registers, exit 0:

::warning::Security exceptions expiring within 7 day(s) — review before they fail CI:
::warning::  - .vulnixignore: CVE-2025-15281 (expires 2026-09-02, 7 day(s) left)
...
::warning::  - .trivyignore: jwt-token (expires 2026-09-02, 7 day(s) left)
::warning::  - .github/dependency-review-allow.txt: GHSA-wvrr-2x4r-394v (expires 2026-09-02, 7 day(s) left)

Workflow step executed locally, extracted from the YAML and run against the
real registers with stubbed uv/gh (injected today = 2026-08-26):

Scenario Result
29 entries due on one date one gh issue create, title Security exception register (dev): exceptions expire 2026-09-02, body listing exactly that date's entries
exact title already open (#42) Open notice already exists for 2026-09-02: #42 -- skipping create, exit 0
only a different date open (#9, 2026-10-07) issue still created — the exact-title filter earning its keep
WARN_DAYS=1, nothing due No security exceptions expire within 1 days on dev, exit 0
register missing / unparseable payload ::warning::could not classify the exception registers; the validation step below reports the real failure, exit 0

Linting — just precommit (prek run --all-files) fully green, 52 hooks
Passed, zero failures, clean tree afterwards. actionlint green on
security-scan.yml specifically. zizmor in CI audits only
assets/workspace/.github/workflows/, which this PR does not touch; every
${{ }} in the new step is passed through step env rather than interpolated
into the script.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • Parallel work on [CHORE] Stagger the 2026-09-02 exception-register cliff — 29 of 33 entries expire on one date #1553. That issue staggers the Expiration: dates in the
    exception registers and touches only those dates. This PR changes no date in
    any register. The only expected overlap is a CHANGELOG.md conflict in the
    ## Unreleased section, which union-merges.
  • Out of scope, per the issue: the scaffold under assets/workspace/.
    Consumers get the check-expirations pre-commit hook but ship no registers
    and no security-scan.yml, so there is nothing to warn about; --warn-days
    reaches them through the pinned utility if they ever add one.
  • Deliberately skipped: --warn-days in PR CI (a yellow annotation on every
    PR). The issue lists it as "worth adding alongside" but not required, and a PR
    annotation reaches whoever opens that run rather than the register's owner.
    Left out to keep this diff minimal — worth a follow-up issue if wanted.
  • The assets/workspace/.devcontainer/CHANGELOG.md diff is the sync-manifest
    mirror of the root changelog, regenerated by the hook.

Refs: #1552

@c-vigo
c-vigo merged commit e4726f1 into dev Aug 20, 2026
12 checks passed
@c-vigo
c-vigo deleted the feature/1552-warn-before-exception-expiry branch August 20, 2026 09:19
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