eric sciple 2025-10-17 00:32:56 +00:00
parent dc519229d3
commit 1929737c8e
2 changed files with 29 additions and 14 deletions

8
dist/index.js vendored
View File

@ -498,6 +498,10 @@ class GitAuthHelper {
} }
// Remove credentials config files // Remove credentials config files
for (const credentialsPath of credentialsPaths) { for (const credentialsPath of credentialsPaths) {
// Only remove credentials config files if they are under RUNNER_TEMP
const runnerTemp = process.env['RUNNER_TEMP'];
assert.ok(runnerTemp, 'RUNNER_TEMP is not defined');
if (credentialsPath.startsWith(runnerTemp)) {
try { try {
core.info(`Removing credentials config '${credentialsPath}'`); core.info(`Removing credentials config '${credentialsPath}'`);
yield io.rmRF(credentialsPath); yield io.rmRF(credentialsPath);
@ -507,6 +511,10 @@ class GitAuthHelper {
core.warning(`Failed to remove credentials config '${credentialsPath}'`); core.warning(`Failed to remove credentials config '${credentialsPath}'`);
} }
} }
else {
core.debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`);
}
}
}); });
} }
/** /**

View File

@ -473,6 +473,10 @@ class GitAuthHelper {
// Remove credentials config files // Remove credentials config files
for (const credentialsPath of credentialsPaths) { for (const credentialsPath of credentialsPaths) {
// Only remove credentials config files if they are under RUNNER_TEMP
const runnerTemp = process.env['RUNNER_TEMP']
assert.ok(runnerTemp, 'RUNNER_TEMP is not defined')
if (credentialsPath.startsWith(runnerTemp)) {
try { try {
core.info(`Removing credentials config '${credentialsPath}'`) core.info(`Removing credentials config '${credentialsPath}'`)
await io.rmRF(credentialsPath) await io.rmRF(credentialsPath)
@ -482,6 +486,9 @@ class GitAuthHelper {
`Failed to remove credentials config '${credentialsPath}'` `Failed to remove credentials config '${credentialsPath}'`
) )
} }
} else {
core.debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`)
}
} }
} }