@reventlessdev/reventless-spec 3.0.0-alpha.165 → 3.0.0-alpha.166
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 +13 -0
- package/package.json +1 -1
- package/src/types/OwnerScope.res +24 -0
- package/src/types/OwnerScope.res.mjs +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.166 (2026-10-16)
|
|
7
|
+
|
|
8
|
+
* fix(auth)!: only operators read the framework's own stores ([a2fd202](https://github.com/ReventlessDev/reventless-core/commit/a2fd2022b6876dae855b185df7f8263353fc971d))
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* a caller outside the elevated groups is refused the
|
|
13
|
+
framework's to-do, schedule and audit stores. On AWS, a roles-gated
|
|
14
|
+
view's …ByIds, …Refs, …Items and …By<Index> fields refuse callers
|
|
15
|
+
outside its roles.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
# 3.0.0-alpha.165 (2026-10-16)
|
|
7
20
|
|
|
8
21
|
* feat!(automation): schedules set by events ([53bc436](https://github.com/ReventlessDev/reventless-core/commit/53bc4363dffce81ef36475728bf0dae704716021))
|
package/package.json
CHANGED
package/src/types/OwnerScope.res
CHANGED
|
@@ -180,6 +180,30 @@ let elevatedGroups = (): array<string> =>
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/** The role that stands for an elevated group: the one mapped to it, else the
|
|
184
|
+
role of the same name. Refused when that role was mapped elsewhere, since no
|
|
185
|
+
role then names the group and a rule would silently admit someone else. */
|
|
186
|
+
let roleForGroup = (group: string): Role.name =>
|
|
187
|
+
switch Role.renamed()->Array.find(((_, g)) => g == group) {
|
|
188
|
+
| Some((role, _)) => role
|
|
189
|
+
| None if Role.groupOf(Role.make(group)) == group => Role.make(group)
|
|
190
|
+
| None =>
|
|
191
|
+
JsError.throwWithMessage(
|
|
192
|
+
`Elevated group "${group}" has no role standing for it: role "${group}" stands for ` ++
|
|
193
|
+
`group "${Role.groupOf(Role.make(group))}". Map a role to "${group}" with roleGroups.`,
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
The deployment's operators as a rule: the roles standing for the elevated
|
|
199
|
+
groups. For what the framework keeps for itself, such as an automation's to-do
|
|
200
|
+
list. An empty list admits nobody. Read when called, after the root has stated
|
|
201
|
+
its operators and its role mapping.
|
|
202
|
+
*/
|
|
203
|
+
let operators = (): Authorization.permission => AllowRoles(
|
|
204
|
+
elevatedGroups()->Array.map(roleForGroup),
|
|
205
|
+
)
|
|
206
|
+
|
|
183
207
|
// Order matters: the provider is examined before `userId`, because the IAM
|
|
184
208
|
// caller fails the `userId` test for a reason that has nothing to do with being
|
|
185
209
|
// anonymous and must not be refused as though it did.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
4
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
6
7
|
import * as Role$Reventless from "./Role.res.mjs";
|
|
7
8
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
8
9
|
import * as Identity$Reventless from "./Identity.res.mjs";
|
|
@@ -80,6 +81,24 @@ function elevatedGroups() {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
function roleForGroup(group) {
|
|
85
|
+
let match = Role$Reventless.renamed().find(param => param[1] === group);
|
|
86
|
+
if (match !== undefined) {
|
|
87
|
+
return match[0];
|
|
88
|
+
} else if (Role$Reventless.groupOf(group) === group) {
|
|
89
|
+
return group;
|
|
90
|
+
} else {
|
|
91
|
+
return Stdlib_JsError.throwWithMessage(`Elevated group "` + group + `" has no role standing for it: role "` + group + `" stands for ` + (`group "` + Role$Reventless.groupOf(group) + `". Map a role to "` + group + `" with roleGroups.`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function operators() {
|
|
96
|
+
return {
|
|
97
|
+
TAG: "AllowRoles",
|
|
98
|
+
_0: elevatedGroups().map(roleForGroup)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
83
102
|
function classify(identity, elevated) {
|
|
84
103
|
let provider = identity.provider;
|
|
85
104
|
let providerName = isJsString(provider) ? provider : undefined;
|
|
@@ -344,6 +363,8 @@ export {
|
|
|
344
363
|
defaultElevatedRoles,
|
|
345
364
|
parseElevatedGroups,
|
|
346
365
|
elevatedGroups,
|
|
366
|
+
roleForGroup,
|
|
367
|
+
operators,
|
|
347
368
|
classify,
|
|
348
369
|
resolve,
|
|
349
370
|
ownerId,
|