Skip to content

fix(rekor-monitor): separate infra noise from security alerts - #1897

Merged
mchmarny merged 1 commit into
mainfrom
feat/rekor-monitor-resilience
Jul 23, 2026
Merged

mchmarny merged 1 commit into
mainfrom
feat/rekor-monitor-resilience

Conversation

@lockwobr

Copy link
Copy Markdown
Contributor

Summary

Split the hourly Rekor v2 monitor's single "any failure pages maintainers" path into a classified one: only a genuine tamper or an unexplained identity hit pages, while infrastructure flakiness stays quiet. Also stop legitimate releases from tripping (and wedging) the identity alarm by correlating matches against known release tags.

Motivation / Context

The monitor opened a scary "potential OIDC/key compromise" issue and posted a Slack alert on any failure, so transient Sigstore/TUF/GitHub-API outages paged maintainers with incident-response language (#1813). Separately, a legitimate release (v0.18.0-rc1) matched the release-signer identity scan and, because findings never advance the checkpoint, wedged the monitor into re-detecting it every hour and paging Slack indefinitely (#1887).

Fixes: #1887
Related: #1813

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Build/CI/tooling

Component(s) Affected

  • Docs/examples (docs/, examples/)
  • Other: tools/rekor-monitor (transparency-log monitor) + .github/workflows/rekor-monitor.yaml

Implementation Notes

  • The tool classifies its terminal error as tamper (proof.RootMismatchError, reachable through the wrap chain), identity (ErrCodeConflict from a finding), or operational (everything else). It exits 0/1/2/3 and prints a machine-readable CLASSIFICATION= line; operational failures are retried in-pass; a security classification is never retried.
  • The workflow branches on that line: tamper/identity → security issue (specific body) + Slack page + maintainer mention; operational (or an empty classification from a pre-monitor failure) → a calm area/ci "degraded" issue only after 3 consecutive failed runs; a clean run closes both. The job still goes red on every failure.
  • Rekor v2 monitor: release identity / log consistency alert #1887 correlation: the workflow fetches the repo's release tags and passes them via --known-tags-file; the tool suppresses identity matches whose @refs/tags/<tag> is a known release. Fail-closed: an unknown tag, a malformed SAN, or an empty allowlist still alerts, and a missing allowlist file is a hard error.
  • Deliberate tradeoff: a malformed-but-not-RootMismatchError consistency proof is classified operational (only a true root mismatch is tamper). A persistent malformed-proof condition therefore surfaces as the calm degraded issue, not a page.
  • GitHub-API fetches use a temp-file retry helper that recovers 5xx/429 (not just connection errors) and round-trips the binary artifact zip.

Testing

GOFLAGS="-mod=vendor" go test -race ./tools/rekor-monitor/...   # ok, coverage 81.7%
golangci-lint run -c .golangci.yaml ./...                      # 0 issues
yamllint .github/workflows/rekor-monitor.yaml                  # 0 issues

New/changed functions are covered ~100% (classify, runWithRetry, extractTag, filterKnownReleases, realMain; loadKnownTags 94%, observe 91%). Full make qualify (e2e + grype scan) was not run locally; relying on CI for those stages.

Risk Assessment

  • Medium — Changes alerting behavior on the supply-chain security path (it now pages less), though the code is isolated to one tool + one workflow, well-tested, and easy to revert.

Rollout notes: No migration. On merge, the next scheduled run fetches known tags, suppresses the v0.18.0-rc1 match, records a clean pass, advances the checkpoint, and auto-closes the currently-wedged alert issue. Backwards compatible: --known-tags-file is optional (omitted = prior behavior).

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

The hourly Rekor v2 monitor paged maintainers with an "OIDC/key
compromise" alert on any failure, including transient Sigstore/TUF/
GitHub-API outages. Separately, a legitimate release tripped the same
identity alarm and wedged the monitor (findings never advance the
checkpoint), causing hourly Slack pages until manual intervention.

Classify the tool's terminal error as tamper (proof.RootMismatchError),
identity (ErrCodeConflict), or operational (everything else); exit
0/1/2/3 and print a CLASSIFICATION line. Retry operational failures
only. The workflow now pages (security issue + Slack + maintainer
mention) only for tamper/identity, opens a calm area/ci "degraded"
issue after three consecutive operational (or pre-monitor) failures,
and closes both on a clean run. The job still goes red on any failure.

Correlate identity matches against known release tags: the workflow
fetches the repo's tags and passes them via --known-tags-file, and the
tool suppresses matches whose @refs/tags/<tag> is a known release. An
unknown tag, a malformed SAN, an empty allowlist, or a missing
allowlist file all still surface a finding (fail closed). Harden the
GitHub-API fetches (checkpoint artifact and tags) with a temp-file
retry that recovers 5xx and preserves the binary zip.

Fixes #1887
Related #1813

Signed-off-by: Brian Lockwood <[email protected]>
@lockwobr
lockwobr requested review from a team as code owners July 23, 2026 17:54
@lockwobr lockwobr added area/ci theme/supply-chain SLSA, SBOM, Sigstore, and provenance verification labels Jul 23, 2026
@lockwobr lockwobr self-assigned this Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Rekor monitor now loads known release tags, suppresses matching identity findings, classifies outcomes, and retries operational failures. The workflow uses classifications to page on tamper or identity findings, create degraded issues after persistent operational failures, and close both issue types after a clean run. API retrieval is paginated and retried. Tests cover filtering, classification, retries, flag parsing, and tag-file validation. Documentation describes the updated behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested labels: area/infra, area/tests

Suggested reviewers: mchmarny

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: splitting infra noise from security alerts in the Rekor monitor.
Description check ✅ Passed The description matches the changeset and accurately summarizes the monitor alerting and release-tag suppression work.
Linked Issues check ✅ Passed The PR addresses #1887 by suppressing known release-tag matches, failing closed on unknown data, and auto-closing on a clean run.
Out of Scope Changes check ✅ Passed The changes stay focused on the Rekor monitor workflow, docs, and tests with no obvious unrelated additions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rekor-monitor-resilience

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/rekor-monitor.yaml:
- Around line 156-170: Extract the duplicated gh_api_retry helper used by the
checkpoint-fetch and known-tags-fetch steps into a checked-in script under
.github/workflows/scripts, then source that script from both steps. Remove the
inline copies while preserving the existing retry, backoff, temporary-file,
warning, and error behavior so both call sites use the same implementation.

In `@tools/rekor-monitor/README.md`:
- Around line 81-82: Update the --known-tags-file description in the README
options table to state that omitting the option or providing a
missing/unreadable file is a hard operational error, while an existing empty
file disables suppression and allows all matches to alert.
- Around line 84-96: Clarify that the final CLASSIFICATION line is emitted only
for normal monitor outcomes, not invalid-argument parse or load failures where
realMain returns 2. Update the exit-status introduction and classification table
in tools/rekor-monitor/README.md at lines 4-6 and 84-96, and the corresponding
documentation in tools/rekor-monitor/doc.go at lines 50-55; preserve the
existing classifications and exit codes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: ff81fd79-69dd-45d9-8453-ebc6a99e68a6

📥 Commits

Reviewing files that changed from the base of the PR and between 1439f2f and 415e82a.

📒 Files selected for processing (9)
  • .github/workflows/rekor-monitor.yaml
  • docs/contributor/maintaining.md
  • tools/rekor-monitor/README.md
  • tools/rekor-monitor/doc.go
  • tools/rekor-monitor/main.go
  • tools/rekor-monitor/main_test.go
  • tools/rekor-monitor/monitor.go
  • tools/rekor-monitor/monitor_test.go
  • tools/rekor-monitor/observe_test.go

Comment on lines +156 to +170
gh_api_retry() { # usage: gh_api_retry OUTFILE api-args...
local out="$1"; shift
local attempt
for attempt in 1 2 3; do
if gh api "$@" > "${out}.part"; then
mv "${out}.part" "${out}"
return 0
fi
echo "::warning::gh api failed (attempt ${attempt}/3): $*"
sleep $(( attempt * 3 ))
done
rm -f "${out}.part"
echo "::error::gh api failed after 3 attempts: $*"
return 1
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Deduplicate the gh_api_retry helper. The function is copied byte-for-byte into the checkpoint-fetch and known-tags-fetch steps. Since this retry/backoff logic guards the flaky GitHub-API paths this PR is hardening, keeping two copies risks silent drift where one fetch loses a fix the other gained. Consider extracting it to a checked-in script sourced by both steps (e.g. source ./.github/workflows/scripts/gh_api_retry.sh) so both call sites stay identical.

Also applies to: 190-204

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/rekor-monitor.yaml around lines 156 - 170, Extract the
duplicated gh_api_retry helper used by the checkpoint-fetch and known-tags-fetch
steps into a checked-in script under .github/workflows/scripts, then source that
script from both steps. Remove the inline copies while preserving the existing
retry, backoff, temporary-file, warning, and error behavior so both call sites
use the same implementation.

Comment on lines +81 to 82
| `--known-tags-file` | Optional file of newline-separated known release tags. Identity matches whose `@refs/tags/<tag>` is listed are suppressed as expected releases; empty/omitted disables suppression (all matches alert). |
| `--user-agent` | User-Agent for requests to the log. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Document missing allowlists as hard errors.

docs/contributor/maintaining.md states that a missing --known-tags-file is a hard operational error, but this table says “omitted disables suppression.” Update the README to distinguish omitted/missing files from empty files so operators do not expect an alerting run when the monitor actually fails closed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/rekor-monitor/README.md` around lines 81 - 82, Update the
--known-tags-file description in the README options table to state that omitting
the option or providing a missing/unreadable file is a hard operational error,
while an existing empty file disables suppression and allows all matches to
alert.

Comment on lines +84 to +96
## Exit status and classification

The process prints a final `CLASSIFICATION=<value>` line to stdout and exits:

| Exit | Classification | Meaning |
|------|----------------|---------|
| `0` | `clean` | Consistency verified and no unexpected identity entry; the cursor advanced. |
| `1` | `tamper` | The consistency (Merkle) proof failed: the log did not verify as append-only. |
| `1` | `identity` | An entry under the release identity for a tag with no corresponding release (or an entry that failed verification). |
| `3` | `operational` | Could not complete the check (Sigstore/Rekor/TUF/network trouble, or a timeout). Operational errors are retried a few times before this is returned. |
| `2` | (none) | Invalid arguments. |

Only `tamper` and `identity` are security signals; the calling workflow pages maintainers on those and treats `operational` as infrastructure noise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== files ==\n'
git ls-files tools/rekor-monitor/README.md tools/rekor-monitor/doc.go tools/rekor-monitor

printf '\n== README excerpt ==\n'
sed -n '1,130p' tools/rekor-monitor/README.md

printf '\n== doc.go excerpt ==\n'
sed -n '1,120p' tools/rekor-monitor/doc.go

printf '\n== search for CLASSIFICATION / invalid args ==\n'
rg -n "CLASSIFICATION=|invalid arguments|exit 2|exit code|classification" tools/rekor-monitor -S

Repository: NVIDIA/aicr

Length of output: 12611


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Focus on the implementation paths that decide whether classification is printed.
rg -n "func main|realMain|flag\.|os\.Exit|CLASSIFICATION|invalid|Usage|Parse" tools/rekor-monitor -S

Repository: NVIDIA/aicr

Length of output: 2863


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the most likely source file for invalid-argument handling.
fd -a -t f 'rekor-monitor' tools/rekor-monitor

Repository: NVIDIA/aicr

Length of output: 149


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' tools/rekor-monitor/main.go

Repository: NVIDIA/aicr

Length of output: 9734


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '220,310p' tools/rekor-monitor/main.go

Repository: NVIDIA/aicr

Length of output: 3710


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,120p' tools/rekor-monitor/main.go

Repository: NVIDIA/aicr

Length of output: 5909


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n tools/rekor-monitor/main.go | sed -n '240,290p'

Repository: NVIDIA/aicr

Length of output: 2283


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '250,285p' tools/rekor-monitor/main.go

Repository: NVIDIA/aicr

Length of output: 1367


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n tools/rekor-monitor/main_test.go | sed -n '70,95p'

Repository: NVIDIA/aicr

Length of output: 1024


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== main.go around realMain ==\n'
sed -n '250,285p' tools/rekor-monitor/main.go

printf '\n== main_test invalid-args coverage ==\n'
cat -n tools/rekor-monitor/main_test.go | sed -n '70,95p'

Repository: NVIDIA/aicr

Length of output: 2311


Clarify the CLASSIFICATION= exception for invalid arguments.
realMain returns 2 for parse/load failures before writing any classification, so the README intro and doc.go should say the line is emitted only for normal monitor outcomes, not every invocation.

  • tools/rekor-monitor/README.md#L4-L6
  • tools/rekor-monitor/doc.go#L50-L55
📍 Affects 2 files
  • tools/rekor-monitor/README.md#L84-L96 (this comment)
  • tools/rekor-monitor/README.md#L4-L6
  • tools/rekor-monitor/doc.go#L50-L55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/rekor-monitor/README.md` around lines 84 - 96, Clarify that the final
CLASSIFICATION line is emitted only for normal monitor outcomes, not
invalid-argument parse or load failures where realMain returns 2. Update the
exit-status introduction and classification table in
tools/rekor-monitor/README.md at lines 4-6 and 84-96, and the corresponding
documentation in tools/rekor-monitor/doc.go at lines 50-55; preserve the
existing classifications and exit codes.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 80.6%
Threshold 80%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-80.6%25-brightgreen)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/aicr/tools/rekor-monitor 81.71% (+6.29%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/aicr/tools/rekor-monitor/doc.go 0.00% (ø) 0 0 0
github.com/NVIDIA/aicr/tools/rekor-monitor/main.go 91.35% (+5.38%) 104 (+47) 95 (+46) 9 (+1) 👍
github.com/NVIDIA/aicr/tools/rekor-monitor/monitor.go 66.67% (+10.42%) 84 (+20) 56 (+20) 28 🎉

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@mchmarny
mchmarny merged commit dc1d4b3 into main Jul 23, 2026
41 of 42 checks passed
@mchmarny
mchmarny deleted the feat/rekor-monitor-resilience branch July 23, 2026 18:44
lockwobr added a commit that referenced this pull request Jul 23, 2026
The first scheduled run after #1897 hit the 15-minute per-pass timeout in
the identity scan: the checkpoint had been wedged for hours, so the scan
window had grown to roughly 380k entries. The tool classified the timeout
as operational (correct: no security page, a calm degraded issue), but a
window that large cannot finish inside 15m, so the cursor never advances
and the monitor cannot catch up.

Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job
backstop (timeout-minutes) from 20m to 50m so a single pass can scan a
large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding
that deliberately holds the cursor) and advance, after which the hourly
windows return to a few minutes. This doubles as a durable resilience
buffer against future large-window conditions.

Also fold in the post-merge CodeRabbit review nits from #1897:
- Extract the duplicated gh_api_retry helper into
  .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the
  two copies cannot drift.
- Clarify in the tool README and doc.go that a set-but-missing
  --known-tags-file is a hard error (exit 2), distinct from an empty
  file (disables suppression), and that the CLASSIFICATION line is
  printed for a completed run (exit 0/1/3) but not the exit-2
  argument-error path.

Follow-up to #1897.
Related #1898
Related #1899

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 23, 2026
The first scheduled run after #1897 hit the 15-minute per-pass timeout in
the identity scan: the checkpoint had been wedged for hours, so the scan
window had grown to roughly 380k entries. The tool classified the timeout
as operational (correct: no security page, a calm degraded issue), but a
window that large cannot finish inside 15m, so the cursor never advances
and the monitor cannot catch up.

Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job
backstop (timeout-minutes) from 20m to 50m so a single pass can scan a
large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding
that deliberately holds the cursor) and advance, after which the hourly
windows return to a few minutes. This doubles as a durable resilience
buffer against future large-window conditions.

