Skip to content

Add support for Bearer token in action archive downloads#4321

Merged
TingluoHuang merged 1 commit intomainfrom
users/tihuang/bearertoken
Mar 31, 2026
Merged

Add support for Bearer token in action archive downloads#4321
TingluoHuang merged 1 commit intomainfrom
users/tihuang/bearertoken

Conversation

@TingluoHuang
Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings March 31, 2026 19:46
@TingluoHuang TingluoHuang requested a review from a team as a code owner March 31, 2026 19:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in Bearer authentication for action archive downloads when fetching directly from codeload hosts, behind a new feature flag.

Changes:

  • Introduces actions_use_bearer_token_for_codeload feature flag.
  • Updates action archive download auth header creation to use Bearer <token> for codeload.* URLs when flagged.
  • Keeps existing Basic auth behavior as the default fallback.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Runner.Worker/ActionManager.cs Adds feature-flagged Bearer auth path for codeload archive downloads while retaining Basic auth.
src/Runner.Common/Constants.cs Declares the new feature flag constant used by the worker.

Comment thread src/Runner.Worker/ActionManager.cs
Comment thread src/Runner.Worker/ActionManager.cs
Comment thread src/Runner.Worker/ActionManager.cs
@TingluoHuang TingluoHuang force-pushed the users/tihuang/bearertoken branch from 97a2540 to 62a8f62 Compare March 31, 2026 21:31
Trace.Info("Using Basic token for action archive download.");
var base64EncodingToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"x-access-token:{token}"));
HostContext.SecretMasker.AddValue(base64EncodingToken);
return new AuthenticationHeaderValue("Basic", base64EncodingToken);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the basic header works fine with codeload URL and api.github.com URL.

(parsedUrl.Host.StartsWith("codeload.", StringComparison.OrdinalIgnoreCase) || parsedUrl.PathAndQuery.StartsWith("/_codeload/", StringComparison.OrdinalIgnoreCase)))
{
Trace.Info("Using Bearer token for action archive download directly to codeload.");
return new AuthenticationHeaderValue("Bearer", token);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case we are talking to codeload directly, pass bearer header

@TingluoHuang TingluoHuang merged commit 5c6dd47 into main Mar 31, 2026
12 checks passed
@TingluoHuang TingluoHuang deleted the users/tihuang/bearertoken branch March 31, 2026 21:51
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.

3 participants