fix: harden the GitHub size preflight after adversarial review

main

Commit

Andrea Nodari2w ago
  • Read authenticated off Authorization only again: the redirect guard strips only that header, so implying support for custom auth headers invited a cross-site leak.
  • Treat a reported size of 0 as unknown: bootstrap runs only with source refs, so 0 means GitHub has not sized the repo yet. It now warns.
  • Report nothing when the run itself is cancelled.
  • Clean every error that reaches the log or notice, not only GitHub's message: transport errors carry server-authored text too.
  • Count a 401/403 as a refused token only when the request still carried it, so a redirect that stripped credentials is not retried or blamed.
  • Give each attempt its own timeout so a slow refusal cannot starve the anonymous retry.
  • CredentialsFor returns nil instead of panicking without an endpoint.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_015oS6W9qjGMVnrTz5r8EwDL Entire-Checkpoint: 01M5CAXBGAJY87C7716VXD6RX3