- What language is this for?
Docker - Which rule?
docker:S6505 - Why do you believe it’s a false-positive/false-negative?
The finding says to use the--ignore-scripts
argument toyarn
. However,yarn
has removed the--ignore-scripts
in the “berry” versions, see Quick question regarding "--ignore-scripts" · Issue #1679 · yarnpkg/berry · GitHub. Therefore, the rule is impossible to satisfy when using newer versions of yarn.
Foryarn
berry (that’s yarn 2.x and later), the equivalent is to set the environment variableYARN_ENABLE_SCRIPTS=false
- Are you using
- SonarQube - which version?
10.5.1
- SonarQube - which version?
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
The examples provided at Docker static code analysis demonstrate this problem:
FROM node:latest
RUN yarn install --ignore-scripts
is the recommended fix, but it gives an error with newer version of yarn. The correct example when using yarn 2 or later is:
RUN YARN_ENABLE_SCRIPTS=false yarn install