fix: improve consistency of results from YarnAuditAnalyzer - #8768
Conversation
6d4d6b2 to
6926258
Compare
6926258 to
9c07e40
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 19 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
core/src/main/java/org/owasp/dependencycheck/analyzer/YarnAuditAnalyzer.java:270
fetchYarnAdvisoriesnow invokesyarn npm auditand no longer passes--offline, but the method Javadoc above still documentsyarn audit --offlineand says it generates a payload for the NPM API. Update that Javadoc to describe the actual command and behavior so maintainers are not misled.
final String advisoriesJsons = startAndReadStdoutToString(createYarnBuilder(getDependencyDirectory(dependency.getActualFile()), args));
core/src/test/resources/yarn/yarn-classic-audit/package.json:19
- This fixture no longer declares
markedafter the dependency minimization, so the retained comment block above is now false and misleading. Please remove it or replace it with a comment describing the remaining fixture dependency.
"swig": "1.4.2"
be63cf3 to
9c6348f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 19 changed files in this pull request and generated 6 comments.
Suppressed comments (1)
core/src/test/java/org/owasp/dependencycheck/analyzer/YarnAuditAnalyzerIT.java:110
- The env var name is duplicated as a string literal. Using YarnAuditAnalyzer.YARN_ENV_IGNORE_PATH avoids drift if the production constant ever changes.
try (MockedStatic<SystemUtils> systemMock = mockStatic(SystemUtils.class)) {
systemMock.when(() -> SystemUtils.getEnvironmentVariable("YARN_IGNORE_PATH", null)).thenReturn(envValue);
9c6348f to
ffa6ff1
Compare
Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
ffa6ff1 to
7b795d3
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
nhumblot
left a comment
There was a problem hiding this comment.
praise: thank you for this proposal!
| | [RetireJS](./retirejs-analyzer.html) | JavaScript files | Analyzes JavaScript files using the [RetireJS](https://github.com/RetireJS/retire.js) database. | | ||
| | [Ruby bundler‑audit](./bundle-audit.html) | Ruby `Gemfile.lock` files | Executes bundle-audit and incorporates the results into the dependency-check report. | | ||
| | [Yarn Audit](./yarn-audit.html) | Yarn lock files (`yarn.lock`) | Uses the Yarn CLI `audit` command to analyze lock files and retrieve vulnerabilities from the NPM Audit APIs. | | ||
| | [Yarn Audit](./yarn-audit.html) | Yarn lock files (`yarn.lock`) | Uses the Yarn CLI `npm audit` command to analyze lock files and retrieve vulnerabilities from the NPM Audit APIs. | |
There was a problem hiding this comment.
suggestion: to remove ambiguity, we could formulate it:
Uses the
yarn npm auditcommand to analyze lock files and retrieve vulnerabilities from the NPM Audit APIs.
| ================ | ||
|
|
||
| Uses the Yarn CLI `audit` command to analyze `yarn.lock` files and retrieve vulnerabilities from the [NPM Audit](https://www.npmjs.com/) APIs. | ||
| Uses the Yarn CLI `npm audit` command to analyze `yarn.lock` files and retrieve vulnerabilities from the [NPM Audit](https://www.npmjs.com/) APIs. |
There was a problem hiding this comment.
suggestion: to remove ambiguity, we could formulate it:
Uses the
yarn npm auditcommand to analyze lock files and retrieve vulnerabilities from the NPM Audit APIs.
Description of Change
Improves consistency of results from invoking yarn (via direct install or corepack) by ensuring use of the ODC environment-defined yarn version (via path or corepack validation)
npm auditAPI for dependencies that aren't actually asserted against in tests.Have test cases been added to cover the new functionality?
yes