Skip to content

feat: add Plugin Listing Workbench (submission-workbench) — 插件上架材料工作台 - #145

Open
zhuyankarl wants to merge 2 commits into
MiniMax-AI:mainfrom
zhuyankarl:main
Open

zhuyankarl wants to merge 2 commits into
MiniMax-AI:mainfrom
zhuyankarl:main

Conversation

@zhuyankarl

@zhuyankarl zhuyankarl commented Nov 17, 2026 •

Copy link
Copy Markdown

feat: add Plugin Listing Workbench (submission-workbench) — 插件上架材料工作台

A Mini App that prepares a MiniMax Plugin submission: paste the plugin manifest and the listing
fields, get every required field and cross-file inconsistency checked item by item, and download
a reviewable listing package that names what is missing. A bundled listing-check Skill hands
the same checklist to the Agent.

What it does

  • Listing information — paste the full .minimax-plugin/plugin.json, then set the market
    name, target category, summary, documentation (written into the package README.md) and up to
    3 example queries.
  • Target market requirements — new submission or update of an existing plugin, submission
    email, submitting Feishu account, target region (CN/US) and enabled clients
    (desktop/cloud). Region and enabled clients are two independent dimensions managed by the
    Marketplace catalog; they are not written into plugin.json.
  • Assets — upload by role: icon (the path the manifest declares), screenshots, and
    Skill/MCP/App files.
  • Results — missing items and content conflicts, the market card preview, the intake channels
    this machine can reach, and the downloadable listing package.
  • Bundled Skill — listing-check gives the Agent the same checklist: required manifest
    fields, the fixed categories, the "at least one capability" rule, the version-bump rule, the
    package limits and the two official intake channels.

It never submits anything. The official intake channels are a Feishu form (a human submits it in
a logged-in browser) and a public GitHub repository, so the app only produces materials you can
review — and it says exactly that in its own report.

Update (2026-11-19) — the review found that the two id-taking routes built their file paths
from the query string without validation, so ../../canary could delete or read a file one level
above the data directory. Fixed in 803ac0f (v1.1.1): every id must be a server-generated UUID and
the resolved path must stay inside the asset or package directory; regression tests live in
tests/path-traversal.mjs. Details and evidence are in the comment below.

Tested environment

  • MiniMax Code 3.1.16 on Windows 11.
  • Node.js 24.15.0 (any LTS release works; the Node payload is a plain Node process with no
    dependencies and no build step).

Test results

  • npm run validate in this repository reports plugins/zhuyankarl/submission-workbench: OK
    and repository: OK — 0 errors and 0 warnings for this package.
  • The package's own tests: node tests/selftest.mjs → 49 passed, 0 failed;
    node tests/client-harness.mjs → 46 passed, 0 failed;
    node tests/server-harness.mjs → 32 passed, 0 failed;
    node tests/path-traversal.mjs → 175 passed, 0 failed.
  • Installed and opened in MiniMax Code: the page renders, a check run reports 0 errors,
    0 warnings and 0 missing items, and the listing package downloads as a ZIP whose root contains
    .minimax-plugin/plugin.json.
  • The listing package produced for this submission: 349,764 bytes, SHA-256
    e013a525694917ed5d8acaf7c1ea39612a99b8272a2744cddc985d52a4398379.

Unverified behaviour

  • Only Windows 11 was tested; macOS and Linux are untested.
  • Only the desktop client is claimed. The Node payload needs a local Node.js runtime, so the
    cloud client is not enabled.
  • npm test in this repository has two failing tests — files: a symlink inside the package is an error and files: a package root that is itself a symlink is rejected before walking. They
    fail because fs.symlink returns EPERM on this Windows account without symlink privileges,
    and they fail independently of this package.
