Don't fail if query path doesn't exist
This commit is contained in:
parent
013c02758e
commit
24096a1cb3
3 changed files with 8 additions and 3 deletions
4
lib/config-utils.js
generated
4
lib/config-utils.js
generated
|
|
@ -52,11 +52,13 @@ class Config {
|
||||||
// Resolve the local path against the workspace so that when this is
|
// Resolve the local path against the workspace so that when this is
|
||||||
// passed to codeql it resolves to exactly the path we expect it to resolve to.
|
// passed to codeql it resolves to exactly the path we expect it to resolve to.
|
||||||
const workspacePath = fs.realpathSync(util.getRequiredEnvParam('GITHUB_WORKSPACE'));
|
const workspacePath = fs.realpathSync(util.getRequiredEnvParam('GITHUB_WORKSPACE'));
|
||||||
const absoluteQueryPath = fs.realpathSync(path.join(workspacePath, localQueryPath));
|
let absoluteQueryPath = path.join(workspacePath, localQueryPath);
|
||||||
// Check the file exists
|
// Check the file exists
|
||||||
if (!fs.existsSync(absoluteQueryPath)) {
|
if (!fs.existsSync(absoluteQueryPath)) {
|
||||||
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
||||||
}
|
}
|
||||||
|
// Call this after checking file exists, because it'll fail if file doesn't exist
|
||||||
|
absoluteQueryPath = fs.realpathSync(absoluteQueryPath);
|
||||||
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
||||||
if (!(absoluteQueryPath + path.sep).startsWith(workspacePath + path.sep)) {
|
if (!(absoluteQueryPath + path.sep).startsWith(workspacePath + path.sep)) {
|
||||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -52,13 +52,16 @@ export class Config {
|
||||||
// Resolve the local path against the workspace so that when this is
|
// Resolve the local path against the workspace so that when this is
|
||||||
// passed to codeql it resolves to exactly the path we expect it to resolve to.
|
// passed to codeql it resolves to exactly the path we expect it to resolve to.
|
||||||
const workspacePath = fs.realpathSync(util.getRequiredEnvParam('GITHUB_WORKSPACE'));
|
const workspacePath = fs.realpathSync(util.getRequiredEnvParam('GITHUB_WORKSPACE'));
|
||||||
const absoluteQueryPath = fs.realpathSync(path.join(workspacePath, localQueryPath));
|
let absoluteQueryPath = path.join(workspacePath, localQueryPath);
|
||||||
|
|
||||||
// Check the file exists
|
// Check the file exists
|
||||||
if (!fs.existsSync(absoluteQueryPath)) {
|
if (!fs.existsSync(absoluteQueryPath)) {
|
||||||
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call this after checking file exists, because it'll fail if file doesn't exist
|
||||||
|
absoluteQueryPath = fs.realpathSync(absoluteQueryPath);
|
||||||
|
|
||||||
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
// Check the local path doesn't jump outside the repo using '..' or symlinks
|
||||||
if (!(absoluteQueryPath + path.sep).startsWith(workspacePath + path.sep)) {
|
if (!(absoluteQueryPath + path.sep).startsWith(workspacePath + path.sep)) {
|
||||||
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue