9

我试图了解npm audit命令是如何工作的。

它通过哪种算法定义存在问题

最重要的是它如何区分低/中/高/关键级别

在此处输入图像描述

4

2 回答 2

9

没有算法,只有人。

npm audit 所做的是查看您正在使用的包和版本,并将其与 npm 的漏洞数据库进行比较。这是该数据库的Web 界面

如果您单击任何“问题”,您将看到 3 条信息:问题描述、建议的修复方法以及指向问题报告位置的链接。

至于 npm 如何确定问题的严重性,它没有。问题的严重程度由人来决定,而且几乎都是由志愿者完成的。这是开源的承诺之一:用足够多的眼睛查看您的非隐藏代码,可以发现错误。

于 2019-04-08T08:55:35.600 回答
2

npm audit 是一个用于查找 npm 包漏洞的安全模块,漏洞数据库可在网站上找到: https ://www.npmjs.com/advisories

漏洞格式如下:

    {
  "id": <vulnerability id>,
  "created_at": <creation date>,
  "updated_at": <update date>,
  "title": <vulnerability title>,
  "author": {
    "name": <contributor name>,
    "website": <contributor website>,
    "username": <contributor username>
  },
  "module_name": <product name>,
  "publish_date": <publication date>,
  "cves": [
    <cve name (if existing)>
  ],
  "vulnerable_versions": <vulnerable version(s)>,
  "patched_versions": <fix version(s)>,
  "overview": <vulnerability description>,
  "recommendation": <vendor advisory>,
  "references": [
    <source list>
  ],
  "cvss_vector": <CVSS vector in format AV:x/AC:x/PR:x/UI:x/S:x/C:x/I:x/A:x>,
  "cvss_score": <criticity score (between 0 and 10)>,
  "coordinating_vendor": <editor information>
}

npm 审计会将包信息与所有漏洞进行匹配,并返回匹配的漏洞。

关于评分,使用的是 CVSS 评分,您可以在此处找到文档: https ://www.first.org/cvss/specification-document

于 2020-04-22T09:13:27.863 回答