@sunchao116/mcp-audit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +36 -0
- package/src/audit/currentAudit.js +50 -0
- package/src/audit/getDepChain.js +47 -0
- package/src/audit/index.js +28 -0
- package/src/audit/normalizeAuditResult.js +47 -0
- package/src/audit/npmAudit.js +10 -0
- package/src/audit/remoteAudit.js +24 -0
- package/src/audit/test/test-currentAudit.js +15 -0
- package/src/audit/test/test-getDepChain.js +13 -0
- package/src/audit/test/test-index.js +17 -0
- package/src/audit/test/test-normalizeAuditResult.js +18 -0
- package/src/audit/test/test-npmAudit.js +15 -0
- package/src/audit/test/test-remoteAudit.js +15 -0
- package/src/audit/test/workdir/audit.json +2130 -0
- package/src/audit/test/workdir/current.json +10 -0
- package/src/audit/test/workdir/index.json +2398 -0
- package/src/audit/test/workdir/normalized.json +2581 -0
- package/src/audit/test/workdir/package-lock.json +16137 -0
- package/src/audit/test/workdir/package.json +1 -0
- package/src/audit/test/workdir/remote.json +75 -0
- package/src/common/utils.js +35 -0
- package/src/entry/index.js +28 -0
- package/src/entry/test/result/result-local.md +1177 -0
- package/src/entry/test/result/result-remote.md +151 -0
- package/src/entry/test/test-index.js +15 -0
- package/src/generateLock/generateLock.js +27 -0
- package/src/generateLock/index.js +1 -0
- package/src/generateLock/test/1.json +1 -0
- package/src/generateLock/test/test.js +15 -0
- package/src/generateLock/test/workdir/package-lock.json +16137 -0
- package/src/generateLock/test/workdir/package.json +1 -0
- package/src/main/index.js +23 -0
- package/src/mcpServer.js +43 -0
- package/src/parseProject/index.js +18 -0
- package/src/parseProject/parseLocalProject.js +8 -0
- package/src/parseProject/parseRemoteProject.js +65 -0
- package/src/parseProject/test/test.js +26 -0
- package/src/render/index.js +24 -0
- package/src/render/markdown.js +17 -0
- package/src/render/template/audit.ejs +30 -0
- package/src/render/template/detail-item.ejs +32 -0
- package/src/render/template/detail.ejs +7 -0
- package/src/render/template/index.ejs +8 -0
- package/src/render/test/test-index.js +27 -0
- package/src/render/test/workdir/auditResult.json +2101 -0
- package/src/render/test/workdir/index.md +1221 -0
- package/src/render/test/workdir/package.json +38 -0
- package/src/workDir/index.js +21 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# `webpack-dev-server`审计结果
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
您所审计的工程总共有 **4** 个风险漏洞。
|
|
5
|
+
|
|
6
|
+
其中:
|
|
7
|
+
|
|
8
|
+
- **严重漏洞**:共计 **0** 个
|
|
9
|
+
- **高危漏洞**:共计 **3** 个
|
|
10
|
+
- **中危漏洞**:共计 **1** 个
|
|
11
|
+
- **低危漏洞**:共计 **0** 个
|
|
12
|
+
|
|
13
|
+
> 说明:
|
|
14
|
+
>
|
|
15
|
+
> - **严重**漏洞被认为是极其严重的,应该立即修复。
|
|
16
|
+
> - **高危**漏洞被认为是严重的,应该尽快修复。
|
|
17
|
+
> - **中危**漏洞被认为是中等严重的,可以选择在时间允许时修复。
|
|
18
|
+
> - **低危**漏洞被认为是轻微的,可以根据自行需要进行修复。
|
|
19
|
+
|
|
20
|
+
下面是漏洞的详细信息
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 高危漏洞
|
|
25
|
+
|
|
26
|
+
共计 **3** 个
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### `semver`
|
|
30
|
+
|
|
31
|
+
**漏洞描述**:
|
|
32
|
+
|
|
33
|
+
- semver vulnerable to Regular Expression Denial of Service
|
|
34
|
+
- npm漏洞编号:`1101088`
|
|
35
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
|
|
36
|
+
- 漏洞等级:高危
|
|
37
|
+
- 受影响的版本:`>=7.0.0 <7.5.2`
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
**依赖关系**:
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- `webpack-dev-server` / `@commitlint/cli` / `@commitlint/lint` / `@commitlint/is-ignored` / `semver`
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
**漏洞包所在目录**:
|
|
50
|
+
|
|
51
|
+
- `node_modules/@commitlint/is-ignored/node_modules/semver`
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### `tar-fs`
|
|
55
|
+
|
|
56
|
+
**漏洞描述**:
|
|
57
|
+
|
|
58
|
+
- tar-fs Vulnerable to Link Following and Path Traversal via Extracting a Crafted tar File
|
|
59
|
+
- npm漏洞编号:`1104677`
|
|
60
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-pq67-2wwv-3xjx
|
|
61
|
+
- 漏洞等级:高危
|
|
62
|
+
- 受影响的版本:`>=2.0.0 <2.1.2`
|
|
63
|
+
|
|
64
|
+
- tar-fs can extract outside the specified dir with a specific tarball
|
|
65
|
+
- npm漏洞编号:`1105197`
|
|
66
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-8cj5-5rvv-wf4v
|
|
67
|
+
- 漏洞等级:高危
|
|
68
|
+
- 受影响的版本:`>=2.0.0 <2.1.3`
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
**依赖关系**:
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
- `webpack-dev-server` / `puppeteer` / `tar-fs`
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
**漏洞包所在目录**:
|
|
81
|
+
|
|
82
|
+
- `node_modules/tar-fs`
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### `ws`
|
|
86
|
+
|
|
87
|
+
**漏洞描述**:
|
|
88
|
+
|
|
89
|
+
- ws affected by a DoS when handling a request with many HTTP headers
|
|
90
|
+
- npm漏洞编号:`1098392`
|
|
91
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-3h5v-q93c-6h6q
|
|
92
|
+
- 漏洞等级:高危
|
|
93
|
+
- 受影响的版本:`>=8.0.0 <8.17.1`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
**依赖关系**:
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- `webpack-dev-server` / `puppeteer` / `ws`
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
**漏洞包所在目录**:
|
|
106
|
+
|
|
107
|
+
- `node_modules/puppeteer/node_modules/ws`
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## 中危漏洞
|
|
114
|
+
|
|
115
|
+
共计 **1** 个
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### `webpack-dev-server`
|
|
119
|
+
|
|
120
|
+
**漏洞描述**:
|
|
121
|
+
|
|
122
|
+
- webpack-dev-server users' source code may be stolen when they access a malicious web site with non-Chromium based browser
|
|
123
|
+
- npm漏洞编号:`1105256`
|
|
124
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-9jgg-88mc-972h
|
|
125
|
+
- 漏洞等级:中危
|
|
126
|
+
- 受影响的版本:`<=5.2.0`
|
|
127
|
+
|
|
128
|
+
- webpack-dev-server users' source code may be stolen when they access a malicious web site
|
|
129
|
+
- npm漏洞编号:`1105257`
|
|
130
|
+
- 漏洞详细说明:https://github.com/advisories/GHSA-4v9v-hfq4-rm2v
|
|
131
|
+
- 漏洞等级:中危
|
|
132
|
+
- 受影响的版本:`<=5.2.0`
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
**依赖关系**:
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
当前工程
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
**漏洞包所在目录**:
|
|
143
|
+
|
|
144
|
+
- `.`
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { auditPackage } from '../index.js';
|
|
2
|
+
|
|
3
|
+
// auditPackage(
|
|
4
|
+
// `D:/office/vue/监控线上bug/回放`,
|
|
5
|
+
// `/Users/sunch/Desktop/my-site.md`
|
|
6
|
+
// ).then(() => {
|
|
7
|
+
// console.log('本地工程审计完成');
|
|
8
|
+
// });
|
|
9
|
+
|
|
10
|
+
auditPackage(
|
|
11
|
+
`https://github.com/webpack/webpack-dev-server/tree/v4.9.3`,
|
|
12
|
+
`C:/Users/sunch/Desktop/webpack-dev-server_4_9_3.md`
|
|
13
|
+
).then(() => {
|
|
14
|
+
console.log('远程工程审计完成');
|
|
15
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { join, dirname } from 'path';
|
|
3
|
+
import { runCommand } from '../common/utils.js';
|
|
4
|
+
|
|
5
|
+
// 写入 package.json
|
|
6
|
+
async function writePackageJson(workDir, packageJson) {
|
|
7
|
+
const packageJsonPath = join(workDir, 'package.json');
|
|
8
|
+
fs.mkdirSync(dirname(packageJsonPath), { recursive: true });
|
|
9
|
+
await fs.promises.writeFile(
|
|
10
|
+
packageJsonPath,
|
|
11
|
+
JSON.stringify(packageJson),
|
|
12
|
+
'utf8'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 创建 lock 文件
|
|
17
|
+
async function createLockFile(workDir) {
|
|
18
|
+
const cmd = `npm install --package-lock-only --force`;
|
|
19
|
+
await runCommand(cmd, workDir); // 在工作目录中执行命令
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function generateLock(workDir, packageJson) {
|
|
23
|
+
// 1. 将 package.json 写入工作目录
|
|
24
|
+
await writePackageJson(workDir, packageJson);
|
|
25
|
+
// 2. 生成 lock 文件
|
|
26
|
+
await createLockFile(workDir);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { generateLock } from './generateLock.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"my-site","version":"0.1.0","private":true,"scripts":{"serve":"vue-cli-service serve","build":"vue-cli-service build --modern","test:Pager":"vue serve ./src/components/Pager/test.vue","test:Avatar":"vue serve ./src/components/Avatar/test.vue","test:Icon":"vue serve ./src/components/Icon/test.vue","test:Empty":"vue serve ./src/components/Empty/test.vue","test:ImageLoader":"vue serve ./src/components/ImageLoader/test.vue","test:Contact":"vue serve ./src/components/SiteAside/Contact/test.vue","test:Menu":"vue serve ./src/components/SiteAside/Menu/test.vue","test:SiteAside":"vue serve ./src/components/SiteAside/test.vue","test:Layout":"vue serve ./src/components/Layout/test.vue","test:RightList":"vue serve ./src/views/Blog/components/RightList-test.vue"},"dependencies":{"axios":"^0.21.0","core-js":"^3.6.5","highlight.js":"^10.5.0","mockjs":"^1.1.0","nprogress":"^0.2.0","querystring":"^0.2.0","vue":"^2.6.11","vue-router":"^3.4.9","vuex":"^3.6.2"},"devDependencies":{"@vue/cli-plugin-babel":"~4.5.0","@vue/cli-service":"~4.5.0","less":"^3.0.4","less-loader":"^5.0.0","vue-template-compiler":"^2.6.11","webpack-bundle-analyzer":"^4.4.0"}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { generateLock } from '../index.js';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { getDirname } from '../../common/utils.js';
|
|
5
|
+
|
|
6
|
+
const packageJsonPath = join(getDirname(import.meta.url), '1.json');
|
|
7
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
8
|
+
|
|
9
|
+
async function test() {
|
|
10
|
+
const workDir =
|
|
11
|
+
'/Users/yuanjin/Desktop/mcp-audit/src/generateLock/test/workdir';
|
|
12
|
+
await generateLock(workDir, packageJson);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test();
|