Also fold in the post-merge CodeRabbit review nits from #1897:
- Extract the duplicated gh_api_retry helper into
  .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the
  two copies cannot drift.
- Clarify in the tool README and doc.go that a set-but-missing
  --known-tags-file is a hard error (exit 2), distinct from an empty
  file (disables suppression), and that the CLASSIFICATION line is
  printed for a completed run (exit 0/1/3) but not the exit-2
  argument-error path.

Follow-up to #1897.
Related #1898
Related #1899

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 23, 2026
The first scheduled run after #1897 hit the 15-minute per-pass timeout in
the identity scan: the checkpoint had been wedged for hours, so the scan
window had grown to roughly 380k entries. The tool classified the timeout
as operational (correct: no security page, a calm degraded issue), but a
window that large cannot finish inside 15m, so the cursor never advances
and the monitor cannot catch up.

Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job
backstop (timeout-minutes) from 20m to 50m so a single pass can scan a
large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding
that deliberately holds the cursor) and advance, after which the hourly
windows return to a few minutes. This doubles as a durable resilience
buffer against future large-window conditions.

Also fold in the post-merge CodeRabbit review nits from #1897:
- Extract the duplicated gh_api_retry helper into
  .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the
  two copies cannot drift.
- Clarify in the tool README and doc.go that a set-but-missing
  --known-tags-file is a hard error (exit 2), distinct from an empty
  file (disables suppression), and that the CLASSIFICATION line is
  printed for a completed run (exit 0/1/3) but not the exit-2
  argument-error path.

