snyk 1.820.0 → 1.821.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/293.index.js +13 -8
- package/dist/cli/293.index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli/293.index.js
CHANGED
|
@@ -1864,7 +1864,7 @@ function createSarifOutputForIac(iacTestResponses) {
|
|
|
1864
1864
|
const basePath = detect_1.isLocalFolder(iacTestResponses[0].path)
|
|
1865
1865
|
? pathLib.resolve('.', iacTestResponses[0].path)
|
|
1866
1866
|
: pathLib.resolve('.');
|
|
1867
|
-
const repoRoot = getRepoRoot();
|
|
1867
|
+
const repoRoot = getRepoRoot(basePath);
|
|
1868
1868
|
const issues = iacTestResponses.reduce((collect, res) => {
|
|
1869
1869
|
if (res.result) {
|
|
1870
1870
|
// targetFile is the computed relative path of the scanned file
|
|
@@ -2003,13 +2003,18 @@ function mapIacTestResponseToSarifResults(issues) {
|
|
|
2003
2003
|
});
|
|
2004
2004
|
}
|
|
2005
2005
|
exports.mapIacTestResponseToSarifResults = mapIacTestResponseToSarifResults;
|
|
2006
|
-
function getRepoRoot() {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2006
|
+
function getRepoRoot(basePath) {
|
|
2007
|
+
try {
|
|
2008
|
+
const cwd = process.cwd();
|
|
2009
|
+
const stdout = child_process_1.execSync('git rev-parse --show-toplevel', {
|
|
2010
|
+
encoding: 'utf8',
|
|
2011
|
+
cwd,
|
|
2012
|
+
});
|
|
2013
|
+
return stdout.trim() + '/';
|
|
2014
|
+
}
|
|
2015
|
+
catch (_a) {
|
|
2016
|
+
return basePath;
|
|
2017
|
+
}
|
|
2013
2018
|
}
|
|
2014
2019
|
function getPathRelativeToRepoRoot(repoRoot, basePath, filePath) {
|
|
2015
2020
|
const fullPath = pathLib.resolve(basePath, filePath).replace(/\\/g, '/');
|