Skip to content

Commit 81c7264

Browse files
committed
update
1 parent 42bd60a commit 81c7264

16 files changed

Lines changed: 8355 additions & 10825 deletions

README.md

Lines changed: 269 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,269 @@
1-
# Submission
2-
Submit your KernelSU Modules!
3-
4-
### How to
5-
To submit your module, please fire an issue with title `[submission] module_id`, where `module_id` is the module ID of your module. Then our bot will automatically create a new repository and invite you to be the admin.
6-
7-
### Repository structure
8-
- Title: the module ID of your module (for example `ksu_example_module`)
9-
- Description: the name of your module (for example `Example KernelSU Module`)
10-
- Collaborators: authors of the module
11-
- Release Title: the version name
12-
- Release Content: the changelog
13-
- Release Tag: [version code]-[version name] (if you create the release along with apk assets, bot will automatically update it)
14-
- Home Page: the support link
15-
16-
### Repository content
17-
- SUMMARY: the summary of your module, will be shown in the front page
18-
- README.md: the full description of your module
19-
- For all meta files available please refer to [the example repository](https://github.com/KernelSU-Modules-Repo/org.meowcat.example)
20-
21-
### Important notes
22-
1. If your repository is incomplete, it won't be shown
23-
2. Update of your repositiory will automatically trigger [build](https://github.com/KernelSU-Modules-Repo/modules/actions/workflows/build.yml) and be shown in 5min
24-
3. If you want your module's update to be shown, please tag it correctly with the apk. (As long as you submit the release with the apk, bot will automatically [update](https://github.com/KernelSU-Modules-Repo/modules/actions/workflows/tag.yml) your tag. However, if you edit the release by **only** changing the apk, bot [cannot know](https://stackoverflow.com/questions/37437581/listening-to-release-asset-changes-with-github-webhooks) your editting and the tag won't be updated. So for the best practice, always submit release with valid apk.
25-
26-
## Transfer
27-
If you want to transfer an existing repo to the modules repo, please fire an issue with title `[transfer] module_id` and transfer the ownership of your original repo to our orginization.
1+
# KernelSU Developers Keyring Management
2+
3+
基于 X.509 PKI 的开发者身份认证系统,采用三级 CA 架构和自动审核机制。
4+
5+
## 📁 文件结构
6+
7+
```
8+
developers/
9+
├── index.js # 主入口文件,处理 GitHub Actions 事件
10+
├── keyring.js # X.509 证书签发核心逻辑
11+
├── rank.js # GitHub 开发者评分算法(自动审核)
12+
├── github-utils.js # GitHub API 封装工具函数
13+
├── utils.js # 通用工具函数
14+
├── module_integrity.md # X.509 PKI 设计文档
15+
├── AUTO_REVIEW.md # 自动审核机制详细说明
16+
└── website/ # 开发者门户网站(Next.js)
17+
├── src/
18+
│ ├── components/keyring-app.tsx # 证书管理 UI
19+
│ └── lib/locales.ts # 国际化(中英双语)
20+
└── package.json
21+
```
22+
23+
## 📋 文件说明
24+
25+
### index.js
26+
- **职责**: GitHub Actions 主入口
27+
- **功能**:
28+
- 监听 issue 的 `labeled``opened` 事件
29+
- 处理 spam 标记和关闭
30+
- 调用 keyring 处理流程
31+
32+
### keyring.js
33+
- **职责**: X.509 证书签发和管理
34+
- **功能**:
35+
- 从环境变量加载 Middle CA 证书和私钥
36+
- 从 CSR 签发开发者证书
37+
- 从 issue 中提取 CSR
38+
- 自动评估开发者并采取相应操作
39+
- 处理完整的 keyring issue 流程
40+
41+
### rank.js ⭐ 新增
42+
- **职责**: GitHub 开发者评分和自动审核
43+
- **功能**:
44+
- 基于 GitHub Readme Stats 算法计算开发者等级
45+
- 从 GitHub API 获取用户统计数据
46+
- 评估用户是否符合自动批准/拒绝条件
47+
- 生成详细的评估报告
48+
49+
### github-utils.js
50+
- **职责**: GitHub API 封装
51+
- **功能**:
52+
- Issue 操作(获取、关闭、锁定)
53+
- Label 操作(设置、添加、移除)
54+
- Comment 操作(创建评论)
55+
- 组织操作(屏蔽用户)
56+
57+
### utils.js
58+
- **职责**: 通用工具函数
59+
- **功能**:
60+
- 识别和解析 issue 标题标签
61+
62+
## 🔐 PKI 架构
63+
64+
### 三级 CA 信任链
65+
66+
```
67+
Root CA (离线保存,20年有效期)
68+
↓ 签发
69+
Middle CA / Signer (GitHub Secrets,10年有效期)
70+
↓ 签发
71+
开发者证书 (1年有效期,Code Signing)
72+
↓ 签名
73+
模块 ZIP
74+
```
75+
76+
### 证书规格
77+
78+
| 证书类型 | Subject | 算法 | 有效期 | 用途 |
79+
|---------|---------|------|--------|------|
80+
| **Root CA** | CN=KernelSU Root CA P-384 | ECC P-384 | 20年 | 签发 Middle CA |
81+
| **Middle CA** | CN=KernelSU Signer P-384 | ECC P-384 | 10年 | 签发开发者证书 |
82+
| **开发者证书** | CN={GitHub用户名} | RSA 2048 | 1年 | 代码签名 |
83+
84+
## 🤖 自动审核机制
85+
86+
### 评分标准
87+
88+
系统基于开发者的 GitHub 活动数据自动计算评分:
89+
90+
| 指标 | 权重 | MEDIAN 值 |
91+
|------|------|-----------|
92+
|**Stars** | **4** | 50 |
93+
| 🔀 **Pull Requests** | 3 | 50 |
94+
| 💻 **Commits** | 2 | 250 |
95+
| 🐛 **Issues** | 1 | 25 |
96+
| 👀 **Code Reviews** | 1 | 2 |
97+
| 👥 **Followers** | 1 | 10 |
98+
99+
### 审核规则
100+
101+
| 等级范围 | 百分位 | 操作 | 说明 |
102+
|---------|--------|------|------|
103+
| 🟢 **S, A+, A** | ≤ 25% | **自动批准** | Top 25% 开发者,立即签发证书 |
104+
| 🟡 **A-, B+, B, B-** | 25% - 75% | **人工审核** | 等待核心开发者手动审核 |
105+
| 🔴 **C+, C** | > 75% | **自动拒绝** | 需提升 GitHub 贡献后重新申请 |
106+
107+
> 📖 **详细说明**: 参见 [AUTO_REVIEW.md](AUTO_REVIEW.md)
108+
109+
## 🔑 环境变量
110+
111+
### GitHub Secrets 配置
112+
113+
- `MIDDLE_CA_CERT` - Middle CA 证书(PEM 格式,必需)
114+
- `MIDDLE_CA_KEY` - Middle CA 私钥(PEM 格式,必需)
115+
- `GITHUB_TOKEN` - GitHub API 令牌(自动提供)
116+
117+
> ⚠️ **安全提示**: Root CA 私钥应离线保存,永不上传到云端
118+
119+
## 🏷️ 支持的 Issue 标签
120+
121+
- `[keyring]` - 开发者证书申请(提交 CSR)
122+
- `[revoke]` - 证书吊销请求
123+
- `[appeal]` - 申诉
124+
- `[issue]` - 问题反馈
125+
- `[suggestion]` - 建议
126+
127+
## 🔄 完整工作流程
128+
129+
### 1️⃣ 开发者申请证书
130+
131+
1. 访问 [Developer Portal](https://kernelsu-modules-repo.github.io/developers/)
132+
2. 在 "Generate" 标签页生成私钥和 CSR
133+
3. 下载 `username.key.pem`(私钥,保密)和 `username.csr.pem`(CSR)
134+
4. 创建 `[keyring] username` issue,粘贴 CSR 内容
135+
136+
### 2️⃣ 自动评估
137+
138+
系统自动:
139+
1. 从 GitHub API 获取用户统计数据
140+
2. 计算开发者等级(S - C)
141+
3. 发布详细评估报告
142+
4. 根据等级采取行动:
143+
- **Top 25%**: 自动添加 `approved` 标签
144+
- **低于 75%**: 添加 `rejected` 标签并关闭 issue
145+
- **中间范围**: 等待人工审核
146+
147+
### 3️⃣ 证书签发(自动批准后)
148+
149+
1. GitHub Actions 检测到 `approved` 标签
150+
2. 使用 Middle CA 签发开发者证书
151+
3. 在 issue 评论中返回证书(`.cert.pem`
152+
4. 自动关闭 issue
153+
154+
### 4️⃣ 使用证书签名模块
155+
156+
```bash
157+
# 1. 保存证书
158+
# 下载 issue 中的证书并保存为 username.cert.pem
159+
160+
# 2. 生成模块文件清单
161+
find . -type f ! -path './META-INF/*' -print0 | \
162+
sort -z | xargs -0 sha256sum > META-INF/ksu/MANIFEST
163+
164+
# 3. 使用私钥签名
165+
openssl dgst -sha256 -sign username.key.pem \
166+
-out META-INF/ksu/MANIFEST.sig META-INF/ksu/MANIFEST
167+
168+
# 4. 打包证书链
169+
cp username.cert.pem META-INF/ksu/CERT
170+
cp middle_ca.cert.pem META-INF/ksu/CHAIN.pem
171+
```
172+
173+
## 📊 评估报告示例
174+
175+
```markdown
176+
## Developer Evaluation Report
177+
178+
**User**: @username (Real Name)
179+
**Account Created**: 2020-01-15
180+
181+
### GitHub Statistics
182+
183+
| Metric | Value | Weight | Median |
184+
|--------|-------|--------|--------|
185+
| 💻 Commits | 520 | 2 | 250 |
186+
| 🔀 Pull Requests | 85 | 3 | 50 |
187+
| 🐛 Issues | 42 | 1 | 25 |
188+
| 👀 Code Reviews | 15 | 1 | 2 |
189+
| ⭐ Stars | 320 | 4 | 50 |
190+
| 👥 Followers | 28 | 1 | 10 |
191+
192+
### Ranking Result
193+
194+
- **Level**: `A`
195+
- **Percentile**: `18.5%` (Top 18.5%)
196+
- **Score**: `9.76/12`
197+
198+
### Decision
199+
200+
**Action**: `auto_approve`
201+
**Reason**: Top 18.5% developer (Rank: A)
202+
```
203+
204+
## 🛡️ 安全特性
205+
206+
### 防刷榜设计
207+
208+
-**Stars 权重最高(33.3%)**: 无法仅通过刷 commits 获得高分
209+
-**多维度评估**: 综合 6 项 GitHub 活动指标
210+
-**统计学方法**: 使用概率分布归一化,科学公平
211+
212+
### 证书吊销
213+
214+
使用 CRL(证书吊销列表)机制:
215+
216+
```
217+
keyring/
218+
├── crl.pem # 证书吊销列表(Middle CA 签发)
219+
```
220+
221+
## 🌐 开发者门户
222+
223+
访问 [https://kernelsu-modules-repo.github.io/developers/](https://kernelsu-modules-repo.github.io/developers/) 进行:
224+
225+
- 🔑 生成私钥和 CSR
226+
- 📤 提交 CSR 到 GitHub Issue
227+
- 🔍 查询证书状态
228+
- 🚫 申请吊销证书
229+
230+
支持中英双语界面。
231+
232+
## 📚 相关文档
233+
234+
- [X.509 PKI 设计文档](module_integrity.md) - 完整的三级 CA 架构设计
235+
- [自动审核机制详解](AUTO_REVIEW.md) - 评分算法和规则说明
236+
- [GitHub Readme Stats](https://github.com/anuraghazra/github-readme-stats) - 评分算法来源
237+
238+
## 🔧 技术栈
239+
240+
### 后端(GitHub Actions)
241+
- Node.js
242+
- `node-forge` - X.509 证书生成和签名
243+
- `@octokit/rest` - GitHub API 交互
244+
- `@actions/github` - GitHub Actions 工具包
245+
246+
### 前端(开发者门户)
247+
- Next.js 16 (React 19)
248+
- TypeScript
249+
- `node-forge` - 浏览器端证书操作
250+
- Tailwind CSS
251+
- Shadcn UI
252+
253+
## 📝 变更历史
254+
255+
### v2.0.0 (2025-11-25)
256+
- ✨ 从 PGP 迁移到 X.509 PKI 架构
257+
- ✨ 实施三级 CA 信任链
258+
- ✨ 添加基于 GitHub Readme Stats 的自动审核机制
259+
- ✨ 重写前端 UI 支持 CSR 生成和证书验证
260+
- 📝 完整重写设计文档和用户指南
261+
262+
### v1.0.0
263+
- 🎉 初始版本(基于 PGP Web-of-Trust)
264+
265+
---
266+
267+
**维护者**: KernelSU Core Team
268+
**许可证**: MIT
269+
**最后更新**: 2025-11-25

bot.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)