Skip to content

[PATCH 0/3] http: authenticate packfile-URI downloads - #95

Open
friel-openai wants to merge 3 commits into
codexfrom
af/codex/packfile-uri-credentials
Open

[PATCH 0/3] http: authenticate packfile-URI downloads#95
friel-openai wants to merge 3 commits into
codexfrom
af/codex/packfile-uri-credentials

Conversation

@friel-openai

@friel-openai friel-openai commented Sep 8, 2026

Copy link
Copy Markdown

http-fetch --packfile currently fails on HTTP 401 even when a credential
helper can authenticate the pack URL. This series adds the missing retry
handling without copying credentials from fetch negotiation.

  1. http: factor out pack request setup (15 additions, 7 deletions).
  2. http: authenticate packfile-URI downloads (173 additions, 6 deletions).
  3. t5563: exercise pack downloads with HTTP authentication tests
    (142 additions, 28 deletions, tests only).

The implementation uses run_one_slot(), http_reauth_prepare() and the
existing HTTP configuration parser. It preserves shared partial packs,
looks up credentials for the challenged URL, and rematches
http.extraHeader before retrying a redirected URL. Error response bodies
are discarded so older curl versions can deliver authentication headers
without corrupting a partial pack.

fetch-pack.c, remote-curl.c and http-walker.c are unchanged. Protocol
integration tests remain in t5702; direct HTTP authentication tests use
the existing t5563 fixtures.

Validation: the full local suite passes with
make -j8 DEVELOPER=1 NO_GETTEXT=1 NO_TCLTK=1 test, including 90 protocol-v2
tests and 38 HTTP-auth tests. Both implementation commits build independently;
the second also passes all 90 protocol-v2 tests without the third commit.
Test lint, whitespace and GitHub style checks pass. The complete
PR CI matrix passed
for 409df2c11f, including Linux32, ASan/UBSan and both leak-check jobs.
Linux32 confirms the older-curl challenge-header fix. Security review
covered credential selection after redirects, source-scoped headers,
retry limits, curl handle lifetime and shared partial-pack preservation.

This is a review-only topic targeting codex, based on
master at 2c3adbb2c475981e340c79fdc5e7f4f9b5d9054e. The separate push
workflow rejects upstream's unpinned action references before compiling;
the codex target already pins them, so PR CI runs normally.

Codex Task: codex://threads/01a07eba-913d-7790-acd0-8f6310a57e28

-frielbot

@friel-openai friel-openai added kind:review-only Reviewed topic; do not merge this pull request build:codex-stable Production Codex Git build git Changes to the Git project labels Sep 8, 2026
@friel-openai
friel-openai force-pushed the af/codex/packfile-uri-credentials branch from 3ba60b7 to 3ec65b8 Compare September 8, 2026 08:02
Separate curl request setup from opening the temporary pack. An HTTP
authentication retry will need a fresh request without reopening or
truncating the pack, which another downloader may be using.

Keep the file and index-pack ownership unchanged. Free the previous
header list when preparing another request.

Signed-off-by: Friel <friel@openai.com>
http-fetch --packfile does not handle HTTP_REAUTH, so a protected pack
fails with HTTP 401 even when a credential helper can authenticate it.

Use run_one_slot() and http_reauth_prepare() to retry authentication,
with the same three-attempt limit as http_request_recoverable(). Look
up credentials for the pack URL, not the fetch negotiation URL.

Collect WWW-Authenticate and append helper Authorization headers. Disable
FAILONERROR so older curl versions deliver challenge headers, but discard
error response bodies instead of writing them into the partial pack.
Unlike HTTP_REQUEST_FILE retries, never truncate that shared file.

For a redirected 401, update credentials before run_one_slot() handles
the response. Do this in the completion callback, while the curl handle
still exists even with http.minSessions=0. Preserve the challenge and
reload http.extraHeader for the new URL, so a direct retry cannot resend
headers configured for the redirect source.

Test destination-scoped credentials and resumption through fetch-pack.

Signed-off-by: Friel <friel@openai.com>
Run the existing credential-helper assertions against both ls-remote
and http-fetch --packfile. This covers Basic, Bearer, proactive and
multistage authentication without duplicating their fixtures.

Add pack-specific checks for the retry limit, anonymous URLs, redirect
configuration, and source-scoped headers. Combine the redirected request
with credential.useHttpPath and http.minSessions=0 to check credential
selection and curl handle lifetime.

Signed-off-by: Friel <friel@openai.com>
@friel-openai
friel-openai force-pushed the af/codex/packfile-uri-credentials branch from 3ec65b8 to 409df2c Compare September 8, 2026 08:23
@friel-openai friel-openai changed the title [PATCH] http: authenticate packfile-URI downloads [PATCH 0/3] http: authenticate packfile-URI downloads Sep 8, 2026
@friel-openai
friel-openai marked this pull request as ready for review September 8, 2026 09:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T09:25:21.402981Z 409df2c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:codex-stable Production Codex Git build git Changes to the Git project kind:review-only Reviewed topic; do not merge this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant