Fix config path comparisons where workspace path is a symlink
Before this change, config-utils.ts › load non-empty input was failing on Mac with: The configuration file "/var/folders/gx/y8v1507s29d97m1r_5kq0s000000gn/T/codeql-action-oum66d/input" is invalid: property "queries.uses" is invalid as the local path "" is outside of the repository The reason is that the tmp directory (which is where the config file was put by the test) was a symlink.
This commit is contained in:
parent
6de3e1cde4
commit
0b53ebbc36
3 changed files with 3 additions and 3 deletions
2
lib/config-utils.js
generated
2
lib/config-utils.js
generated
|
|
@ -58,7 +58,7 @@ class Config {
|
|||
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
||||
}
|
||||
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
||||
if (!(fs.realpathSync(absoluteQueryPath) + path.sep).startsWith(workspacePath + path.sep)) {
|
||||
if (!(fs.realpathSync(absoluteQueryPath) + path.sep).startsWith(fs.realpathSync(workspacePath) + path.sep)) {
|
||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||
}
|
||||
this.additionalQueries.push(absoluteQueryPath);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -60,7 +60,7 @@ export class Config {
|
|||
}
|
||||
|
||||
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
||||
if (!(fs.realpathSync(absoluteQueryPath) + path.sep).startsWith(workspacePath + path.sep)) {
|
||||
if (!(fs.realpathSync(absoluteQueryPath) + path.sep).startsWith(fs.realpathSync(workspacePath) + path.sep)) {
|
||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue