From 454955c5bef350014a645b70d653c879a740aecd Mon Sep 17 00:00:00 2001 From: zhanghaidong Date: Sun, 19 Jul 2026 16:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=9699code=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E6=8F=92=E4=BB=B6=E5=95=86=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 29 +++++++++++++++++++++++++++-- manifest.example.json | 24 ++++++++++++++++++++++++ registry.json | 4 ++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 manifest.example.json create mode 100644 registry.json diff --git a/README.md b/README.md index d9aeddc..9fad5a3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,28 @@ -# 99code-plugins +# 99code Java 插件商店 -99code 受签名 Java 供应商插件商店 \ No newline at end of file +当前目录是生产后台“插件中心”的默认 Gitea 商店。`registry.json` 使用严格白名单字段;发布插件时应先上传 JAR 与清单,再向索引加入条目。 + +## 信任策略 + +插件与主应用运行在同一 JVM,必须满足以下任一条件: + +1. JAR 的 SHA-256 位于生产环境变量 `PLUGIN_TRUSTED_SHA256`; +2. 清单包含有效 Ed25519 签名,签名公钥通过 `PLUGIN_TRUSTED_ED25519_KEYS=keyId=X509Base64` 配置。 + +签名内容是 JAR 的 SHA-256 原始 32 字节,不是十六进制字符串。安装器还会校验清单大小、artifact 大小、JAR 条目数量、解压总量和路径穿越。 + +## registry.json 条目 + +```json +{ + "id": "example-provider", + "name": "示例供应商插件", + "version": "1.0.0", + "description": "简短说明", + "manifest_url": "https://git.example/plugins/raw/branch/main/example-provider/manifest.json", + "platforms": ["openai"], + "sha256": "64 位小写 SHA-256" +} +``` + +凭据同步响应支持 `auth-revision`(同时兼容 `auth_revision`)和 `credentials`。敏感 token 只能出现在同步响应或后台的加密 `secrets` 输入中,不得写入清单、registry、普通配置或日志。 diff --git a/manifest.example.json b/manifest.example.json new file mode 100644 index 0000000..ec69090 --- /dev/null +++ b/manifest.example.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "id": "example-provider", + "name": "示例供应商插件", + "version": "1.0.0", + "description": "实现 ProviderPlugin SPI 的签名 Java 扩展。", + "entrypoint": "com.example.plugin.ExampleProviderPlugin", + "platforms": [ + "openai" + ], + "artifact": { + "url": "https://git.example/plugins/raw/branch/main/example-provider-1.0.0.jar", + "sha256": "替换为 64 位小写 SHA-256", + "signature": "替换为对 artifact SHA-256 原始 32 字节签名后的 Base64", + "key_id": "release-2026", + "size": 1 + }, + "credential_sync": { + "url": "https://home.example/api/plugin-credentials/example-provider", + "status_url": "https://home.example/api/plugin-credentials/example-provider/status", + "auth-revision": "" + }, + "metadata": {} +} diff --git a/registry.json b/registry.json new file mode 100644 index 0000000..ea952a7 --- /dev/null +++ b/registry.json @@ -0,0 +1,4 @@ +{ + "schema_version": 1, + "plugins": [] +}