Follow-up to #1897.
Related #1898
Related #1899

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 23, 2026
The first scheduled run after #1897 hit the 15-minute per-pass timeout in
the identity scan: the checkpoint had been wedged for hours, so the scan
window had grown to roughly 380k entries. The tool classified the timeout
as operational (correct: no security page, a calm degraded issue), but a
window that large cannot finish inside 15m, so the cursor never advances
and the monitor cannot catch up.

Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job
backstop (timeout-minutes) from 20m to 50m so a single pass can scan a
large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding
that deliberately holds the cursor) and advance, after which the hourly
windows return to a few minutes. This doubles as a durable resilience
buffer against future large-window conditions.

Also fold in the post-merge CodeRabbit review nits from #1897:
- Extract the duplicated gh_api_retry helper into
  .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the
  two copies cannot drift.
- Clarify in the tool README and doc.go that a set-but-missing
  --known-tags-file is a hard error (exit 2), distinct from an empty
  file (disables suppression), and that the CLASSIFICATION line is
  printed for a completed run (exit 0/1/3) but not the exit-2
  argument-error path.

Follow-up to #1897.
Related #1898
Related #1899

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 23, 2026
The first scheduled run after #1897 hit the 15-minute per-pass timeout in
the identity scan: the checkpoint had been wedged for hours, so the scan
window had grown to roughly 380k entries. The tool classified the timeout
as operational (correct: no security page, a calm degraded issue), but a
window that large cannot finish inside 15m, so the cursor never advances
and the monitor cannot catch up.

