@7365admin1/core 3.64.0 → 3.64.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.64.0",
4
+ "version": "3.64.1",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -112,6 +112,32 @@ test("/api/roles/v2 is gated too — the same hole with /v2 on the URL", () => {
112
112
  );
113
113
  });
114
114
 
115
+ test("/api/roles/v2 cannot mint a role holding the CONSOLE's own resources", () => {
116
+ /*
117
+ * `role.controller createRole` has carried `requireNoPlatformGrant` for a
118
+ * while; this mount did not. It is a separate controller behind a separate
119
+ * route and takes any string at all, so the hole was reachable by adding
120
+ * `/v2` to the URL - the same shape as the two gates above it.
121
+ *
122
+ * MEASURED BEFORE ADDING, on production, read-only: NO site-scoped role holds
123
+ * a platform-only string (6 site-scoped roles read; the 11 roles that do hold
124
+ * one are org-scoped and already covered by the v1 gate). This mount REQUIRES
125
+ * a `site`, so the check refuses nothing that exists today.
126
+ */
127
+ const body = fn(controllerV2, "createRole");
128
+ assert.match(body, /requireNoPlatformGrant\(/);
129
+
130
+ // It must run BEFORE the write, or it decides nothing.
131
+ const guard = body.indexOf("requireNoPlatformGrant(");
132
+ const write = body.indexOf("_createRole(");
133
+ assert.ok(guard !== -1 && write !== -1);
134
+ assert.ok(guard < write, "the role is created before the platform check");
135
+
136
+ // CONTROL: v1 still has it, so the assertion above is a real comparison and
137
+ // not a rule that only exists on one side.
138
+ assert.match(fn(controller, "createRole"), /requireNoPlatformGrant\(/);
139
+ });
140
+
115
141
  /**
116
142
  * The four true WRITES now go through `requireRoleWrite`, which is
117
143
  * `requireRoleOrg` plus one refusal: a role with no `org` and a non-admin type