Skip to content

Fix watchdog artifact download across GitHub redirect - #48

Open
hiidkaboutyou-spec wants to merge 1 commit into
mainfrom
fix/watchdog-artifact-download-redirect
Open

Fix watchdog artifact download across GitHub redirect#48
hiidkaboutyou-spec wants to merge 1 commit into
mainfrom
fix/watchdog-artifact-download-redirect

Conversation

@hiidkaboutyou-spec

Copy link
Copy Markdown
Owner

Summary

  • Fix the watchdog's production-outcome artifact download, which always failed with 401: the artifact ZIP endpoint 302-redirects to a pre-signed Azure Blob URL and Python's urllib forwards the Authorization header on redirect, which Azure rejects
  • Add _NoAuthRedirectHandler (strips Authorization only on cross-host redirects; same-host GitHub API auth untouched) and _download_artifact_zip helper
  • 16 regression tests: cross-host auth stripping, same-host auth retention, bounded 401/403, invalid ZIP, secret-free error summaries, safe legacy fallback
  • Verified against the real production artifact (run 33418239126): before 401/HTTPError, after schema_version=1, outcome_status=healthy

Redirect security behavior

  • Authorization is stripped only when the redirect crosses hosts (api.github.com → blob storage)
  • Same-host redirects keep auth; HTTPS-only; tokens never appear in logs, URLs or exception messages

This hotfix is required for PR #47 (Structured Production Outcome Contract) to work end-to-end: without it the watchdog can never consume a real outcome artifact.

…ects

The watchdog's production-outcome artifact download always failed with
401: the artifact ZIP endpoint (api.github.com) 302-redirects to a
pre-signed Azure Blob URL, and Python's urllib forwards the Authorization
header on redirect, which Azure rejects (InvalidAuthenticationInfo). The
watchdog therefore never consumed a real outcome and silently fell back
to legacy workflow-conclusion logic.

- Add _NoAuthRedirectHandler: strips Authorization only on cross-host
  redirects; same-host GitHub API auth is untouched
- Add _download_artifact_zip helper used by fetch_latest_production_outcome
- 16 regression tests covering cross-host redirect auth stripping,
  same-host auth retention, bounded 401/403 failure, invalid ZIP,
  secret-free error summaries, and safe legacy fallback

Verified against the real production artifact (run 33418239126):
before 401/HTTPError, after schema_version=1, outcome_status=healthy.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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