Raise the per-pass timeout (defaultTimeout) from 15m to 45m and the job
backstop (timeout-minutes) from 20m to 50m so a single pass can scan a
large backlog (a multi-hour Sigstore/TUF outage, or an untriaged finding
that deliberately holds the cursor) and advance, after which the hourly
windows return to a few minutes. This doubles as a durable resilience
buffer against future large-window conditions.

Also fold in the post-merge CodeRabbit review nits from #1897:
- Extract the duplicated gh_api_retry helper into
  .github/scripts/gh-api-retry.sh, invoked by both fetch steps, so the
  two copies cannot drift.
- Clarify in the tool README and doc.go that a set-but-missing
  --known-tags-file is a hard error (exit 2), distinct from an empty
  file (disables suppression), and that the CLASSIFICATION line is
  printed for a completed run (exit 0/1/3) but not the exit-2
  argument-error path.

Follow-up to #1897.
Related #1898
Related #1899

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 23, 2026
The identity-scan release correlation added in #1897 checked the repo's
current tags (/tags). But a release candidate's tag and GitHub Release are
deleted once the final ships (cleanup), while its signing entries are
permanent in the transparency log. So a legitimately-signed-then-deleted
tag (v0.18.0-rc1) was no longer in /tags, went unsuppressed, and paged a
false "OIDC/key compromise" alert (#1902).

Correlate against the on-tag.yaml (release signing workflow) run history
instead. The identity SAN is on-tag.yaml@refs/tags/<tag>, so a tag-push run
of that workflow is the authoritative proof that a real release signed
<tag> -- and run history persists after the tag/release is deleted, unlike
/tags or /releases. The "Fetch signed release tags" step now reads
head_branch from the workflow's runs (event=push, any conclusion,
de-duplicated). The workflow file name is centralized in a new
RELEASE_WORKFLOW_FILE env var shared with CERT_SUBJECT so the identity
regex and the correlation source cannot drift.

