@checkstack/pluginmanager-common 0.2.18 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/access.test.ts +18 -0
- package/src/access.ts +4 -7
- package/src/rpc-contract.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @checkstack/pluginmanager-common
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b8a00da: Consolidate plugin install and uninstall into a single access rule. `pluginManagerAccess.install` and `pluginManagerAccess.uninstall` both produced the identical qualified id `pluginmanager.plugin.manage` (collapsing into one row with an ambiguous description in the role editor); they are replaced by a single `pluginManagerAccess.manage` ("Install and uninstall plugins").
|
|
8
|
+
|
|
9
|
+
BREAKING CHANGES: the `install` and `uninstall` keys were removed from `pluginManagerAccess` - use `pluginManagerAccess.manage`. The qualified rule id `pluginmanager.plugin.manage` is unchanged, so existing role grants keep working.
|
|
10
|
+
|
|
3
11
|
## 0.2.18
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import { pluginManagerAccess, pluginManagerAccessRules } from "./access";
|
|
4
|
+
import { pluginMetadata } from "./plugin-metadata";
|
|
5
|
+
|
|
6
|
+
describe("pluginManagerAccess", () => {
|
|
7
|
+
it("exposes exactly one manage rule covering install and uninstall", () => {
|
|
8
|
+
expect(pluginManagerAccess.manage.id).toBe("plugin.manage");
|
|
9
|
+
expect(pluginManagerAccessRules).toHaveLength(2);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("has unique qualified ids (no collapsed grants in the role editor)", () => {
|
|
13
|
+
const qualifiedIds = pluginManagerAccessRules.map(
|
|
14
|
+
(rule) => `${pluginMetadata.pluginId}.${rule.id}`,
|
|
15
|
+
);
|
|
16
|
+
expect(new Set(qualifiedIds).size).toBe(qualifiedIds.length);
|
|
17
|
+
});
|
|
18
|
+
});
|
package/src/access.ts
CHANGED
|
@@ -6,22 +6,19 @@ import { pluginMetadata } from "./plugin-metadata";
|
|
|
6
6
|
* Access rules for the Plugin Manager.
|
|
7
7
|
*
|
|
8
8
|
* The plugin system runs arbitrary code with full platform access — only
|
|
9
|
-
* trusted operators should hold the `manage` rule
|
|
9
|
+
* trusted operators should hold the `manage` rule, which covers both
|
|
10
|
+
* installing and uninstalling plugins.
|
|
10
11
|
*/
|
|
11
12
|
export const pluginManagerAccess = {
|
|
12
13
|
view: access("plugin", "read", "View installed plugins and install events", {
|
|
13
14
|
pluginId: pluginMetadata.pluginId,
|
|
14
15
|
}),
|
|
15
|
-
|
|
16
|
-
pluginId: pluginMetadata.pluginId,
|
|
17
|
-
}),
|
|
18
|
-
uninstall: access("plugin", "manage", "Uninstall plugins", {
|
|
16
|
+
manage: access("plugin", "manage", "Install and uninstall plugins", {
|
|
19
17
|
pluginId: pluginMetadata.pluginId,
|
|
20
18
|
}),
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
export const pluginManagerAccessRules = [
|
|
24
22
|
pluginManagerAccess.view,
|
|
25
|
-
pluginManagerAccess.
|
|
26
|
-
pluginManagerAccess.uninstall,
|
|
23
|
+
pluginManagerAccess.manage,
|
|
27
24
|
];
|
package/src/rpc-contract.ts
CHANGED
|
@@ -43,7 +43,7 @@ export const pluginManagerContract = {
|
|
|
43
43
|
previewInstall: proc({
|
|
44
44
|
operationType: "mutation",
|
|
45
45
|
userType: "user",
|
|
46
|
-
access: [pluginManagerAccess.
|
|
46
|
+
access: [pluginManagerAccess.manage],
|
|
47
47
|
})
|
|
48
48
|
.input(z.object({ source: pluginSourceSchema }))
|
|
49
49
|
.output(installPreviewSchema),
|
|
@@ -56,7 +56,7 @@ export const pluginManagerContract = {
|
|
|
56
56
|
install: proc({
|
|
57
57
|
operationType: "mutation",
|
|
58
58
|
userType: "user",
|
|
59
|
-
access: [pluginManagerAccess.
|
|
59
|
+
access: [pluginManagerAccess.manage],
|
|
60
60
|
})
|
|
61
61
|
.input(
|
|
62
62
|
z.object({
|
|
@@ -79,7 +79,7 @@ export const pluginManagerContract = {
|
|
|
79
79
|
previewUninstall: proc({
|
|
80
80
|
operationType: "query",
|
|
81
81
|
userType: "user",
|
|
82
|
-
access: [pluginManagerAccess.
|
|
82
|
+
access: [pluginManagerAccess.manage],
|
|
83
83
|
})
|
|
84
84
|
.input(z.object({ pluginName: z.string().min(1) }))
|
|
85
85
|
.output(uninstallPreviewSchema),
|
|
@@ -91,7 +91,7 @@ export const pluginManagerContract = {
|
|
|
91
91
|
uninstall: proc({
|
|
92
92
|
operationType: "mutation",
|
|
93
93
|
userType: "user",
|
|
94
|
-
access: [pluginManagerAccess.
|
|
94
|
+
access: [pluginManagerAccess.manage],
|
|
95
95
|
})
|
|
96
96
|
.input(
|
|
97
97
|
z.object({
|