@bevel-software/platform-core-backend 0.9.1 → 0.11.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/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +16 -1
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +25 -0
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +45 -1
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core-config.d.ts +19 -1
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +44 -4
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +54 -28
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +129 -14
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +435 -66
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access-declarations.d.ts.map +1 -1
- package/dist/modules/access/access-declarations.js +5 -3
- package/dist/modules/access/access-declarations.js.map +1 -1
- package/dist/modules/access/access-mutation.service.d.ts +39 -6
- package/dist/modules/access/access-mutation.service.d.ts.map +1 -1
- package/dist/modules/access/access-mutation.service.js +78 -18
- package/dist/modules/access/access-mutation.service.js.map +1 -1
- package/dist/modules/access/access-splice.d.ts +31 -4
- package/dist/modules/access/access-splice.d.ts.map +1 -1
- package/dist/modules/access/access-splice.js +40 -16
- package/dist/modules/access/access-splice.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +204 -82
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/admin-locked-commit.d.ts +134 -0
- package/dist/modules/access/admin-locked-commit.d.ts.map +1 -0
- package/dist/modules/access/admin-locked-commit.js +277 -0
- package/dist/modules/access/admin-locked-commit.js.map +1 -0
- package/dist/modules/access/admin-route-helpers.d.ts +32 -0
- package/dist/modules/access/admin-route-helpers.d.ts.map +1 -0
- package/dist/modules/access/admin-route-helpers.js +44 -0
- package/dist/modules/access/admin-route-helpers.js.map +1 -0
- package/dist/modules/access/capability-registry.d.ts +41 -0
- package/dist/modules/access/capability-registry.d.ts.map +1 -0
- package/dist/modules/access/capability-registry.js +46 -0
- package/dist/modules/access/capability-registry.js.map +1 -0
- package/dist/modules/access/directory-sync-bot.d.ts +13 -0
- package/dist/modules/access/directory-sync-bot.d.ts.map +1 -0
- package/dist/modules/access/directory-sync-bot.js +64 -0
- package/dist/modules/access/directory-sync-bot.js.map +1 -0
- package/dist/modules/access/group-files.d.ts +83 -0
- package/dist/modules/access/group-files.d.ts.map +1 -0
- package/dist/modules/access/group-files.js +167 -0
- package/dist/modules/access/group-files.js.map +1 -0
- package/dist/modules/access/groups-admin.routes.d.ts +19 -0
- package/dist/modules/access/groups-admin.routes.d.ts.map +1 -0
- package/dist/modules/access/groups-admin.routes.js +98 -0
- package/dist/modules/access/groups-admin.routes.js.map +1 -0
- package/dist/modules/access/groups-admin.service.d.ts +166 -0
- package/dist/modules/access/groups-admin.service.d.ts.map +1 -0
- package/dist/modules/access/groups-admin.service.js +442 -0
- package/dist/modules/access/groups-admin.service.js.map +1 -0
- package/dist/modules/access/groups-edit.d.ts +58 -0
- package/dist/modules/access/groups-edit.d.ts.map +1 -0
- package/dist/modules/access/groups-edit.js +162 -0
- package/dist/modules/access/groups-edit.js.map +1 -0
- package/dist/modules/access/reference-scan.d.ts +141 -0
- package/dist/modules/access/reference-scan.d.ts.map +1 -0
- package/dist/modules/access/reference-scan.js +440 -0
- package/dist/modules/access/reference-scan.js.map +1 -0
- package/dist/modules/access/roles-admin.service.d.ts +88 -119
- package/dist/modules/access/roles-admin.service.d.ts.map +1 -1
- package/dist/modules/access/roles-admin.service.js +230 -384
- package/dist/modules/access/roles-admin.service.js.map +1 -1
- package/dist/modules/access/roles-edit.d.ts +51 -25
- package/dist/modules/access/roles-edit.d.ts.map +1 -1
- package/dist/modules/access/roles-edit.js +133 -59
- package/dist/modules/access/roles-edit.js.map +1 -1
- package/dist/modules/access/synced-groups-committer.d.ts +28 -0
- package/dist/modules/access/synced-groups-committer.d.ts.map +1 -0
- package/dist/modules/access/synced-groups-committer.js +139 -0
- package/dist/modules/access/synced-groups-committer.js.map +1 -0
- package/dist/modules/access/synced-groups-writer.d.ts +78 -0
- package/dist/modules/access/synced-groups-writer.d.ts.map +1 -0
- package/dist/modules/access/synced-groups-writer.js +219 -0
- package/dist/modules/access/synced-groups-writer.js.map +1 -0
- package/dist/modules/database/core-schema.d.ts +17 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +9 -0
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts +13 -2
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +61 -2
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.routes.d.ts +9 -3
- package/dist/modules/mcp/mcp.routes.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.routes.js +126 -2
- package/dist/modules/mcp/mcp.routes.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +14 -0
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +6 -1
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/update-check/update-check.routes.d.ts +13 -0
- package/dist/modules/update-check/update-check.routes.d.ts.map +1 -0
- package/dist/modules/update-check/update-check.routes.js +21 -0
- package/dist/modules/update-check/update-check.routes.js.map +1 -0
- package/dist/modules/update-check/update-check.service.d.ts +57 -0
- package/dist/modules/update-check/update-check.service.d.ts.map +1 -0
- package/dist/modules/update-check/update-check.service.js +109 -0
- package/dist/modules/update-check/update-check.service.js.map +1 -0
- package/dist/modules/workflow/file-lock.service.d.ts +11 -1
- package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
- package/dist/modules/workflow/file-lock.service.js +15 -1
- package/dist/modules/workflow/file-lock.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +34 -11
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +173 -37
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/locking-filesystem.d.ts +4 -0
- package/dist/modules/workflow/locking-filesystem.d.ts.map +1 -1
- package/dist/modules/workflow/locking-filesystem.js +181 -28
- package/dist/modules/workflow/locking-filesystem.js.map +1 -1
- package/dist/modules/workflow/pending-commits.service.d.ts +10 -0
- package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.service.js +19 -1
- package/dist/modules/workflow/pending-commits.service.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +17 -2
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +113 -19
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +25 -0
- package/dist/version.js.map +1 -1
- package/kb-template/AGENTS.md +4 -1
- package/migrations/0004_file_lock_mode.sql +2 -0
- package/migrations/meta/0004_snapshot.json +1564 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/src/__tests__/core-config.domain.test.ts +92 -0
- package/src/core/create-core-server.ts +21 -0
- package/src/core/create-core-services.ts +82 -0
- package/src/core-config.ts +48 -4
- package/src/index.ts +10 -0
- package/src/modules/access/__tests__/access-control.service.test.ts +9 -3
- package/src/modules/access/__tests__/access-groups.test.ts +427 -0
- package/src/modules/access/__tests__/access-mutation.service.test.ts +171 -5
- package/src/modules/access/__tests__/access-splice.test.ts +65 -0
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +337 -0
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +48 -0
- package/src/modules/access/__tests__/admin-locked-commit.test.ts +221 -0
- package/src/modules/access/__tests__/admin-route-helpers.test.ts +61 -0
- package/src/modules/access/__tests__/directory-sync-bot.test.ts +106 -0
- package/src/modules/access/__tests__/grant-sources.test.ts +67 -0
- package/src/modules/access/__tests__/groups-admin.service.test.ts +440 -0
- package/src/modules/access/__tests__/reference-scan.test.ts +288 -0
- package/src/modules/access/__tests__/roles-admin.service.test.ts +161 -83
- package/src/modules/access/__tests__/roles-capabilities.test.ts +325 -0
- package/src/modules/access/__tests__/roles-edit.test.ts +104 -28
- package/src/modules/access/__tests__/roles.routes.test.ts +63 -40
- package/src/modules/access/__tests__/synced-groups-committer.test.ts +238 -0
- package/src/modules/access/__tests__/synced-groups-writer.test.ts +249 -0
- package/src/modules/access/access-control.interface.ts +66 -32
- package/src/modules/access/access-control.service.ts +536 -73
- package/src/modules/access/access-declarations.ts +5 -2
- package/src/modules/access/access-mutation.service.ts +88 -14
- package/src/modules/access/access-splice.ts +55 -17
- package/src/modules/access/access.routes.ts +227 -93
- package/src/modules/access/admin-locked-commit.ts +331 -0
- package/src/modules/access/admin-route-helpers.ts +55 -0
- package/src/modules/access/capability-registry.ts +74 -0
- package/src/modules/access/directory-sync-bot.ts +76 -0
- package/src/modules/access/group-files.ts +212 -0
- package/src/modules/access/groups-admin.routes.ts +113 -0
- package/src/modules/access/groups-admin.service.ts +551 -0
- package/src/modules/access/groups-edit.ts +187 -0
- package/src/modules/access/reference-scan.ts +513 -0
- package/src/modules/access/roles-admin.service.ts +290 -418
- package/src/modules/access/roles-edit.ts +134 -61
- package/src/modules/access/synced-groups-committer.ts +177 -0
- package/src/modules/access/synced-groups-writer.ts +303 -0
- package/src/modules/database/core-schema.ts +9 -0
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +116 -0
- package/src/modules/mcp/__tests__/mcp.e2e.test.ts +3 -1
- package/src/modules/mcp/__tests__/mcp.routes.delete.test.ts +6 -1
- package/src/modules/mcp/__tests__/mcp.routes.local-token.test.ts +301 -0
- package/src/modules/mcp/mcp-auth.middleware.ts +61 -1
- package/src/modules/mcp/mcp.routes.ts +137 -2
- package/src/modules/mcp/mcp.service.ts +6 -1
- package/src/modules/update-check/__tests__/update-check.routes.test.ts +69 -0
- package/src/modules/update-check/__tests__/update-check.service.test.ts +170 -0
- package/src/modules/update-check/update-check.routes.ts +28 -0
- package/src/modules/update-check/update-check.service.ts +130 -0
- package/src/modules/workflow/__tests__/locking-filesystem.test.ts +336 -0
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +1 -1
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +32 -0
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +13 -2
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +139 -1
- package/src/modules/workflow/file-lock.service.ts +15 -0
- package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +0 -1
- package/src/modules/workflow/git/__tests__/git.service.commitChanges.test.ts +132 -0
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +0 -1
- package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +0 -1
- package/src/modules/workflow/git/git.service.ts +182 -35
- package/src/modules/workflow/locking-filesystem.ts +188 -26
- package/src/modules/workflow/pending-commits.service.ts +27 -1
- package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +0 -1
- package/src/modules/workflow/review-workflow/__tests__/cancel-pr.test.ts +0 -1
- package/src/modules/workflow/workflow.service.ts +140 -20
- package/src/version.ts +28 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Access-control service interface. The implementation reads `roles.yaml
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Access-control service interface. The implementation reads `roles.yaml`,
|
|
3
|
+
* the active group file (`synced-groups.yaml` / `groups.yaml`), and the
|
|
4
|
+
* `access.md` tree from the workspace's `knowledge-base` clone and resolves
|
|
5
|
+
* the access verbs (read / write / download / owner) against them.
|
|
5
6
|
*
|
|
6
7
|
* All `relativePath` arguments are repo-relative POSIX paths inside the KB
|
|
7
8
|
* repo (e.g. `Knowledge/Sales/Foo.md`, `roles.yaml`) — NOT workspace-relative
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
*
|
|
21
22
|
* Only a principal NAMED in a file (a direct user grant `Name <email>`, or a
|
|
22
23
|
* group/role token) produces sources. A USER who merely RESOLVES to access via a
|
|
23
|
-
*
|
|
24
|
-
* per-target file entry and produces NO source (the
|
|
24
|
+
* group or role they belong to, the built-in `everyone`, or admin-rescue is NOT a
|
|
25
|
+
* per-target file entry and produces NO source (the group/role itself shows as its own
|
|
25
26
|
* row instead).
|
|
26
27
|
*/
|
|
27
28
|
export type GrantSource = {
|
|
@@ -53,6 +54,26 @@ export type GrantPrincipal = {
|
|
|
53
54
|
kind: 'role';
|
|
54
55
|
role: string;
|
|
55
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* One collective principal in a resolved eligible list, with WHAT it is: a
|
|
59
|
+
* ROLE (an app-defined capability) or a GROUP (a grant audience from the
|
|
60
|
+
* active group source). The resolver knows the kind from the merged principal
|
|
61
|
+
* index — a `role/<canonical>` alias hit is always the role; a bare token is
|
|
62
|
+
* whatever owns it under group-first precedence — and the share dialog needs
|
|
63
|
+
* it to badge each grantee row honestly ("Role" vs "Group") and to round-trip
|
|
64
|
+
* the row's principal with the right kind.
|
|
65
|
+
*
|
|
66
|
+
* Additive: `principals` rides NEXT TO the legacy `roles: string[]` (the same
|
|
67
|
+
* names, kind erased), which many name-only consumers (banners, owner
|
|
68
|
+
* contact lines, PR-routing messages) still read. It is optional in the
|
|
69
|
+
* interface so existing test doubles stay valid; the real service always
|
|
70
|
+
* returns it, and payload consumers fall back to `roles` (all treated as
|
|
71
|
+
* roles) when absent.
|
|
72
|
+
*/
|
|
73
|
+
export type ResolvedPrincipal = {
|
|
74
|
+
name: string;
|
|
75
|
+
kind: 'role' | 'group';
|
|
76
|
+
};
|
|
56
77
|
/**
|
|
57
78
|
* Per-verb sources of a principal's access on a target. Only verbs the principal
|
|
58
79
|
* actually holds (via a named file entry) appear; each maps to the closest-first
|
|
@@ -128,6 +149,7 @@ export interface IAccessControl {
|
|
|
128
149
|
* file viewer to render the "owners / contact" affordance.
|
|
129
150
|
*/
|
|
130
151
|
eligibleOwners(workspaceId: string, relativePath: string): Promise<{
|
|
152
|
+
principals?: ResolvedPrincipal[];
|
|
131
153
|
roles: string[];
|
|
132
154
|
users: {
|
|
133
155
|
name: string;
|
|
@@ -142,6 +164,7 @@ export interface IAccessControl {
|
|
|
142
164
|
* writers can.
|
|
143
165
|
*/
|
|
144
166
|
eligibleWriters(workspaceId: string, relativePath: string): Promise<{
|
|
167
|
+
principals?: ResolvedPrincipal[];
|
|
145
168
|
roles: string[];
|
|
146
169
|
users: {
|
|
147
170
|
name: string;
|
|
@@ -159,6 +182,7 @@ export interface IAccessControl {
|
|
|
159
182
|
*/
|
|
160
183
|
eligibleReaders(workspaceId: string, relativePath: string): Promise<{
|
|
161
184
|
restricted: boolean;
|
|
185
|
+
principals?: ResolvedPrincipal[];
|
|
162
186
|
roles: string[];
|
|
163
187
|
users: {
|
|
164
188
|
name: string;
|
|
@@ -174,6 +198,7 @@ export interface IAccessControl {
|
|
|
174
198
|
* checkbox.
|
|
175
199
|
*/
|
|
176
200
|
eligibleDownloaders(workspaceId: string, relativePath: string): Promise<{
|
|
201
|
+
principals?: ResolvedPrincipal[];
|
|
177
202
|
roles: string[];
|
|
178
203
|
users: {
|
|
179
204
|
name: string;
|
|
@@ -219,8 +244,19 @@ export interface IAccessControl {
|
|
|
219
244
|
*
|
|
220
245
|
* Returns only the verbs the principal effectively holds; a verb with no
|
|
221
246
|
* access is omitted. A principal with no access anywhere yields an empty map.
|
|
247
|
+
*
|
|
248
|
+
* `opts.tokenMatch: 'exact'` pins a ROLE-shaped principal to its literal
|
|
249
|
+
* token spelling: only the exact token (bare, or `role/<name>`) counts as
|
|
250
|
+
* the principal's own entry, regardless of group shadowing. The mutation
|
|
251
|
+
* layer uses this so a check runs against the SAME identity a pinned
|
|
252
|
+
* exact-token splice edited — e.g. verifying a GROUP deny whose group has
|
|
253
|
+
* vanished, where the default (alias-tolerant when unshadowed) matching
|
|
254
|
+
* would misattribute a same-named role's surviving `role/<name>` grant to
|
|
255
|
+
* the group. Omitted (or `'name'`) → the shadowing-derived default.
|
|
222
256
|
*/
|
|
223
|
-
grantSources(workspaceId: string, kind: AccessTargetKind, relativePath: string, principal: GrantPrincipal
|
|
257
|
+
grantSources(workspaceId: string, kind: AccessTargetKind, relativePath: string, principal: GrantPrincipal, opts?: {
|
|
258
|
+
tokenMatch?: 'exact' | 'name';
|
|
259
|
+
}): Promise<GrantSources>;
|
|
224
260
|
/**
|
|
225
261
|
* Drop a workspace's cached model. Call after operations that mutate
|
|
226
262
|
* `roles.yaml` / `access.md` (commit, push, pull) or change which copy of
|
|
@@ -243,32 +279,22 @@ export interface IAccessControl {
|
|
|
243
279
|
ok: false;
|
|
244
280
|
errors: string[];
|
|
245
281
|
};
|
|
246
|
-
/**
|
|
247
|
-
* Find every folder-`access.md` reference to a role, by canonical name, in the
|
|
248
|
-
* cached model. ADVISORY ONLY — it powers the delete-confirmation "N rules
|
|
249
|
-
* will be ignored" warning, and it may UNDERCOUNT: `collectAccessFiles` only
|
|
250
|
-
* walks files literally named `access.md`, so a role granted in a node's OWN
|
|
251
|
-
* frontmatter is a real grant this scan misses. That is acceptable for a
|
|
252
|
-
* non-fatal warning. It must NOT be used to gate the rename rewrite — that
|
|
253
|
-
* needs the sound git-grep scan in `roles-admin.service.ts`, which also covers
|
|
254
|
-
* node frontmatter. An undercount there would silently orphan access.
|
|
255
|
-
*/
|
|
256
|
-
referencesToRole(workspaceId: string, canonicalRole: string): Promise<{
|
|
257
|
-
path: string;
|
|
258
|
-
verb: string;
|
|
259
|
-
}[]>;
|
|
260
282
|
/**
|
|
261
283
|
* Enumerate the grantable principals known to the KB, for the share-dialog
|
|
262
|
-
* autocomplete. `
|
|
263
|
-
* `roles.yaml` role display names
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
284
|
+
* autocomplete. `roles` are the built-in `everyone` role plus the declared
|
|
285
|
+
* `roles.yaml` role display names — ROLE principals only, never groups
|
|
286
|
+
* (`everyone` is surfaced so the UI can grant public read; the grant route
|
|
287
|
+
* gates it to the `read` verb only). `groups` are the ACTIVE group source's
|
|
288
|
+
* display names as merged into the resolver's cached model — served from
|
|
289
|
+
* that cache precisely so suggest/grant don't re-read the files per call.
|
|
290
|
+
* `people` are every email named in `roles.yaml` (name defaults to the
|
|
291
|
+
* local part) unioned with every `Name <email>` grant in any `access.md`
|
|
292
|
+
* (named). The login-only `users` table is unioned in by the caller — this
|
|
293
|
+
* method covers the KB-canonical people the users table misses.
|
|
269
294
|
*/
|
|
270
295
|
kbPrincipals(workspaceId: string): Promise<{
|
|
271
|
-
|
|
296
|
+
roles: string[];
|
|
297
|
+
groups: string[];
|
|
272
298
|
people: {
|
|
273
299
|
name: string;
|
|
274
300
|
email: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-control.interface.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.interface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"access-control.interface.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC;;;;;;;;;;;GAWG;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,EAAE,MAAM,GACnB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAEjF;;;;;;;OAOG;IACH,4BAA4B,CAC1B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,GAAG,CACZ,MAAM,EACN;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACzC,4EAA4E;QAC5E,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB;;;;;WAKG;QACH,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KAC9B,CACF,GAAG,IAAI,CAAC,CAAC;CACX"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
2
|
-
import type { IAccessControl, AccessTargetKind, GrantPrincipal, GrantSources } from './access-control.interface.js';
|
|
2
|
+
import type { IAccessControl, AccessTargetKind, GrantPrincipal, GrantSources, ResolvedPrincipal } from './access-control.interface.js';
|
|
3
|
+
import { type GroupsIndex } from './group-files.js';
|
|
3
4
|
export declare const ADMIN_CANONICAL = "admin";
|
|
4
5
|
/**
|
|
5
6
|
* Verbs the resolver understands in an `access.md` frontmatter. Each verb
|
|
@@ -38,6 +39,24 @@ export declare const EVERYONE_DISPLAY = "Everyone";
|
|
|
38
39
|
export declare function sourceVerbsFor(verb: Verb): Verb[];
|
|
39
40
|
export declare const RESERVED_ROLE_NAMES: Set<string>;
|
|
40
41
|
export declare const DENY_PREFIX = "deny ";
|
|
42
|
+
/**
|
|
43
|
+
* Member-entry prefix in roles.yaml that references a GROUP instead of an
|
|
44
|
+
* email: `- group:Engineering`. Explicit on purpose — membership kind is
|
|
45
|
+
* never guessed from string shape. Valid on EVERY role including Admin, with
|
|
46
|
+
* one kept invariant (see `parseRolesYaml`): Admin must always retain at
|
|
47
|
+
* least one direct email member, so a misconfigured or unreachable directory
|
|
48
|
+
* can never leave the deployment without a rescuable admin.
|
|
49
|
+
*/
|
|
50
|
+
export declare const GROUP_REF_PREFIX = "group:";
|
|
51
|
+
/**
|
|
52
|
+
* Explicit ROLE token prefix in access.md entries: `role/<Name>` resolves to
|
|
53
|
+
* the roles.yaml role only, never a group. A BARE name resolves GROUP-FIRST
|
|
54
|
+
* and falls back to the role — so `role/` is the escape hatch when a group
|
|
55
|
+
* shares the role's name. The prefix is reserved in the group name-safety
|
|
56
|
+
* rules (a group may never be named `role/...`), and every role is also
|
|
57
|
+
* registered in the principal index under its `role/<canonical>` alias.
|
|
58
|
+
*/
|
|
59
|
+
export declare const ROLE_TOKEN_PREFIX = "role/";
|
|
41
60
|
export declare const USER_REF_REGEX: RegExp;
|
|
42
61
|
export declare const EMAIL_REGEX: RegExp;
|
|
43
62
|
export interface RoleEntry {
|
|
@@ -66,10 +85,34 @@ export interface AccessFile {
|
|
|
66
85
|
entries: Record<Verb, ParsedEntry[]>;
|
|
67
86
|
}
|
|
68
87
|
export declare function isAccessMdPath(p: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Extensions of node files whose OWN `---` frontmatter can carry access verbs
|
|
90
|
+
* the resolver enforces (`readOwnEntries` → `parseOwnAccessEntries`). The
|
|
91
|
+
* SINGLE source of truth for every surface that enumerates candidate files —
|
|
92
|
+
* the access-declarations scan and the shared `KbReferenceScanner` (which
|
|
93
|
+
* must scan/rewrite the same set, or a rename strands a live `.tool`
|
|
94
|
+
* frontmatter grant). `access.md` is covered by `.md`.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ACCESS_FRONTMATTER_EXTENSIONS: readonly [".md", ".tool"];
|
|
97
|
+
/** True when `p` is a file the resolver reads access frontmatter from. */
|
|
98
|
+
export declare function hasAccessFrontmatterExtension(p: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The PRINCIPAL index — canonical name → member emails. Despite the name it
|
|
101
|
+
* holds both kinds of named principal after `mergeGroupsIntoRoles` runs:
|
|
102
|
+
* roles.yaml roles (`kind: 'role'`, the default) and the active group file's
|
|
103
|
+
* groups (`kind: 'group'`). Grant resolution treats them identically — a
|
|
104
|
+
* grant names a principal, the principal has member emails — which is what
|
|
105
|
+
* lets the whole closeness-first resolver work on groups without changes.
|
|
106
|
+
*
|
|
107
|
+
* `groupRefs` carries a role's `group:<Name>` member entries between parse
|
|
108
|
+
* and merge; the merge expands them into `emails`/`byEmail`.
|
|
109
|
+
*/
|
|
69
110
|
interface RolesIndex {
|
|
70
111
|
byCanonical: Map<string, {
|
|
71
112
|
displayName: string;
|
|
72
113
|
emails: Set<string>;
|
|
114
|
+
groupRefs?: Set<string>;
|
|
115
|
+
kind?: 'role' | 'group';
|
|
73
116
|
}>;
|
|
74
117
|
byEmail: Map<string, Set<string>>;
|
|
75
118
|
}
|
|
@@ -84,7 +127,17 @@ interface YamlErr {
|
|
|
84
127
|
ok: false;
|
|
85
128
|
error: string;
|
|
86
129
|
}
|
|
87
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Strip a trailing `# comment` the way the YAML-subset tokeniser reads a
|
|
132
|
+
* line: a `#` at the start (after only whitespace) or preceded by whitespace
|
|
133
|
+
* begins a comment. Exported so the reference scanner matches tokens against
|
|
134
|
+
* the SAME comment rule the resolver parses with (a `- GTM Team # sales`
|
|
135
|
+
* entry is the token `GTM Team`, never `GTM Team # sales`).
|
|
136
|
+
*/
|
|
137
|
+
export declare function stripComment(line: string): string;
|
|
138
|
+
export declare function parseYamlSubset(text: string, opts?: {
|
|
139
|
+
tolerateEmptyKeys?: boolean;
|
|
140
|
+
}): YamlOk | YamlErr;
|
|
88
141
|
export declare function extractFrontmatter(text: string): {
|
|
89
142
|
ok: true;
|
|
90
143
|
frontmatter: string;
|
|
@@ -110,6 +163,61 @@ export declare function parseRolesYaml(text: string): {
|
|
|
110
163
|
ok: false;
|
|
111
164
|
errors: string[];
|
|
112
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* Merge the active group source into the principal index and expand role →
|
|
168
|
+
* group assignments. Mutates `index` in place; returns human-readable
|
|
169
|
+
* warnings (callers log them — nothing here ever throws, because group
|
|
170
|
+
* problems must degrade, not brick access resolution).
|
|
171
|
+
*
|
|
172
|
+
* Rules (the grant-grammar precedence):
|
|
173
|
+
* - Every role is ALSO registered under its explicit `role/<canonical>`
|
|
174
|
+
* alias — the token that always resolves to the role.
|
|
175
|
+
* - A BARE name resolves GROUP-FIRST: when a group's canonical name
|
|
176
|
+
* collides with a role's, the bare key resolves to the GROUP (warned);
|
|
177
|
+
* the role stays reachable via `role/<canonical>`.
|
|
178
|
+
* - Role `group:<Name>` refs — Admin's included — expand against the
|
|
179
|
+
* merged groups; an unknown ref contributes nothing (warned).
|
|
180
|
+
* - `byEmail` is rebuilt so each member holds exactly the tokens that
|
|
181
|
+
* resolve to a principal they belong to (bare + `role/` alias for roles,
|
|
182
|
+
* bare for groups).
|
|
183
|
+
*/
|
|
184
|
+
export declare function mergeGroupsIntoRoles(index: RolesIndex, groups: GroupsIndex, sourceFile: string): string[];
|
|
185
|
+
/**
|
|
186
|
+
* Health of the ACTIVE groups source as of the last load. `ok: false` means
|
|
187
|
+
* the source EXISTS but could not be read or parsed — groups contribute
|
|
188
|
+
* nothing, bare grant tokens fall through to roles, and group-backed denies
|
|
189
|
+
* drop (the owner's explicit degrade-loudly decision, NOT fail-closed). The
|
|
190
|
+
* marker is carried on the loaded model and surfaced by the groups admin
|
|
191
|
+
* endpoints so the Groups page can banner it.
|
|
192
|
+
*/
|
|
193
|
+
export type GroupsHealth = {
|
|
194
|
+
ok: true;
|
|
195
|
+
} | {
|
|
196
|
+
ok: false;
|
|
197
|
+
file: string;
|
|
198
|
+
reason: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Load the ACTIVE group source through `read` (working tree or at-ref — the
|
|
202
|
+
* caller supplies the reader, so both model loaders share one mode rule):
|
|
203
|
+
* `synced-groups.yaml` existing → IdP mode (groups.yaml ignored entirely,
|
|
204
|
+
* even when the synced file is empty or malformed — falling back would
|
|
205
|
+
* resurrect retired manual groups); otherwise `groups.yaml` → manual mode.
|
|
206
|
+
*
|
|
207
|
+
* `read` returns null for a genuinely-absent file and may THROW for any other
|
|
208
|
+
* failure. Only ENOENT/ENOTDIR count as absent (the caller may also whitelist
|
|
209
|
+
* them into null); every other read error — notably a non-absence error on
|
|
210
|
+
* `synced-groups.yaml` — is treated as a BROKEN source: no groups, no
|
|
211
|
+
* fallback to the manual file (falling back would resurrect retired groups),
|
|
212
|
+
* and an `ok: false` health marker. Structural parse failures degrade the
|
|
213
|
+
* same way; this function never throws.
|
|
214
|
+
*/
|
|
215
|
+
export declare function loadActiveGroups(read: (filename: string) => Promise<string | null>): Promise<{
|
|
216
|
+
groups: GroupsIndex;
|
|
217
|
+
sourceFile: string;
|
|
218
|
+
warnings: string[];
|
|
219
|
+
health: GroupsHealth;
|
|
220
|
+
}>;
|
|
113
221
|
/**
|
|
114
222
|
* Does an `access.md` body declare access rules — i.e. is the file in the NEW
|
|
115
223
|
* (body-governs-the-folder) format?
|
|
@@ -252,16 +360,6 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
252
360
|
ok: false;
|
|
253
361
|
errors: string[];
|
|
254
362
|
};
|
|
255
|
-
/**
|
|
256
|
-
* Advisory scan of folder `access.md` files for references to a role (by
|
|
257
|
-
* canonical name). See `IAccessControl.referencesToRole` — undercounts node
|
|
258
|
-
* frontmatter by design; powers the delete warning only, never the rename
|
|
259
|
-
* gate.
|
|
260
|
-
*/
|
|
261
|
-
referencesToRole(workspaceId: string, canonicalRole: string): Promise<{
|
|
262
|
-
path: string;
|
|
263
|
-
verb: string;
|
|
264
|
-
}[]>;
|
|
265
363
|
canWrite(workspaceId: string, userEmail: string, relativePath: string): Promise<boolean>;
|
|
266
364
|
canRead(workspaceId: string, userEmail: string, relativePath: string): Promise<boolean>;
|
|
267
365
|
canReadBatch(workspaceId: string, userEmail: string, relativePaths: string[]): Promise<Map<string, boolean>>;
|
|
@@ -270,6 +368,7 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
270
368
|
canOwnerBatch(workspaceId: string, userEmail: string, relativePaths: string[]): Promise<Map<string, boolean>>;
|
|
271
369
|
canOwner(workspaceId: string, userEmail: string, relativePath: string): Promise<boolean>;
|
|
272
370
|
eligibleOwners(workspaceId: string, relativePath: string): Promise<{
|
|
371
|
+
principals: ResolvedPrincipal[];
|
|
273
372
|
roles: string[];
|
|
274
373
|
users: {
|
|
275
374
|
name: string;
|
|
@@ -277,6 +376,7 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
277
376
|
}[];
|
|
278
377
|
}>;
|
|
279
378
|
eligibleWriters(workspaceId: string, relativePath: string): Promise<{
|
|
379
|
+
principals: ResolvedPrincipal[];
|
|
280
380
|
roles: string[];
|
|
281
381
|
users: {
|
|
282
382
|
name: string;
|
|
@@ -285,6 +385,7 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
285
385
|
}>;
|
|
286
386
|
eligibleReaders(workspaceId: string, relativePath: string): Promise<{
|
|
287
387
|
restricted: boolean;
|
|
388
|
+
principals: ResolvedPrincipal[];
|
|
288
389
|
roles: string[];
|
|
289
390
|
users: {
|
|
290
391
|
name: string;
|
|
@@ -292,6 +393,7 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
292
393
|
}[];
|
|
293
394
|
}>;
|
|
294
395
|
eligibleDownloaders(workspaceId: string, relativePath: string): Promise<{
|
|
396
|
+
principals: ResolvedPrincipal[];
|
|
295
397
|
roles: string[];
|
|
296
398
|
users: {
|
|
297
399
|
name: string;
|
|
@@ -306,9 +408,12 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
306
408
|
name: string;
|
|
307
409
|
email: string;
|
|
308
410
|
}>>;
|
|
309
|
-
grantSources(workspaceId: string, kind: AccessTargetKind, relativePath: string, principal: GrantPrincipal
|
|
411
|
+
grantSources(workspaceId: string, kind: AccessTargetKind, relativePath: string, principal: GrantPrincipal, opts?: {
|
|
412
|
+
tokenMatch?: 'exact' | 'name';
|
|
413
|
+
}): Promise<GrantSources>;
|
|
310
414
|
kbPrincipals(workspaceId: string): Promise<{
|
|
311
|
-
|
|
415
|
+
roles: string[];
|
|
416
|
+
groups: string[];
|
|
312
417
|
people: {
|
|
313
418
|
name: string;
|
|
314
419
|
email: string;
|
|
@@ -318,6 +423,16 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
318
423
|
email: string;
|
|
319
424
|
displayName: string;
|
|
320
425
|
} | null>;
|
|
426
|
+
/**
|
|
427
|
+
* `synced-groups.yaml` is MACHINE-OWNED: regenerated wholesale from the
|
|
428
|
+
* directory mirror and committed by the directory-sync bot. The bot is its
|
|
429
|
+
* ONLY writer — role/grant resolution never applies to it. That cuts both
|
|
430
|
+
* ways: the bot needs no role to write it (it isn't in roles.yaml, and on a
|
|
431
|
+
* protected branch nothing else would make it eligible), and no HUMAN can
|
|
432
|
+
* hand-edit it through the app (an edit would be silently overwritten by
|
|
433
|
+
* the next provisioning push anyway).
|
|
434
|
+
*/
|
|
435
|
+
private machineOwnedWriteRule;
|
|
321
436
|
canWriteAtRef(workspaceId: string, ref: string, userEmail: string, relativePath: string): Promise<boolean | null>;
|
|
322
437
|
canReadAtRef(workspaceId: string, ref: string, userEmail: string, relativePath: string): Promise<boolean | null>;
|
|
323
438
|
canWriteBatchAtRef(workspaceId: string, ref: string, userEmail: string, relativePaths: string[]): Promise<Map<string, boolean> | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-control.service.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EAEd,YAAY,
|
|
1
|
+
{"version":3,"file":"access-control.service.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EAEd,YAAY,EACZ,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AA4E1B,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,iDAAkD,CAAC;AAC3E,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CASjD;AACD,eAAO,MAAM,mBAAmB,aAAwC,CAAC;AACzE,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,eAAO,MAAM,cAAc,QAA6C,CAAC;AACzE,eAAO,MAAM,WAAW,QAAqC,CAAC;AAM9D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,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