Fail-closed and no new attack surface: run history cannot be forged without
repo write (a strictly higher bar than the OIDC/key compromise monitored
for), a forged entry for a tag the workflow never ran still alerts, and the
job already has actions: read. The tool is unchanged (--known-tags-file is
source-agnostic); only the workflow's correlation source and the docs move.

Fixes #1902
Related #1897

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 24, 2026
The identity-scan release correlation added in #1897 checked the repo's
current tags (/tags). But a release candidate's tag and GitHub Release are
deleted once the final ships (cleanup), while its signing entries are
permanent in the transparency log. So a legitimately-signed-then-deleted
tag (v0.18.0-rc1) was no longer in /tags, went unsuppressed, and paged a
false "OIDC/key compromise" alert (#1902).

Correlate against the on-tag.yaml (release signing workflow) run history
instead. The identity SAN is on-tag.yaml@refs/tags/<tag>, so a tag-push run
of that workflow is the authoritative proof that a real release signed
<tag> -- and run history persists after the tag/release is deleted, unlike
/tags or /releases. The "Fetch signed release tags" step now reads
head_branch from the workflow's runs (event=push, any conclusion,
de-duplicated). The workflow file name is centralized in a new
RELEASE_WORKFLOW_FILE env var shared with CERT_SUBJECT so the identity
regex and the correlation source cannot drift.

