Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions actions/setup/js/git_auth_helpers.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ async function overridePersistedExtraheader(serverUrl, token, cwd) {
}
core.info(`git_auth_helpers: overriding http.${normalizedUrl}/.extraheader with CI trigger token`);
const tokenBase64 = Buffer.from(`x-access-token:${token.trim()}`).toString("base64");
core.setSecret(tokenBase64);
const authHeader = `Authorization: basic ${tokenBase64}`;

// Clear from ALL writable scopes before writing our token to prevent duplicate
Expand Down
1 change: 1 addition & 0 deletions actions/setup/js/git_auth_helpers.integration.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe("git_auth_helpers.cjs git integration", () => {
mockCore = {
info: vi.fn(),
warning: vi.fn(),
setSecret: vi.fn(),
};

global.core = mockCore;
Expand Down
9 changes: 9 additions & 0 deletions actions/setup/js/git_auth_helpers.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ describe("git_auth_helpers.cjs", () => {
}
});

it("should register the base64 token with core.setSecret for runner-side masking", async () => {
const token = "ghp_test_token";
const expectedBase64 = Buffer.from(`x-access-token:${token}`).toString("base64");

await overridePersistedExtraheader(SERVER_URL, token);

expect(mockCore.setSecret).toHaveBeenCalledWith(expectedBase64);
});

it("should return empty array when no previous extraheader exists", async () => {
mockExec.getExecOutput.mockImplementation(async (_cmd, args) => {
// Only the --get-all read returns empty; unset-all calls use ignoreReturnCode
Expand Down