fix(plugins): enforce minimum host versions for installable plugins (#52094)

* fix(plugins): enforce min host versions

* fix(plugins): tighten min host version validation

* chore(plugins): trim dead min host version code

* fix(plugins): handle malformed min host metadata

* fix(plugins): key manifest cache by host version
This commit is contained in:
Vincent Koc
2026-03-22 09:12:08 -07:00
committed by GitHub
parent 6b7206ed35
commit 3ce5a8366a
29 changed files with 653 additions and 21 deletions

View File

@@ -53,6 +53,53 @@ describe("collectBundledExtensionManifestErrors", () => {
"bundled extension 'broken' manifest invalid | openclaw.install.npmSpec must be a non-empty string",
]);
});
it("flags invalid bundled extension minHostVersion metadata", () => {
expect(
collectBundledExtensionManifestErrors([
{
id: "broken",
packageJson: {
openclaw: {
install: { npmSpec: "@openclaw/broken", minHostVersion: "2026.3.14" },
},
},
},
]),
).toEqual([
"bundled extension 'broken' manifest invalid | openclaw.install.minHostVersion must use a semver floor in the form \">=x.y.z\"",
]);
});
it("allows install metadata without npmSpec when only non-publish metadata is present", () => {
expect(
collectBundledExtensionManifestErrors([
{
id: "irc",
packageJson: {
openclaw: {
install: { minHostVersion: ">=2026.3.14" },
},
},
},
]),
).toEqual([]);
});
it("flags non-object install metadata instead of throwing", () => {
expect(
collectBundledExtensionManifestErrors([
{
id: "broken",
packageJson: {
openclaw: {
install: 123,
},
},
},
]),
).toEqual(["bundled extension 'broken' manifest invalid | openclaw.install must be an object"]);
});
});
describe("collectForbiddenPackPaths", () => {