Skip to content

fix(secret-scan): exponential backoff and 2-minute retry cap for TruffleHog download - #214

Merged
mchen-sentry merged 3 commits into
mainfrom
bump-trufflehog-retry-backoff
Sep 10, 2026
Merged

mchen-sentry merged 3 commits into
mainfrom
bump-trufflehog-retry-backoff

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Examples

Secret Scan failing on the TruffleHog download, all curl: (22) The requested URL returned error: 500 four times in a row, then exit 22:

Same class of blip on the cosign download (504, not covered by this PR):

None of these had a GitHub status-page incident at the time.

Context

The org-wide secret-scan check has failed multiple times with GitHub returning 500/504 while downloading TruffleHog release assets — not caused by the PR under scan. Current curl calls use --retry 3 --retry-delay 5 (or --retry 2 --retry-delay 3 for the release probe), which is a fixed 5s delay between attempts and only ~15s of total retry coverage.

Change

  • Drop the fixed --retry-delay so curl falls back to its default exponential backoff (1s, 2s, 4s, ...).
  • Add --retry-max-time 120 to cap the total retry window at 2 minutes.
  • Bump --retry count to 8 so the exponential schedule can reach the 2-minute cap.
  • Apply this to the release-probe HEAD request and all four TruffleHog asset downloads (checksums, .pem, .sig, .tar.gz).
  • Keep --retry-all-errors off the release probe so a not-yet-published release (404) falls through to the next tag immediately instead of retrying for two minutes.
  • Print effective URL and status on each download so the log shows which hop (github.com redirect vs the CDN) failed.

Why

GitHub's transient 500s on release asset downloads are usually short blips; a longer exponential-backoff window gives them time to clear without needing a manual job rerun, while still failing after two minutes of retrying.

Worst case during a real outage the job now spends up to ~12 minutes retrying (two probe tags plus four downloads, each capped at 2 minutes) before failing, versus ~1 minute today.

Not covered: sigstore/cosign-installer downloads cosign from GitHub Releases with its own hard-coded ~7s retry window, which is what failed on Sep 7. Left as-is; changing it is a separate call for the workflow owners.

via Ming Chen.

--

View Junior Session [Sentry]

Fixed 5s retry delay x3 gave ~15s of retry coverage against GitHub's
transient release-asset 500s. Drop --retry-delay so curl uses its
default exponential backoff (1s, 2s, 4s, ...) and cap total retry time
at 120s with --retry-max-time, applied to the release probe and all
four TruffleHog asset downloads.

Co-Authored-By: Ming Chen <ming.chen@sentry.io>
@sentry-junior
sentry-junior Bot requested a review from a team as a code owner September 10, 2026 22:32
- Replace sigstore/cosign-installer with a pinned, checksummed curl using the same backoff, since the action's retries are hard-coded and one of this week's failures was its download 504ing.
- Drop --retry-all-errors from the release probe so a not-yet-published release (404) falls through to the next tag immediately instead of retrying for two minutes.
- Print effective URL and status on each download so the log shows which hop failed.
@mchen-sentry mchen-sentry changed the title secret-scan: exponential backoff, 2-minute retry cap for TruffleHog download fix(secret-scan): exponential backoff and 2-minute retry cap for TruffleHog and cosign downloads Sep 10, 2026
Out of scope for the retry bump; noted the gap in the PR body instead.
@mchen-sentry mchen-sentry changed the title fix(secret-scan): exponential backoff and 2-minute retry cap for TruffleHog and cosign downloads fix(secret-scan): exponential backoff and 2-minute retry cap for TruffleHog download Sep 10, 2026
@mchen-sentry
mchen-sentry requested a review from a team September 10, 2026 22:43
@mchen-sentry
mchen-sentry enabled auto-merge (squash) September 10, 2026 22:43
@mchen-sentry
mchen-sentry merged commit 2b42d6e into main Sep 10, 2026
10 checks passed
@mchen-sentry
mchen-sentry deleted the bump-trufflehog-retry-backoff branch September 10, 2026 22:45
@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

DI-2403

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.

2 participants