Package layout
plugins/zhuyankarl/submission-workbench/
├── .minimax-plugin/plugin.json   # manifest: name submission-workbench, v1.1.1, Productivity
├── package.json                  # mcode.miniApp declaration
├── icon.png
├── README.md                     # English (this repository's convention)
├── README.zh-CN.md               # Chinese
├── docs/preview.png              # screenshot of the running app
├── skills/listing-check/SKILL.md # Agent-facing checklist
├── tests/                        # selftest + client/server harnesses + path-traversal regression (not part of the payload)
└── miniapp/
    ├── miniapp.json
    ├── client/                   # plain HTML/CSS/JS page
    └── node/                     # Node payload: rules, package builder, ZIP writer
Data & access
  • Files it reads: only the files inside its own package.
  • Files it writes: the working draft, the uploaded assets and the generated listing packages,
    under the writable data directory the Host provides for this plugin
    (<dataDir>/v2/plugin-data/liveboards/submission-workbench/). It never writes into the plugin
    package itself. Every asset and package id is a UUID this server generates; an id that is not one
    is refused before it can name a file, and the resolved path is checked to stay inside the asset
    and package directories.
  • Network requests: when you run a check, the Node service makes three HTTPS GET requests
    to see whether the documented intake channels are reachable — the submission guide on
    code.minimax.cn and two Feishu form URLs on vrfi1sk8a0.feishu.cn. There is no other
    outbound traffic. The Node service listens on the loopback port the Host assigns it.
  • Agent turns it runs: none (miniapp/miniapp.json declares no agentAccess).
  • Conversations it reads: none.
  • Tools it calls: none (no toolAccess).
  • Microphone, camera, notifications: none.
  • Which MiniMax Code page you are on: not read (no hostAccess).
Where else this package lives

The same package is published in the author's own repository and can be installed from there:
https://github.com/zhuyankarl/mcode-plugins/tree/main/plugins/submission-workbench


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Copy link
Copy Markdown
Collaborator

The asset-delete and bundle-download endpoints accept IDs that can escape their intended directories. At 9bef91955a84fa01ccf731aa655b95fa26e624fe, IDs from query parameters are used to construct paths without validation in the asset deletion code and bundle download code.

In isolated temporary-directory tests against the Node server, ../../canary-pr145 deleted a .bin test file one level above dataDir. A download using ../../secret-pr145 returned the contents of a .zip test file at that same level. These paths still have fixed .bin and .zip suffixes, respectively. The tests did not cover a real Host session.

Please validate IDs against the server-generated UUID format and check that resolved paths remain inside the asset and bundle directories before deleting or reading files. Add regression tests for valid IDs and traversal inputs. These directory-traversal issues need to be fixed before merging.

评审指出 `DELETE /api/assets` 与 `GET /api/package/download` 直接把查询参数拼进文件路径,
`../../canary` 可以越出 dataDir 删除或读出上级的 `.bin` / `.zip` 文件。

- `store.mjs` 新增 `resolveInside()`:id 必须匹配服务端 `randomUUID()` 生成的 v4 UUID 格式,
  且解析后的路径必须仍落在素材目录 / 材料包目录内,两道检查都过才允许读写。
  `saveAsset` / `readAssetBytes` / `deleteAsset` / `savePackage` / `readPackageBytes` /
  `deletePackage` 六个入口全部改走它。
- `server.mjs` 把 `InvalidIdError` 映射成 400 `invalid_id`,非法 id 不再是 500。
- 新增 `tests/path-traversal.mjs`:在 dataDir 上一级放 canary 文件,覆盖 13 组穿越输入
  (正斜杠、反斜杠、`%2f` 编码、绝对路径、UUID 后缀拼接、NUL 等)× store 层与 HTTP 层,
  并验证合法 UUID 的删除与下载仍然可用。175 passed, 0 failed。
- 版本 1.1.0 → 1.1.1;README 的 Data & access 与自测清单同步更新。

包内自测:selftest 49、client-harness 46、server-harness 32、path-traversal 175,全绿。
上游 `npm run validate`:`plugins/zhuyankarl/submission-workbench: OK`、`repository: OK`。
上游 `npm test` 的 2 个 symlink 用例仍失败,原因是本机 Windows 账户无 symlink 权限(EPERM),
与本包无关,改动前后一致。
@zhuyankarl

