Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: propertly create target file path for --file= with absolute path #2319

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/snyk-test/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,10 @@ async function assembleLocalPayloads(

// Forcing options.path to be a string as pathUtil requires is to be stringified
const targetFileRelativePath = targetFile
? pathUtil.join(pathUtil.resolve(`${options.path || root}`), targetFile)
? pathUtil.resolve(
pathUtil.resolve(`${options.path || root}`),
targetFile,
)
: '';

let targetFileDir;
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/npm/with-vulnnerable-lodash-and-snyk-file/.snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.22.1
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-LODASH-590103:
- '*':
reason: None Given
expires: 2021-11-21T21:55:08.466Z
created: 2021-10-22T21:55:08.469Z
patch: {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "with-vulnerable-lodash-dep",
"version": "1.2.3",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"license": "ISC",
"dependencies": {
"lodash": "4.17.15"
}
}
Loading