简体   繁体   English

AWS 检查器是否包含 package 个漏洞,这些漏洞位于 yarn.lock 中但未安装?

[英]Does AWS inspector include package vulnerabilities that are in yarn.lock but not installed?

When using AWS inspector for ECR images, the results mentioned vulnerabilities that don't seem to be installed on the image.在对 ECR 图像使用 AWS inspector 时,结果提到了图像上似乎没有安装的漏洞。

This article from snyk discusses how AWS Inspector is using Snyk to help with it's detecting. 这篇来自 snyk 的文章讨论了 AWS Inspector 如何使用 Snyk 来帮助进行检测。

Question:题:

My question is does AWS inspector or Snyk include package vulnerabilities that are in yarn.lock but not installed?我的问题是 AWS inspector 或 Snyk 是否包含 package 漏洞,这些漏洞位于 yarn.lock 中但未安装?

Is this the convention for other package inspectors, to include vulnerabilities in packages that aren't installed but are listed as dependencies?这是其他 package 检查员的惯例,将漏洞包含在未安装但列为依赖项的软件包中吗?

This doesn't make sense, why would it be a vulnerability if the package is not actually installed.这没有意义,为什么package没有实际安装会是漏洞呢。

More Info:更多信息:

The reason I don't think the package is installed is because when I run npm list ( docs ) the vulnerable package is not listed.我认为 package 未安装的原因是因为当我运行npm list (文档) 时,易受攻击的 package 未列出。

Also when I test locally I don't see a node_models folder with the suspected package. I do see it listed in a yarn.lock file.此外,当我在本地测试时,我没有看到带有可疑 package 的node_models文件夹。我确实看到它列在yarn.lock文件中。

(The suspected package is a devDependency of a dependency of a dependency of a package that is installed globally) (疑似package是全局安装的一个devDependencydependencydependency

Side Notes:旁注:

When I run npm audit ( docs ) I don't see any security issues listed.当我运行npm audit ( docs ) 时,我没有看到列出任何安全问题。 npm audit has it's own issues with listing vulnerabilities that may not be a real issue (see here and enter link description here ), but at least it's not listing packages that aren't even installed. npm audit在列出可能不是真正问题的漏洞方面有其自身的问题(请参阅此处并在此处输入链接描述),但至少它没有列出甚至没有安装的软件包。

This question may be dependent on this question, regarding devDependencies being installed when installing a package (globally).这个问题可能取决于这个问题,关于在安装devDependencies (全局)时安装的 devDependencies。

We solved this problem by manually deleting all yarn.lock files from our docker images as the last step:最后一步,我们通过手动删除 docker 图像中的所有 yarn.lock 文件解决了这个问题:

RUN yarn install --production --silent --pure-lockfile --cache-folder /usr/app/yarn-cache  \
    # get rid of all yarn.lock files as the AWS Inspector thinks they contain vulnerabilities
    && rm -rf ./yarn-cache \
    && find . -type f -name 'yarn.lock' -delete

obviously the bit about the --cache-folder may not be relevant to you, we just keep the cache around through our multistage builds to speed things up显然,关于--cache-folder的部分可能与您无关,我们只是在多阶段构建过程中保留缓存以加快速度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM