Skip to content

Offline advisory DBs older than 7 days read as not checked, not clean - #2551

Merged
remigiusz-antczak merged 1 commit into
mainfrom
lane/advisory-db-age
Nov 26, 2026
Merged

remigiusz-antczak merged 1 commit into
mainfrom
lane/advisory-db-age

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

What: review_checks.sh now reads an offline osv-scanner or trivy advisory DB older than REVIEW_ADVISORY_MAX_AGE_DAYS (default 7) as NOT CHECKED, naming its age and the refresh command, instead of reporting a clean pass.

Why: a provisioned offline DB had no age check, so a weeks-old cache made the weekly forced --full rescan in audit_sweep.py look like a fresh advisory check.

How:

  • provision_tools.sh --age trivy|osv DIR prints the DB age in whole days (trivy UpdatedAt; for osv, the oldest zip at any depth).
  • review_checks.sh adds a not-checked row when the age is over the limit or cannot be read. A non-integer limit warns and falls back to 7.
  • trivy scans the same dir it age-checks (provision_tools.sh --cache trivy-dir), and its hint matches the warm command.
  • audit_sweep.py classifies both rows as ENVGAP.
  • The real-hub CI job pins its trivy DB by digest, so that DB is older than 7 days by design. The job sets REVIEW_ADVISORY_MAX_AGE_DAYS=36500, because it checks tool wiring; test-review-checks-advisory-age.sh covers the gate.

Trade-off: trivy now always gets --cache-dir, pointing at the dir that is age-checked. With DCR_CACHE_ROOT set and a DB only in trivy's own default dir, trivy reads as not run and prints the warm command, instead of scanning a cache with no age check. Default installs are unchanged.

Tests:

  • 6/6 audit_sweep_staledb
  • 13/13 provision-advisory-age
  • 11/11 review-checks-advisory-age (4 of them fail against the old code)
  • 21/21 scanner-offline-db
  • 12/12 scanner-sandbox-fallback
  • 61/61 provision-tools
  • 51 other trivy-touching review_checks tests green locally
  • audit_sweep*.py, osv-fallback, size-ratchet and fragments green

test-review-checks-real-hub.sh cannot fill the Go build cache in the local sandbox, so it runs in CI only.

🤖 Generated with Claude Code

review_checks.sh ran osv-scanner and trivy on a provisioned offline DB with no age check, so a weeks-old cache made the weekly forced --full rescan look like a fresh advisory check. provision_tools.sh --age reports the DB age (trivy UpdatedAt, oldest osv zip at any depth); review_checks.sh adds a not-checked row naming the age and the refresh command when it exceeds REVIEW_ADVISORY_MAX_AGE_DAYS (default 7; a non-integer value warns and falls back to 7), and an "of known age" row when the age is unreadable. trivy now scans the same dir that is age-checked (provision_tools.sh --cache trivy-dir) and its hint matches the warm command. audit_sweep.py classifies both rows as ENVGAP. FULL_EVERY comment and docstring corrected.

test-scanner-offline-db.sh now expects that warm command as the trivy hint, and test-scanner-sandbox-fallback.sh sets DCR_CACHE_ROOT, so a stale trivy DB in the host cache no longer decides its rows. The real-hub CI job pins its trivy DB by digest, so that DB is older than 7 days by design; the job now sets REVIEW_ADVISORY_MAX_AGE_DAYS=36500, because it checks tool wiring and test-review-checks-advisory-age.sh covers the age gate.

Tests: 6/6 audit_sweep_staledb, 13/13 provision-advisory-age, 11/11 review-checks-advisory-age (4 red against the old code), 21/21 scanner-offline-db, 12/12 scanner-sandbox-fallback (red on a host with an 8-day-old trivy DB before the fix), 61/61 provision-tools; 51 other trivy-touching review_checks tests green locally; test-review-checks-real-hub.sh cannot fill the Go build cache in the local sandbox and runs in CI; audit_sweep*.py, osv-fallback, size-ratchet and fragments green

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit 429267d into main Nov 26, 2026
13 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the lane/advisory-db-age branch November 26, 2026 21:09
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