Fail-closed and no new attack surface: run history cannot be forged without
repo write (a strictly higher bar than the OIDC/key compromise monitored
for), a forged entry for a tag the workflow never ran still alerts, and the
job already has actions: read. The tool is unchanged (--known-tags-file is
source-agnostic); only the workflow's correlation source and the docs move.

Fixes #1902
Related #1897

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 24, 2026
The identity-scan release correlation added in #1897 checked the repo's
current tags (/tags). But a release candidate's tag and GitHub Release are
deleted once the final ships (cleanup), while its signing entries are
permanent in the transparency log. So a legitimately-signed-then-deleted
tag (v0.18.0-rc1) was no longer in /tags, went unsuppressed, and paged a
false "OIDC/key compromise" alert (#1902).

Correlate against the on-tag.yaml (release signing workflow) run history
instead. The identity SAN is on-tag.yaml@refs/tags/<tag>, so a tag-push run
of that workflow is the authoritative proof that a real release signed
<tag> -- and run history persists after the tag/release is deleted, unlike
/tags or /releases. The "Fetch signed release tags" step now reads
head_branch from the workflow's runs (event=push, any conclusion,
de-duplicated). The workflow file name is centralized in a new
RELEASE_WORKFLOW_FILE env var shared with CERT_SUBJECT so the identity
regex and the correlation source cannot drift.

Fail-closed and no new attack surface: run history cannot be forged without
repo write (a strictly higher bar than the OIDC/key compromise monitored
for), a forged entry for a tag the workflow never ran still alerts, and the
job already has actions: read. The tool is unchanged (--known-tags-file is
source-agnostic); only the workflow's correlation source and the docs move.

Fixes #1902
Related #1897

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 27, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 28, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 28, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 28, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 28, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
lockwobr added a commit that referenced this pull request Jul 28, 2026
The identity scan is linear in the window size, so a window that has not
advanced for a while (a multi-hour Sigstore/TUF outage, or a finding that
deliberately holds the cursor) can grow past what one run can scan inside
the 45m pass deadline. On 2026-07-24 the window reached ~1.17M entries and
timed out (operational) every run; the monitor could not self-heal without
a re-baseline, which skips the backlog (a coverage gap).

Make the scan resumable. Split the signed checkpoint (the consistency
anchor, advanced only once the scan reaches head) from a new scannedTo
cursor persisted in a <checkpoint>.scan companion carried in the same
artifact. Each run scans a bounded slice (maxScanEntriesPerRun, in
scanChunkSize chunks), persists progress after each clean chunk, and
resumes there next run. A large backlog is caught up over several hourly
runs, each within budget, with no coverage gap and no re-baseline. A
partial catch-up pass is a clean (exit 0) run; a finding still halts at its
chunk and is re-detected until triaged (so a partial-clean pass never
coexists with an open finding alert). The consistency proof stays O(log n),
so it is never the bottleneck.

Also re-enable the scheduled cron (commented out on 2026-07-24 to pause the
wedged monitor) and upload the progress companion alongside the checkpoint.
An artifact without the companion (a run before this shipped, or one that
did not scan) resumes from 0, i.e. the prior full-window behavior.

Follows #1897 / #1900 / #1903.

Signed-off-by: Brian Lockwood <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci area/docs size/XL theme/supply-chain SLSA, SBOM, Sigstore, and provenance verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rekor v2 monitor: release identity / log consistency alert

2 participants