mirror of
https://github.com/github/codeql-action.git
synced 2025-12-06 15:58:06 +08:00
Don't make temporary directories symlinks
`toolcache.extractTar` currently falls over when `ACTIONS_TEMP` contains a symlink, and the runner no longer exists, so it's unlikely our customers would be running with temporary directories that contain symlinks.
This commit is contained in:
6
lib/util.js
generated
6
lib/util.js
generated
@@ -89,11 +89,7 @@ exports.getToolNames = getToolNames;
|
||||
// Mostly intended for use within tests.
|
||||
async function withTmpDir(body) {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "codeql-action-"));
|
||||
const realSubdir = path.join(tmpDir, "real");
|
||||
fs.mkdirSync(realSubdir);
|
||||
const symlinkSubdir = path.join(tmpDir, "symlink");
|
||||
fs.symlinkSync(realSubdir, symlinkSubdir, "dir");
|
||||
const result = await body(symlinkSubdir);
|
||||
const result = await body(tmpDir);
|
||||
await (0, del_1.default)(tmpDir, { force: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -112,11 +112,7 @@ export async function withTmpDir<T>(
|
||||
body: (tmpDir: string) => Promise<T>
|
||||
): Promise<T> {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "codeql-action-"));
|
||||
const realSubdir = path.join(tmpDir, "real");
|
||||
fs.mkdirSync(realSubdir);
|
||||
const symlinkSubdir = path.join(tmpDir, "symlink");
|
||||
fs.symlinkSync(realSubdir, symlinkSubdir, "dir");
|
||||
const result = await body(symlinkSubdir);
|
||||
const result = await body(tmpDir);
|
||||
await del(tmpDir, { force: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user