NextGuardHQ/nextguard-strapi-v4
GitHub: NextGuardHQ/nextguard-strapi-v4
NextGuard 是一款 Strapi 4 安全插件,通过自动检测并同步已安装包的版本信息来实现每日 CVE 漏洞监控与安全公告告警。
Stars: 0 | Forks: 0
# NextGuard — Strapi 4 插件
监控你已安装的 Strapi 包的 CVE 和安全公告。
每天自动同步到 [nextguardhq.com](https://nextguardhq.com)。
## 要求
- Strapi **4.x**
- Node.js 14+
- NextGuard Starter 计划(或更高版本)
## 安装
### 选项 A — npm 包
```
npm install nextguard-strapi-plugin
```
在 `config/plugins.js` 中启用该插件:
```
module.exports = {
nextguard: { enabled: true },
};
```
### 选项 B — 本地插件
将 `nextguard-strapi-plugin/` 文件夹复制到你 Strapi 项目的 `src/plugins/nextguard/` 目录中。
在 `config/plugins.js` 中启用:
```
module.exports = {
nextguard: {
enabled : true,
resolve : './src/plugins/nextguard',
},
};
```
## 配置
所有配置均通过管理面板完成 —— 无需 `.env` 文件。
1. 转到 Strapi 管理面板中的 **Settings → NextGuard**。
2. 输入来自 [nextguardhq.com → Account → API Keys](https://nextguardhq.com/account) 的 API key。
3. 点击 **Get activation code**。
4. 打开 [nextguardhq.com → Account → Connected Devices](https://nextguardhq.com/account) 并输入 6 位字符的代码。
5. 插件将自动连接并运行首次同步。
## 同步内容
该插件会读取你项目的 `package.json` 并报告:
| 包类型 | 示例 |
|---|---|
| Strapi 核心 | `@strapi/strapi` |
| 官方插件 | `@strapi/plugin-users-permissions`, `@strapi/plugin-i18n` |
| 社区插件 | `strapi-plugin-io`, `strapi-plugin-seo` |
| Providers | `@strapi/provider-upload-aws-s3` |
每个包报告的字段:`name`, `slug`, `version` (来自 `node_modules`), `type`, `active: true`。
## 同步计划
- **自动**:每天 UTC 时间 02:00(通过 Strapi 内置的 cron)
- **启动时**:首次同步在 Strapi 启动 10 秒后运行
- **手动**:在设置中点击 **Sync now**
## 环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
| `NEXTGUARD_HOST` | `https://nextguardhq.com` | 覆盖 API host(用于自托管) |
## 发送到 NextGuard API 的数据
```
{
"projectId" : "uuid",
"cmsType" : "strapi",
"cmsVersion" : "4.15.0",
"nodeVersion": "20.11.0",
"siteUrl" : "https://my-site.com",
"components" : [
{ "name": "@strapi/strapi", "slug": "@strapi/strapi", "version": "4.15.0", "type": "core", "active": true },
{ "name": "@strapi/plugin-i18n", "slug": "@strapi/plugin-i18n", "version": "4.15.0", "type": "plugin", "active": true }
]
}
```
使用 HMAC-SHA256 签名(`X-NG-Signature` header)。设备 token 存储在 Strapi 的数据库中
(`plugin_store` 表)—— 绝不会存储在文件或环境变量中。
## 许可证
MIT
标签:GNU通用公共许可证, MITM代理, Node.js, Strapi, Syscall, Web开发, 依赖安全, 插件, 暗色界面, 自定义脚本, 配置审计