mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
00364ee777
Merged via squash.
Prepared head SHA: e08d9e737d
Co-authored-by: jesse-merhi <79823012+jesse-merhi@users.noreply.github.com>
Co-authored-by: jesse-merhi <79823012+jesse-merhi@users.noreply.github.com>
Reviewed-by: @jesse-merhi
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { BundledPluginSource } from "./bundled-sources.js";
|
|
import { isOpenClawTrustedPluginInstallSpec } from "./install-provenance.js";
|
|
|
|
const bundledSources = new Map<string, BundledPluginSource>([
|
|
[
|
|
"discord",
|
|
{
|
|
pluginId: "discord",
|
|
localPath: "/opt/openclaw/extensions/discord",
|
|
npmSpec: "@openclaw/discord",
|
|
},
|
|
],
|
|
]);
|
|
|
|
describe("plugin install provenance", () => {
|
|
it.each([
|
|
"discord",
|
|
"@openclaw/discord",
|
|
"npm:@openclaw/discord",
|
|
"/opt/openclaw/extensions/discord",
|
|
"brave",
|
|
"npm:@openclaw/brave-plugin",
|
|
"clawhub:openclaw-demo",
|
|
])("trusts OpenClaw-owned install source %s", (spec) => {
|
|
expect(isOpenClawTrustedPluginInstallSpec(spec, bundledSources)).toBe(true);
|
|
});
|
|
|
|
it.each(["npm:discord", "npm:@example/plugin", "/tmp/example-plugin"])(
|
|
"keeps arbitrary install source %s untrusted",
|
|
(spec) => {
|
|
expect(isOpenClawTrustedPluginInstallSpec(spec, bundledSources)).toBe(false);
|
|
},
|
|
);
|
|
});
|