osv-followup: weekly osv-scanner issues for Claude, monthly osv-scanner.toml re-check

Composite action next to scan: osv-scanner (pinned + sha256) over every lockfile with --config osv-scanner.toml; advisories no open osv-followup issue lists go into one @claude issue (fix or an entry with a code-specific reason, one PR); monthly, a deterministic PR removes entries no dependency matches and an osv-recheck issue asks Claude to re-verify the rest.
This commit is contained in:
janhouse committed 2026-11-19 17:38:37 +02:00
1 parent 0e5054f5d0
commit 7f264b64fa
4 files changed
+975

No files matched your search

+151
View File
@@ -0,0 +1,151 @@
name: 'osv-scanner follow-ups'
description: >
osv-scanner over the repo's lockfiles. Weekly (scan): advisories that
osv-scanner.toml does not cover and no open follow-up issue lists get an
issue asking @claude for a pull request with a fix or an osv-scanner.toml
entry whose reason names the code. Monthly (recheck): a pull request removes
entries no dependency matches any more (deterministic), and an @claude issue
asks for the remaining reasons to be re-verified.
author: 'janhouse'
# Usage (a repo's .gitea/workflows/security.yml; full example in README.md):
#
# on:
# schedule:
# - cron: '17 5 * * 1' # weekly scan
# - cron: '47 6 1 * *' # monthly re-check
# workflow_dispatch:
# inputs:
# recheck: {type: boolean, default: false}
# jobs:
# osv:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: https://git.janhouse.lv/janhouse/sbom-tools-action/[email protected]
# with:
# mode: ${{ (inputs.recheck == true || inputs.recheck == 'true') && 'recheck' || 'auto' }}
# recheck-cron: '47 6 1 * *'
# token: ${{ secrets.DEPS_BOT_TOKEN }}
# discord-webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
# context: >-
# What the app is, how it runs, what is exposed.
#
# The token's account (the `bot` account behind DEPS_BOT_TOKEN) opens the
# issues, so gitea-claude-bot dispatches gitea-claude-runner for them: it
# needs write access to the repository, and the repository must be in the
# bot's allowlist. Issues carry the label `osv-followup` (dedupe) and a
# hidden `<!-- osv-followup: ids -->` marker; an advisory listed in any OPEN
# follow-up issue is not reported again.
inputs:
mode:
description: >
scan, recheck, or auto: on a schedule, recheck when github.event.schedule
equals recheck-cron (or, when Gitea sends no schedule, on the 1st of the
month at or after recheck-hour UTC), otherwise scan; any other event scans.
default: 'auto'
recheck-cron:
description: 'The monthly cron line of the calling workflow (auto mode)'
default: ''
recheck-hour:
description: 'auto mode without github.event.schedule: a run on the 1st at or after this UTC hour is the re-check'
default: '6'
token:
description: 'Token of the account that opens issues and the prune PR (secrets.DEPS_BOT_TOKEN)'
required: true
context:
description: 'What the repository is, how it runs and what is exposed: quoted to Claude in every issue'
required: true
labels:
description: 'Labels for follow-up issues, comma separated (osv-followup is always added)'
default: 'security,osv-followup'
mention:
description: 'Account to @-mention'
default: 'claude'
base-branch:
description: 'Branch the pull requests target'
default: 'main'
path:
description: 'Directory to scan (recursively)'
default: '.'
config:
description: 'osv-scanner config, relative to the repo root; passed with --config, so it covers every lockfile'
default: 'osv-scanner.toml'
group-by:
description: 'run: one issue per scan (one Claude run, one PR: no osv-scanner.toml conflicts); package: one issue per package'
default: 'run'
ignore-days:
description: 'ignoreUntil Claude sets on new or re-confirmed entries, in days from today'
default: '90'
extra-args:
description: 'Extra osv-scanner arguments (space separated), e.g. --experimental-exclude=fixtures'
default: ''
osv-scanner-version:
default: 'v2.7.1'
osv-scanner-sha256:
description: 'sha256 of osv-scanner_linux_amd64 for osv-scanner-version (from its osv-scanner_SHA256SUMS)'
default: 'fb7dab19a8bd9bbe5c3189f09d4b7ee1820c9553a23bac202648a56efd2f6ee8'
bot-name:
description: 'git author of the prune commit'
default: 'bot'
bot-email:
default: '[email protected]'
discord-webhook-url:
description: 'Optional: a Discord notice for every issue / PR opened'
default: ''
dry-run:
description: 'Print the issues and the prune diff instead of creating them (reads still use the token)'
default: 'false'
runs:
using: composite
steps:
- name: Install osv-scanner
shell: bash
env:
OSV_VERSION: ${{ inputs.osv-scanner-version }}
OSV_SHA256: ${{ inputs.osv-scanner-sha256 }}
run: |
set -euo pipefail
d="$RUNNER_TEMP/osv-followup-bin"; mkdir -p "$d"
curl -sSfL --connect-timeout 20 --max-time 300 --retry 3 --retry-all-errors \
"https://github.com/google/osv-scanner/releases/download/${OSV_VERSION}/osv-scanner_linux_amd64" -o "$d/osv-scanner"
echo "${OSV_SHA256} $d/osv-scanner" | sha256sum -c -
chmod +x "$d/osv-scanner"
"$d/osv-scanner" --version | head -1
echo "OSV_SCANNER=$d/osv-scanner" >> "$GITHUB_ENV"
- name: osv-scanner follow-ups
shell: bash
env:
MODE: ${{ inputs.mode }}
RECHECK_CRON: ${{ inputs.recheck-cron }}
RECHECK_HOUR: ${{ inputs.recheck-hour }}
EVENT_NAME: ${{ github.event_name }}
EVENT_SCHEDULE: ${{ github.event.schedule }}
TOKEN: ${{ inputs.token }}
CONTEXT: ${{ inputs.context }}
LABELS: ${{ inputs.labels }}
MENTION: ${{ inputs.mention }}
BASE_BRANCH: ${{ inputs.base-branch }}
SCAN_PATH: ${{ inputs.path }}
CONFIG: ${{ inputs.config }}
GROUP_BY: ${{ inputs.group-by }}
IGNORE_DAYS: ${{ inputs.ignore-days }}
EXTRA_ARGS: ${{ inputs.extra-args }}
OSV_VERSION: ${{ inputs.osv-scanner-version }}
BOT_NAME: ${{ inputs.bot-name }}
BOT_EMAIL: ${{ inputs.bot-email }}
DISCORD_WEBHOOK_URL: ${{ inputs.discord-webhook-url }}
DRY_RUN: ${{ inputs.dry-run }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
ACTION_DIR: ${{ github.action_path }}
run: |
set -euo pipefail
dir="${GITHUB_ACTION_PATH:-$ACTION_DIR}"
git config --global --add safe.directory "$PWD"
python3 -I "$dir/followup.py"