Copy link
Copy Markdown
Author

Thanks — confirmed on our side, and fixed in 803ac0f (package version 1.1.0 → 1.1.1).

What was wrong

Every id in the store is produced by randomUUID() on the server, but the id from the query string was pasted straight into a path:

await rm(join(this.assetsDir, `${id}.bin`), { force: true });   // deleteAsset
return await readFile(join(this.packagesDir, `${id}.zip`));        // readPackageBytes

So ../../canary resolved outside the asset and package directories. We reproduced the same escape: with the validation removed, ../../canary deleted the .bin canary one level above dataDir, and ../../canary returned the contents of the .zip file at that level.

The fix

store.mjs gained one resolver that both id-taking paths go through:

function resolveInside(directory, id, suffix) {
  if (typeof id !== 'string' || !UUID_PATTERN.test(id)) {
    throw new InvalidIdError('id 不是服务端生成的 UUID。');
  }
  const base = resolve(directory);
  const target = resolve(base, `${id}${suffix}`);
  const inside = relative(base, target);
  if (inside === '' || inside.startsWith('..') || isAbsolute(inside)) {
    throw new InvalidIdError('id 指向了目录之外。');
  }
  return target;
}

Two independent checks, as asked: the id must match the canonical v4 UUID format randomUUID() produces, and the resolved path must still sit inside the directory it belongs to. The second one is the check that actually closes the hole, so it stays even if the id format ever changes.

All six entry points now use it — saveAsset, readAssetBytes, deleteAsset, savePackage, readPackageBytes, deletePackage — including the two that were not reachable from a route, so no path into the filesystem is left unvalidated.

server.mjs maps InvalidIdError to 400 invalid_id, so a refused id is a client error rather than a 500.

Regression tests

New file tests/path-traversal.mjs (in the package, outside miniapp/). A canary file sits one level above dataDir — exactly where the reported exploit reached — and must survive every attempt.

  • 13 id shapes that must never reach the filesystem: ../../canary, ..\..\canary, ....//....//canary, ../assets/../../canary, ..%2F..%2Fcanary, %2e%2e%2f%2e%2e%2fcanary, ../../canary/../canary, /etc/passwd, C:\Windows\System32\config\SAM, not-a-uuid, a valid UUID with /../../canary appended, a valid UUID with .bin appended, and a valid UUID with a NUL byte and ../../canary appended.
  • Each one is driven through the store layer and through the two routes over real HTTP: DELETE /api/assets and GET /api/package/download must answer 400, the canary must still be on disk, and the download body must never be the canary's bytes.
  • The valid path is covered too: an asset deleted by its real UUID answers 200 and the file is gone; a package downloaded by its real UUID answers 200 with the stored bytes; an unknown but well-formed UUID answers 404, not 400.
node tests/path-traversal.mjs → 175 passed, 0 failed

The test was falsified before shipping: with the two checks in resolveInside neutered but everything else left in place, the same file reports 155 failures, including the canary actually being deleted. With the checks in place it is 175/0.

Test results

npm run validate  → plugins/zhuyankarl/submission-workbench: OK, repository: OK
node tests/selftest.mjs        → 49 passed, 0 failed
node tests/client-harness.mjs   → 46 passed, 0 failed
node tests/server-harness.mjs   → 32 passed, 0 failed
node tests/path-traversal.mjs   → 175 passed, 0 failed

Unverified behaviour

  • The new tests run against the real Node service over HTTP in an isolated temporary directory, not inside a real Host session — the same limitation your tests had. The Host's loopback authentication and the dataDir the Host hands out are not exercised.
  • Only Windows 11 was tested; macOS and Linux are still untested.
  • npm test in this repository still has the same two failing tests (files: a symlink inside the package is an error and files: a package root that is itself a symlink is rejected before walking). They fail because fs.symlink returns EPERM on this Windows account without symlink privileges, and they fail identically before and after this change — verified on both revisions.

Version 1.1.1 is a patch bump on 1.1.0; the plugin ID, the declared access and the minimum client version are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants