Repository navigation
fix(ci): strip newlines from base64 encoded auth header in incremental approval - #820
Merged
Merged
Conversation
…l approval GNU base64 wraps output at 76 characters by default. When GITHUB_TOKEN is longer than 40 characters (as with ARC runner installation tokens), a newline is introduced into the middle of the base64 string. Command substitution only strips trailing newlines, leaving the intermediate newline in AUTH_HEADER. This caused git/curl to abort with 'fatal: unable to access ...: Failed sending HTTP request' due to header injection protection in libcurl. Fix this by piping base64 through 'tr -d '\n'' and standardizing header casing to 'Authorization: Basic'. TAG=agy CONV=ced76c7b-e554-4b82-8631-a07a1a2f203d
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
VLukiantsev
marked this pull request as ready for review
September 8, 2026 11:56
VLukiantsev
enabled auto-merge
September 8, 2026 11:56
janzak-dev
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strips newline characters from the base64-encoded authorization header in the incremental PR approval workflow step that restores trusted scripts from the base branch, fixing
fatal: unable to access ...: Failed sending HTTP requestobserved on PR #813.Motivation & Context
In Step 2 (
Restore trusted scripts and ownership from base branch) of.github/workflows/incremental-pr-approval.yml,AUTH_HEADERwas constructed via:AUTH_HEADER="AUTHORIZATION: basic $(printf "x-access-token:%s" "$GITHUB_TOKEN" | base64)"By default, GNU
base64wraps output lines at 76 columns. Whenx-access-token:<token>exceeds 57 bytes (which occurs with standard ARC runner installation tokens),base64inserts a newline character (\n) into the middle of the base64 string.Because command substitution
$(...)only strips trailing newlines, the intermediate newline was preserved inAUTH_HEADER. When passed togit -c http.extraheader=...,libcurl's header validation detected an unescaped LF and aborted locally withCURLE_SEND_ERROR(fatal: unable to access ...: Failed sending HTTP request) before transmitting the request.Key Changes
.github/workflows/incremental-pr-approval.yml:base64throughtr -d '\n'in Step 2 to guarantee a single-line base64 authorization string regardless of token length.Authorization: Basicto matchgit-range-diff.js:60.Assumptions
None — requirements were fully specified and reproduced from PR #813 run
34220332798.Verification & Testing
node --test .github/scripts/*.test.js: All 118 unit tests passed cleanly../.githooks/pre-commit: All linter and pre-commit checks passed cleanly../tools/analyze_diff_size.py --base-ref origin/main...: Verified diff size.git -c http.extraheader=...aborts withFailed sending HTTP requestwhen newlines are present, and succeeds when piped throughtr -d '\n'.Related Issues / Bugs
Fixes workflow fetch failure on PR #813 (run
34220332798)TAG=agy
CONV=ced76c7b-e554-4b82-8631-a07a1a2f203d