@vantageos/cloud-identity 0.10.0 → 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/CHANGELOG.md CHANGED
@@ -3,6 +3,93 @@
3
3
  All notable changes to `@vantageos/cloud-identity` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.11.0]
7
+
8
+ **Additive — the acting principal by ID, and the target checked by ID
9
+ (`./principal-by-id`).** An actor and a target are identified by their stored
10
+ IDs; a name is a display label and never selects or authorises a row. Motivating
11
+ incident: an agent of one organisation, calling by name through the service
12
+ account, landed on another organisation's same-named agent's task at ten task
13
+ doors, because admission compared names. No existing function changes behaviour.
14
+
15
+ ### Added
16
+
17
+ - `resolveActingPrincipal(credential, lookups, door?)`: a verified credential
18
+ (agent bearer, person token, or the service account acting as itself or for
19
+ an agent named BY ID within its own organisation) to `{ principalId, orgId,
20
+ kind, viaServiceAccountId? }` read from stored rows, or a typed refusal.
21
+ Strict credential schemas: a credential carrying a name field is refused
22
+ whole. Missing or throwing lookups, misses, malformed, inactive, unstamped
23
+ and wrong-organisation rows, and inactive organisations all refuse.
24
+ - `assertTargetBelongsTo(principal, target, lookups, opts?)` (async):
25
+ compares the target's stored `orgId` (and `ownerId` with `ownerOnly`) with
26
+ the resolved IDs. An unstamped target is refused to every principal, the
27
+ fleet principal included: no right is inferred from an absence, and a fleet
28
+ row carries the operator organisation's ID explicitly.
29
+ - The fleet is the OPERATOR ORGANISATION, decided from data by the adapter
30
+ method `orgKindOf(orgId) => "operator" | "client" | null` on
31
+ `PrincipalLookups` (and `OrgKindLookups` for `assertTargetBelongsTo`). `null`,
32
+ a miss or any other answer is not the fleet; a missing or throwing adapter
33
+ refuses. An operator-organisation row is refused to every client; the
34
+ fleet principal reaches a client organisation's row only with
35
+ `fleetCrossOrg: true` and only when the adapter reports it as `"client"`.
36
+ - RULING 5: membership of the operator organisation is ordinary membership.
37
+ Its agents and persons resolve as `kind: "agent"` / `"person"` of that
38
+ organisation and reach its rows only; cross-organisation reach (`kind:
39
+ "fleet"` + `fleetCrossOrg`) belongs to its service account alone, and
40
+ `reserved-fleet-scope` refuses a claim of that scope (a `kind: "fleet"`
41
+ credential, or `fleetCrossOrg` used by any other principal), never plain
42
+ membership.
43
+ The operator organisation is checked by `organisationById` like any other.
44
+ - `FLEET_SCOPE_ORG_ID` (a reserved `"vantageos:fleet"` constant, merged on
45
+ `main` but never published) is REMOVED before release, with no alias (RULING
46
+ 4). A row stamped with that literal is an unknown organisation and is refused
47
+ to every caller.
48
+ - `actingCredentialSchema`, `principalRowSchema`, `organisationRowSchema` and
49
+ the types `ActingCredential`, `PrincipalRow`, `OrganisationRow`,
50
+ `PrincipalLookups`, `OrgKind`, `OrgKindLookups`, `ActingPrincipalKind`,
51
+ `ActingPrincipal`,
52
+ `ResolveActingPrincipalResult`, `TargetIds`, `AssertTargetOptions`,
53
+ `AssertTargetResult`.
54
+ - New `IdentityRefusalReason` values: `credential-invalid`,
55
+ `principal-lookup-failed`, `principal-not-found`, `principal-record-invalid`,
56
+ `principal-inactive`, `organisation-not-active`, `reserved-fleet-scope`,
57
+ `acting-agent-other-organisation`, `target-unstamped`,
58
+ `target-other-organisation`, `target-owner-mismatch`.
59
+ - New subpath export `./principal-by-id`.
60
+ - A test that reads the exported signatures with the TypeScript checker and
61
+ fails if any identity input of this module is spelled like a name.
62
+
63
+ ### Deprecated
64
+
65
+ - `resolvePersonActingName` (0.9.0). It takes names (`claimedName`,
66
+ `agentCredential.agentName`) as identity input; backend standard R-53
67
+ clause 4 makes it non-conforming for any new door. Use
68
+ `resolveActingPrincipal` and `assertTargetBelongsTo`. Behaviour unchanged;
69
+ removal is a major change, made only after consumers migrate off it.
70
+ - `passesScopeFilter`, `scopeFilterGet` and `scopeFilterList` (the last two
71
+ through the first). A `createdBy` name matched against `fromAllowList`
72
+ selects the row; backend standard R-53 clause 1 forbids it. Use
73
+ `resolveActingPrincipal` and `assertTargetBelongsTo`. Behaviour unchanged;
74
+ they stay exported until consumers migrate off them.
75
+ - The name-input test now covers every callable export of the package root: a
76
+ new export taking a name-like identity input fails. The deprecated legacy
77
+ exceptions are exactly `resolvePersonActingName`, `passesScopeFilter`,
78
+ `scopeFilterGet` and `scopeFilterList`, and the test fails if any of them
79
+ loses its `@deprecated Since 0.11.0` tag. The scan reads a generic input
80
+ through its constraint, so a name field behind `T extends ScopeFilterable`
81
+ is seen. Two 0.10.0 exports that carry a name-like field without selecting a
82
+ row by it (`isPersonActorName`: `name`; `checkPersonCallShape`:
83
+ `actingName`, accepted only to be refused) are pinned in a frozen map that
84
+ can only shrink.
85
+
86
+ ### Migration (required consumer step)
87
+
88
+ - Before switching a door to `assertTargetBelongsTo`, stamp every existing row
89
+ that has no `orgId` with its real organisation ID or with the operator
90
+ organisation's ID, and supply `orgKindOf` reading the stored `orgKind`. Unstamped rows are refused to every caller, so a door
91
+ switched before the backfill stops serving them.
92
+
6
93
  ## [0.10.0]
7
94
 
8
95
  **Additive — identity gaps a consumer had are now in the package.** Every
package/README.md CHANGED
@@ -174,13 +174,24 @@ await resolveTenant({ session: null }); // throws Error("Unauthenticated: no ses
174
174
  **Row filtering**
175
175
 
176
176
  - `passesScopeFilter(ctx, row)` — true when this row is visible to this
177
- caller.
177
+ caller. **Deprecated since 0.11.0** (see below).
178
178
  - `scopeFilterList(ctx, rows)` — the subset of rows the caller may see.
179
+ **Deprecated since 0.11.0** (see below).
179
180
  - `scopeFilterGet(ctx, row)` — the row, or `null` if the caller may not see it.
181
+ **Deprecated since 0.11.0** (see below).
180
182
  - `isMasterScope(ctx)` / `isWildcardScope(ctx)` — true when the caller holds
181
183
  unrestricted access. Useful for skipping filtering you know is pointless;
182
184
  never as a substitute for it.
183
185
 
186
+ **Deprecated since 0.11.0: `passesScopeFilter`, `scopeFilterGet` and
187
+ `scopeFilterList`.** All three (the last two through the first) admit a row
188
+ when its `createdBy` NAME appears in the caller's `fromAllowList`, so a name
189
+ selects the row, which backend standard R-53 clause 1 forbids. For a target
190
+ that carries an organisation or owner ID, use `resolveActingPrincipal` and
191
+ `assertTargetBelongsTo`, which compare stored IDs (see "The acting principal
192
+ by ID, and the target checked by ID"). Their behaviour is unchanged; they stay
193
+ exported until consumers migrate off them, and are removed in a major release.
194
+
184
195
  Visibility is granted two ways: the row's `createdBy` appears in the caller's
185
196
  `fromAllowList`, or the row's `namespace` sits under one of the caller's
186
197
  `namespaceReadPrefixes`. Prefixes match on a path boundary, so a caller allowed
@@ -410,6 +421,7 @@ const who = await resolvePersonPrincipal(
410
421
  if (!who.ok) return deny(who.refusal);
411
422
 
412
423
  // 2. Under what name: the token's, never the argument's.
424
+ // Deprecated since 0.11.0: a new door uses resolveActingPrincipal instead.
413
425
  const name = resolvePersonActingName({
414
426
  principal: who.principal, claimedName: args.createdBy,
415
427
  agentCredential: presentedAgent, door: "my-tool",
@@ -427,6 +439,12 @@ const mayWrite = resolveWriterRole({
427
439
  - `resolvePersonPrincipal(token, deps, door)` refuses a token that is expired,
428
440
  revoked, not a person's, bound to no organisation, or bound to an inactive or
429
441
  unmapped one. It looks up only the token's own organisation.
442
+ - **Deprecated since 0.11.0:** `resolvePersonActingName`. It takes names
443
+ (`claimedName`, `agentCredential.agentName`) as identity input, which backend
444
+ standard R-53 clause 4 makes non-conforming for any new door. Use
445
+ `resolveActingPrincipal` and `assertTargetBelongsTo` (see "The acting
446
+ principal by ID, and the target checked by ID"). Its behaviour is unchanged;
447
+ it will be removed in a major release once consumers have migrated off it.
430
448
  - `resolvePersonActingName` returns `{ ok: true, actingAs: "person", actor }`
431
449
  for no name or the person's own (`user:<subject>`), and refuses another
432
450
  user's name (`PERSON_ACTS_AS_ITSELF`) and an agent's name without that
@@ -521,6 +539,170 @@ refuses accepts an optional `door` so the refusal names your own entry point.
521
539
  empty) matches nothing, so a missing configuration never opens a door. The
522
540
  refusal carries neither value.
523
541
 
542
+ ## The acting principal by ID, and the target checked by ID (0.11.0)
543
+
544
+ **Why this exists.** Two organisations each had an agent displayed as `eta`.
545
+ An organisation A agent, calling through the shared service account and naming
546
+ itself `eta`, completed, updated and deleted organisation B's `eta` task at ten
547
+ different task doors. Every door admitted the call by comparing the typed name
548
+ with a name stored on the task. The names were equal; the two agents were not.
549
+ Nothing compared an ID.
550
+
551
+ The rule this module carries: **an actor and a target are identified by their
552
+ stored IDs. A name is a display label; it never selects a row and never
553
+ authorises one.** Resolving the principal and checking the target both happen
554
+ here, so a product never writes its own identity layer.
555
+
556
+ ```js
557
+ import {
558
+ resolveActingPrincipal,
559
+ assertTargetBelongsTo,
560
+ } from "@vantageos/cloud-identity";
561
+
562
+ // The operator org is DATA: the org whose mapping row says orgKind "operator".
563
+ const orgKindOf = async (id) => (await db.orgs.get(id))?.orgKind ?? null;
564
+
565
+ // 1. Who is acting? IDs from the VERIFIED credential, rows read by ID.
566
+ const who = await resolveActingPrincipal(
567
+ { kind: "service", serviceAccountId: "svc_a", actingForAgentId: "agent_a_eta" },
568
+ {
569
+ agentById: (id) => db.agents.get(id), // -> { id, orgId, active }
570
+ serviceAccountById: (id) => db.services.get(id),
571
+ organisationById: (id) => db.orgs.get(id), // -> { id, active }
572
+ orgKindOf, // -> "operator" | "client" | null
573
+ },
574
+ "tasks:complete",
575
+ );
576
+ if (!who.ok) throw toHttpError(who.refusal); // RBAC_DENIED, typed reason
577
+
578
+ // 2. Does the target belong to them? Stored IDs against resolved IDs.
579
+ const task = await db.tasks.get(taskId);
580
+ const may = await assertTargetBelongsTo(
581
+ who.principal,
582
+ { orgId: task.orgId, ownerId: task.ownerId },
583
+ { orgKindOf },
584
+ { ownerOnly: true, door: "tasks:complete" },
585
+ );
586
+ if (!may.ok) throw toHttpError(may.refusal);
587
+ ```
588
+
589
+ Organisation B's `eta` task carries `orgId: "org_b"`; the principal above
590
+ resolved to `orgId: "org_a"`. The target check refuses it with
591
+ `target-other-organisation`, whatever either agent is called.
592
+
593
+ **`resolveActingPrincipal(credential, lookups, door?)`** (`./principal-by-id`)
594
+
595
+ Async. Returns `{ ok: true, principal }` or `{ ok: false, refusal }`
596
+ (`ResolveActingPrincipalResult`). The `principal` (`ActingPrincipal`) is
597
+ `{ principalId, orgId, kind, viaServiceAccountId? }`, where `kind` is
598
+ `"agent" | "person" | "service" | "fleet"` (`ActingPrincipalKind`).
599
+
600
+ `credential` (`ActingCredential`, validated by `actingCredentialSchema`) is one
601
+ of three shapes, every identity field an ID:
602
+
603
+ - `{ kind: "agent", agentId, verifiedOrgId }` — the machine path: an agent's
604
+ own bearer, already verified by you (for example with
605
+ `validatePresentedBearer`). The agent row's stored `orgId` must equal
606
+ `verifiedOrgId`.
607
+ - `{ kind: "person", personId, verifiedOrgId }` — the human path: a person's
608
+ token, already verified by you. The person's row in that organisation is read
609
+ by `(personId, verifiedOrgId)`.
610
+ - `{ kind: "service", serviceAccountId, actingForAgentId? }` — the service
611
+ account. Alone it acts as itself (`kind: "service"`, or `kind: "fleet"` if
612
+ `orgKindOf` reports its organisation as `"operator"`). With `actingForAgentId` it acts for that
613
+ agent, named BY ID and resolved within the service account's OWN
614
+ organisation; the principal is the agent, and `viaServiceAccountId` records
615
+ the carrier.
616
+
617
+ The schemas are strict: a credential carrying any other key (`agentName`,
618
+ `callerOrchestrator`, `name`, `assignedTo`) is refused whole with
619
+ `credential-invalid`, before any lookup runs.
620
+
621
+ `lookups` (`PrincipalLookups`) are your indexed reads by ID: `agentById(id)`,
622
+ `personById(id, orgId)`, `serviceAccountById(id)` returning a `PrincipalRow`
623
+ (`{ id, orgId?, active }`, schema `principalRowSchema`), and
624
+ `organisationById(id)` returning an `OrganisationRow` (`{ id, active }`, schema
625
+ `organisationRowSchema`), and `orgKindOf(orgId)` returning an `OrgKind`
626
+ (`"operator" | "client"`) or `null`. Only the lookups of the presented path
627
+ are called; `orgKindOf` is called on every path.
628
+ Each row must repeat the ID that was asked for, and `active` is required and
629
+ must be `true`.
630
+
631
+ Refused, each with a typed `IdentityRefusal` reason: a credential that does not
632
+ parse; a missing or throwing lookup (its error text is never surfaced); a miss;
633
+ a malformed, inactive or unstamped row; a row of another organisation than its
634
+ credential; an unmapped or inactive organisation; a service account acting for
635
+ an agent of another organisation. Nothing falls back to a default or master
636
+ principal.
637
+
638
+ **`assertTargetBelongsTo(principal, target, lookups, opts?)`** (`./principal-by-id`)
639
+
640
+ Async. Returns `{ ok: true }` or `{ ok: false, refusal }`
641
+ (`AssertTargetResult`). `target` (`TargetIds`) is `{ orgId?, ownerId? }` read
642
+ from the STORED row; `lookups` (`OrgKindLookups`) is `{ orgKindOf }`, the same
643
+ adapter as above, and is required (a missing or throwing adapter refuses with
644
+ `principal-lookup-failed`); `opts` (`AssertTargetOptions`) is
645
+ `{ door?, ownerOnly?, fleetCrossOrg? }`. IDs are compared byte for byte.
646
+
647
+ - The target's `orgId` must equal the principal's `orgId`
648
+ (`target-other-organisation` otherwise).
649
+ - `ownerOnly: true` also requires `ownerId` to equal `principalId`; a target
650
+ with no owner is refused (`target-owner-mismatch`).
651
+ - A target with no `orgId` is refused (`target-unstamped`) to EVERY
652
+ principal, the fleet principal included, with or without `fleetCrossOrg`.
653
+ No right is inferred from an absence: a row with no organisation is never
654
+ treated as a master row.
655
+ - An absent principal, or one with an empty ID, is refused
656
+ (`credential-invalid`).
657
+
658
+ **The fleet is the operator organisation.** The fleet is not a reserved ID: it
659
+ is the organisation your `orgKindOf` adapter reports as `"operator"` (for
660
+ example the organisation whose mapping row carries `orgKind: "operator"`),
661
+ read from your data at run time. The package spells no organisation ID. An
662
+ adapter answering `null`, a miss, or anything other than exactly
663
+ `"operator"` means "not the fleet"; a missing or throwing adapter refuses.
664
+
665
+ **RULING 5: membership of the operator organisation is ordinary membership.**
666
+ Its agents and persons resolve as `kind: "agent"` / `"person"` of that
667
+ organisation and reach its rows only; cross-organisation reach (`kind: "fleet"`
668
+ with `fleetCrossOrg`) belongs to the operator organisation's service account
669
+ alone, and `reserved-fleet-scope` refuses a CLAIM of that scope, never plain
670
+ membership:
671
+
672
+ - an agent or person credential verified for the operator organisation
673
+ resolves as an ordinary principal of it, with no cross-organisation reach;
674
+ only a service account stamped with it resolves to `kind: "fleet"`;
675
+ - a credential carrying `kind: "fleet"` is refused (`reserved-fleet-scope`),
676
+ whoever presents it;
677
+ - any non-fleet principal reaching another organisation's row under
678
+ `fleetCrossOrg: true` is refused (`reserved-fleet-scope`); without it,
679
+ `target-other-organisation`;
680
+ - an operator-organisation row is refused to every client principal, with or
681
+ without `fleetCrossOrg` (`reserved-fleet-scope`);
682
+ - a `kind: "fleet"` principal whose organisation the adapter does not report
683
+ as `"operator"` is refused, and so is a `kind: "service"` principal in the
684
+ operator organisation (its service account is the fleet);
685
+ - the fleet principal reaches a CLIENT organisation's row only when the door
686
+ passes `fleetCrossOrg: true` (a master export) AND the adapter reports that
687
+ organisation as `"client"`. An unknown organisation is refused;
688
+ - the operator organisation is an ordinary stored organisation:
689
+ `organisationById` must return it mapped and active, like any other;
690
+ - a fleet row is a row stamped with the operator organisation's ID explicitly.
691
+ A row with no `orgId` is not a fleet row and is refused to the fleet
692
+ principal too.
693
+
694
+ **Migration (required consumer step).** Before a product switches any door to
695
+ `assertTargetBelongsTo`, it must stamp every existing row that has no `orgId`:
696
+ with its real organisation ID, or with the operator organisation's ID if it
697
+ belongs to the operator's own scope. An unstamped row is refused to every caller,
698
+ including the fleet principal, so a door switched before the backfill stops
699
+ serving those rows. Run the backfill first, confirm that no unstamped row is
700
+ left in the tables the door reads, then switch the door.
701
+
702
+ `viaServiceAccountId` and `door` are not identity; no function in this module
703
+ takes a name as an identity input, and a test reads the exported signatures to
704
+ keep it that way.
705
+
524
706
  ## What this package does not do
525
707
 
526
708
  Worth reading before you rely on it.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Typed refusal shared by the 0.10.0 primitives (role policy, membership,
3
- * org-admin proof, namespace write, secret comparison).
3
+ * org-admin proof, namespace write, secret comparison) and the 0.11.0
4
+ * principal-by-id resolver and target check.
4
5
  *
5
6
  * A refusal is a value carrying its own code, reason and door, so a caller
6
7
  * branches on content rather than on the mere presence of an exception, and an
@@ -12,7 +13,7 @@
12
13
  * closed vocabulary for the person path.
13
14
  */
14
15
  export type IdentityRefusalCode = "RBAC_DENIED" | "CREDENTIAL_REFUSED";
15
- export type IdentityRefusalReason = "unknown-role" | "unknown-minimum-role" | "invalid-role-order" | "role-below-minimum" | "role-claim-absent" | "role-claim-unmapped" | "invalid-role-mapping" | "membership-invalid-input" | "membership-lookup-failed" | "membership-not-found" | "membership-record-invalid" | "membership-inactive" | "other-organisation" | "no-verified-organisation" | "role-not-admin" | "namespace-invalid" | "no-write-prefixes" | "namespace-write-denied" | "secret-not-configured" | "secret-mismatch";
16
+ export type IdentityRefusalReason = "unknown-role" | "unknown-minimum-role" | "invalid-role-order" | "role-below-minimum" | "role-claim-absent" | "role-claim-unmapped" | "invalid-role-mapping" | "membership-invalid-input" | "membership-lookup-failed" | "membership-not-found" | "membership-record-invalid" | "membership-inactive" | "other-organisation" | "no-verified-organisation" | "role-not-admin" | "namespace-invalid" | "no-write-prefixes" | "namespace-write-denied" | "secret-not-configured" | "secret-mismatch" | "credential-invalid" | "principal-lookup-failed" | "principal-not-found" | "principal-record-invalid" | "principal-inactive" | "organisation-not-active" | "reserved-fleet-scope" | "acting-agent-other-organisation" | "target-unstamped" | "target-other-organisation" | "target-owner-mismatch";
16
17
  export type IdentityRefusal = {
17
18
  code: IdentityRefusalCode;
18
19
  reason: IdentityRefusalReason;
@@ -1 +1 @@
1
- {"version":3,"file":"identity-refusal.d.ts","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAE7B,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GAEtB,0BAA0B,GAC1B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AAyB,GACzB,sBAAsB,GACtB,iCAAiC,GACjC,kBAAkB,GAClB,2BAA2B,GAC3B,uBAAuB,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,0EAA0E;AAC1E,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;gBACtB,OAAO,EAAE,eAAe;CAKrC;AAED,gEAAgE;AAChE,wBAAgB,OAAO,CACrB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,eAAe,CAEjB"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Typed refusal shared by the 0.10.0 primitives (role policy, membership,
3
- * org-admin proof, namespace write, secret comparison).
3
+ * org-admin proof, namespace write, secret comparison) and the 0.11.0
4
+ * principal-by-id resolver and target check.
4
5
  *
5
6
  * A refusal is a value carrying its own code, reason and door, so a caller
6
7
  * branches on content rather than on the mere presence of an exception, and an
@@ -1 +1 @@
1
- {"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAwCH,0EAA0E;AAC1E,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,OAAO,CAAkB;IAClC,YAAY,OAAwB;QAClC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CACrB,IAAyB,EACzB,MAA6B,EAC7B,IAAY,EACZ,MAAc;IAEd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAoDH,0EAA0E;AAC1E,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,OAAO,CAAkB;IAClC,YAAY,OAAwB;QAClC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CACrB,IAAyB,EACzB,MAA6B,EAC7B,IAAY,EACZ,MAAc;IAEd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -37,4 +37,6 @@ export { isRowInTenant, resolveMembership, requireOrgAdmin, membershipRecordSche
37
37
  export type { MembershipRecord, ResolvedMembership, ResolveMembershipInput, ResolveMembershipResult, RequireOrgAdminInput, } from "./tenant-membership.js";
38
38
  export { assertNamespaceWrite } from "./namespace-write.js";
39
39
  export { timingSafeEqualSync, assertSecretSync } from "./secret-compare-sync.js";
40
+ export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, } from "./principal-by-id.js";
41
+ export type { ActingCredential, PrincipalRow, OrganisationRow, PrincipalLookups, OrgKind, OrgKindLookups, ActingPrincipalKind, ActingPrincipal, ResolveActingPrincipalResult, TargetIds, AssertTargetOptions, AssertTargetResult, } from "./principal-by-id.js";
40
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EACL,uBAAuB,EACvB,0BAA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Y,EACV,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,SAAS,EACT,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -35,4 +35,7 @@ export { resolveMinRole, assertMinRole, mapRoleClaim } from "./role-policy.js";
35
35
  export { isRowInTenant, resolveMembership, requireOrgAdmin, membershipRecordSchema, } from "./tenant-membership.js";
36
36
  export { assertNamespaceWrite } from "./namespace-write.js";
37
37
  export { timingSafeEqualSync, assertSecretSync } from "./secret-compare-sync.js";
38
+ // 0.11.0 — The acting principal by ID and the target checked by ID. A name is
39
+ // a display label: it never selects a row and never authorises one.
40
+ export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, } from "./principal-by-id.js";
38
41
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,mBAAmB,GAEpB,MAAM,mBAAmB,C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EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AASlE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAMjF,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAc/B,+EAA+E;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO/E,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjF,8EAA8E;AAC9E,oEAAoE;AACpE,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
@@ -136,6 +136,13 @@ export type PersonActingNameResult = {
136
136
  * resolved by the consumer): none ->
137
137
  * AGENT_CREDENTIAL_REQUIRED, a
138
138
  * different agent -> AGENT_IDENTITY_MISMATCH.
139
+ *
140
+ * @deprecated Since 0.11.0. Use `resolveActingPrincipal` (and
141
+ * `assertTargetBelongsTo` for the target), which resolve the actor by stored
142
+ * ID. This function takes names (`claimedName`, `agentCredential.agentName`)
143
+ * as identity input, which backend standard R-53 clause 4 makes
144
+ * non-conforming for any new door. Behaviour is unchanged; it will be removed
145
+ * in a major release once consumers have migrated off it.
139
146
  */
140
147
  export declare function resolvePersonActingName(input: {
141
148
  /** Only the actor name is read: the rule needs no organisation. */
@@ -1 +1 @@
1
- {"version":3,"file":"person-principal.d.ts","sourceRoot":"","sources":["../src/person-principal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,uBAAuB,GACvB,2BAA2B,GAC3B,yBAAyB,CAAC;AAE9B,MAAM,MAAM,mBAAmB,GAC3B,uBAAuB,GACvB,oBAAoB,GACpB,qBAAqB,GACrB,gBAAgB,GAChB,uBAAuB,GACvB,4BAA4B,GAC5B,2BAA2B,GAC3B,yBAAyB,GACzB,oBAAoB,GACpB,iBAAiB,CAAC;AAEtB,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,yEAAyE;AACzE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBACpB,OAAO,EAAE,aAAa;CAKnC;AAgBD,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAO3C,4CAA4C;AAC5C,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;GAIG;AACH,wBAAg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G;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC;AAEtF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,kBAAkB,CAerB;AAMD,KAAK,eAAe,GAAG;IACrB,uEAAuE;IACvE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,oFAAoF;IACpF,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,CAc5E;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAG9D"}
@@ -131,6 +131,13 @@ export async function resolvePersonPrincipal(token, deps, door) {
131
131
  * resolved by the consumer): none ->
132
132
  * AGENT_CREDENTIAL_REQUIRED, a
133
133
  * different agent -> AGENT_IDENTITY_MISMATCH.
134
+ *
135
+ * @deprecated Since 0.11.0. Use `resolveActingPrincipal` (and
136
+ * `assertTargetBelongsTo` for the target), which resolve the actor by stored
137
+ * ID. This function takes names (`claimedName`, `agentCredential.agentName`)
138
+ * as identity input, which backend standard R-53 clause 4 makes
139
+ * non-conforming for any new door. Behaviour is unchanged; it will be removed
140
+ * in a major release once consumers have migrated off it.
134
141
  */
135
142
  export function resolvePersonActingName(input) {
136
143
  const { principal, door } = input;
@@ -1 +1 @@
1
- {"version":3,"file":"person-principal.js","sourceRoot":"","sources":["../src/person-principal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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AAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC;IAChC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;IAC5C,IAAI,IAAI,KAAK,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACrE,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,MAAM,CACb,aAAa,EACb,iBAAiB,EACjB,KAAK,CAAC,IAAI,EACV,kCAAkC,EAClC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,EAAE,CACzC;KACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,KAAsB;IACtD,MAAM,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,CAAC,CAAC,CAAC,EAAE;QAAE,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * The acting principal by ID, and the target checked by ID.
3
+ *
4
+ * An actor and a target are identified by their stored IDs, never by a name.
5
+ * A name is a display label: it never selects a row and never authorises one.
6
+ *
7
+ * Motivating incident: an agent of organisation A named "eta", calling by name
8
+ * through a service account, completed, updated and deleted the task of
9
+ * organisation B's agent also named "eta" at ten task doors, because every door
10
+ * admitted the caller by comparing names. Two different agents shared a label;
11
+ * nothing compared their IDs.
12
+ *
13
+ * Two functions close that class:
14
+ *
15
+ * - `resolveActingPrincipal(credential, lookups)` turns a VERIFIED credential
16
+ * into `{ principalId, orgId, kind }` read from stored rows, or refuses.
17
+ * - `assertTargetBelongsTo(principal, target, lookups, opts)` admits a target
18
+ * only when its stored organisation ID (and owner ID, where the door is
19
+ * owner-only) equals the principal's resolved IDs.
20
+ *
21
+ * The fleet is the OPERATOR ORGANISATION: the organisation the consumer's
22
+ * `orgKindOf` adapter reports as `"operator"`, read from stored data at run
23
+ * time. No organisation ID is reserved or spelled in this package; an
24
+ * adapter that answers anything else, or nothing, means "not the fleet".
25
+ *
26
+ * RULING 5: membership of the operator org is ORDINARY membership. Its agents
27
+ * and persons resolve as `kind: "agent"` / `"person"` of that org and reach its
28
+ * rows only. Cross-org reach (`kind: "fleet"` + `fleetCrossOrg`) belongs to the
29
+ * operator org's SERVICE ACCOUNT alone; `reserved-fleet-scope` refuses a claim
30
+ * of that scope by any other credential, never plain membership.
31
+ *
32
+ * Pure functions over injected lookups: no database, no framework, no network.
33
+ * The consumer performs each indexed read by ID and passes the function in;
34
+ * every failure (throwing lookup, miss, malformed row, inactive row, wrong
35
+ * organisation) is a typed `IdentityRefusal`, never a default principal.
36
+ *
37
+ * @security This module verifies NOTHING about the credential itself. The IDs
38
+ * in a credential must come from the consumer's verification of what the
39
+ * caller presented (a bearer row, a person's token, the service secret). A
40
+ * client-supplied argument passed as a credential becomes the principal.
41
+ */
42
+ import { z } from "zod";
43
+ import { type IdentityRefusal } from "./identity-refusal.js";
44
+ /**
45
+ * A verified credential, in the package's vocabulary. Every identity field is
46
+ * an ID. The schemas are STRICT: a credential carrying any other key (an
47
+ * `agentName`, a `callerOrchestrator`, a `name`) is refused whole, so a name
48
+ * cannot be smuggled in beside an ID.
49
+ *
50
+ * - `agent`: an agent's own bearer, verified by the consumer (for example by
51
+ * `validatePresentedBearer`): the agent ID and the organisation the bearer
52
+ * row is stamped with.
53
+ * - `person`: a person's token, verified by the consumer: the stored person
54
+ * ID (the verified subject) and the organisation the token is bound to.
55
+ * - `service`: the service account, verified by the consumer. When it acts
56
+ * for an agent it names that agent BY ID (`actingForAgentId`); the agent
57
+ * is resolved within the service account's own organisation.
58
+ */
59
+ export declare const actingCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
+ kind: z.ZodLiteral<"agent">;
61
+ agentId: z.ZodString;
62
+ verifiedOrgId: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ kind: z.ZodLiteral<"person">;
65
+ personId: z.ZodString;
66
+ verifiedOrgId: z.ZodString;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ kind: z.ZodLiteral<"service">;
69
+ serviceAccountId: z.ZodString;
70
+ actingForAgentId: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strict>], "kind">;
72
+ export type ActingCredential = z.input<typeof actingCredentialSchema>;
73
+ /**
74
+ * Each row repeats its own ID, so a loose lookup (prefix match, wrong index)
75
+ * returning another row cannot become a principal. `active` is REQUIRED and
76
+ * must be `true`: an absent flag grants nothing. Extra fields (a display name)
77
+ * are allowed and ignored.
78
+ */
79
+ export declare const principalRowSchema: z.ZodObject<{
80
+ id: z.ZodString;
81
+ orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ active: z.ZodBoolean;
83
+ }, z.core.$strip>;
84
+ export type PrincipalRow = z.input<typeof principalRowSchema>;
85
+ export declare const organisationRowSchema: z.ZodObject<{
86
+ id: z.ZodString;
87
+ active: z.ZodBoolean;
88
+ }, z.core.$strip>;
89
+ export type OrganisationRow = z.input<typeof organisationRowSchema>;
90
+ /**
91
+ * The kind of a stored organisation, as the consumer's mapping row records it.
92
+ * `"operator"` is the fleet: the operator's own organisation, whose rows are
93
+ * the master scope. Any other answer, `null` included, is not the fleet.
94
+ */
95
+ export type OrgKind = "operator" | "client";
96
+ type Lookup<A extends unknown[], R> = (...args: A) => Promise<R | null | undefined> | R | null | undefined;
97
+ /** Indexed reads BY ID. Only the lookups of the presented path are called. */
98
+ export type PrincipalLookups = {
99
+ agentById?: Lookup<[agentId: string], PrincipalRow>;
100
+ /** A person's row IN one organisation (their membership there). */
101
+ personById?: Lookup<[personId: string, orgId: string], PrincipalRow>;
102
+ serviceAccountById?: Lookup<[serviceAccountId: string], PrincipalRow>;
103
+ /** The organisation row; the operator organisation is checked like any other. */
104
+ organisationById?: Lookup<[orgId: string], OrganisationRow>;
105
+ /**
106
+ * The stored kind of an organisation (for example `orgKind` on its mapping
107
+ * row). Decides, from data, whether an organisation is the operator org,
108
+ * that is the fleet. `null`, a miss, or any value other than exactly
109
+ * `"operator"` is NOT the fleet. A missing or throwing adapter refuses.
110
+ */
111
+ orgKindOf?: Lookup<[orgId: string], OrgKind>;
112
+ };
113
+ /** The one lookup `assertTargetBelongsTo` reads. */
114
+ export type OrgKindLookups = Pick<PrincipalLookups, "orgKindOf">;
115
+ export type ActingPrincipalKind = "agent" | "person" | "service" | "fleet";
116
+ export type ActingPrincipal = {
117
+ /** The stored ID of the actor: agent ID, person ID or service-account ID. */
118
+ principalId: string;
119
+ /** The stored organisation ID. The operator org's ID for `fleet`. */
120
+ orgId: string;
121
+ kind: ActingPrincipalKind;
122
+ /** Set when a service account acts for an agent: the service account's ID. */
123
+ viaServiceAccountId?: string;
124
+ };
125
+ export type ResolveActingPrincipalResult = {
126
+ ok: true;
127
+ principal: ActingPrincipal;
128
+ } | {
129
+ ok: false;
130
+ refusal: IdentityRefusal;
131
+ };
132
+ export type TargetIds = {
133
+ /** The target row's stored organisation ID. Absent: unstamped. */
134
+ orgId?: string | null;
135
+ /** The target row's stored owner ID (agent, person or service account). */
136
+ ownerId?: string | null;
137
+ };
138
+ export type AssertTargetOptions = {
139
+ /** The consumer's name for the door; carried on every refusal. */
140
+ door?: string;
141
+ /** Owner-only door: the target's `ownerId` must equal `principalId`. */
142
+ ownerOnly?: boolean;
143
+ /**
144
+ * A fleet principal may reach a row of a CLIENT organisation only when the
145
+ * door declares it (a master export), and only when `orgKindOf` reports that
146
+ * organisation as `"client"`. Default `false`: refused.
147
+ */
148
+ fleetCrossOrg?: boolean;
149
+ };
150
+ export type AssertTargetResult = {
151
+ ok: true;
152
+ } | {
153
+ ok: false;
154
+ refusal: IdentityRefusal;
155
+ };
156
+ /**
157
+ * Resolves the acting principal from a VERIFIED credential to stored IDs, or
158
+ * refuses. Refusal by default: a credential claiming the fleet kind
159
+ * (`reserved-fleet-scope`), a credential that does not parse (including one
160
+ * carrying any name field), a missing or throwing lookup, a miss, a malformed
161
+ * or inactive row, an unstamped row and an inactive organisation are all
162
+ * refused. Nothing is ever resolved by a name, and nothing falls back to a
163
+ * master principal.
164
+ *
165
+ * - agent: the agent row by `agentId`; its stored org must equal the org
166
+ * the credential was verified for. An agent of the operator org resolves
167
+ * as an ordinary `kind: "agent"` of that org (RULING 5).
168
+ * - person: the person row by (`personId`, `verifiedOrgId`); it must be
169
+ * stamped with that org. A person of the operator org resolves as an
170
+ * ordinary `kind: "person"` of that org (RULING 5).
171
+ * - service: the service-account row by `serviceAccountId`. Alone, it acts
172
+ * as itself (`kind: "service"`, or `kind: "fleet"` when `orgKindOf` reports
173
+ * its stored org as `"operator"`). With `actingForAgentId`, the agent row is read by
174
+ * ID and must be stamped with the service account's own org; the principal
175
+ * is that agent, with `viaServiceAccountId` recording the carrier.
176
+ */
177
+ export declare function resolveActingPrincipal(credential: ActingCredential | null | undefined, lookups: PrincipalLookups, door?: string): Promise<ResolveActingPrincipalResult>;
178
+ /**
179
+ * Admits a target only by comparing its STORED IDs with the principal's
180
+ * resolved IDs, byte for byte. No name field is read; there is none to read.
181
+ *
182
+ * Whether an organisation is the operator org (the fleet) is read from
183
+ * `lookups.orgKindOf`; a missing or throwing adapter refuses.
184
+ *
185
+ * - An absent principal, or one with an empty ID, is refused.
186
+ * - A `kind: "fleet"` principal outside the operator org is refused, and so
187
+ * is a `kind: "service"` principal inside it (the operator org's service
188
+ * account is the fleet). An agent or person of the operator org is an
189
+ * ordinary member of it (RULING 5).
190
+ * - An unstamped target (no `orgId`) is refused to EVERY principal, the
191
+ * fleet principal included. No right is inferred from an absence: a fleet
192
+ * row carries the operator org's ID explicitly, and a row with no
193
+ * organisation is never treated as a master row.
194
+ * - An operator-org row is refused to every client principal.
195
+ * - Otherwise the target's `orgId` must equal the principal's. A fleet
196
+ * principal reaches a client organisation's row only when the door sets
197
+ * `fleetCrossOrg` (a master export) AND `orgKindOf` reports that
198
+ * organisation as `"client"`; an unknown organisation is refused. Any
199
+ * other principal reaching across organisations under `fleetCrossOrg`
200
+ * claims the fleet scope and is refused `reserved-fleet-scope`.
201
+ * - `ownerOnly`: the target's `ownerId` must also equal `principalId`; an
202
+ * absent owner is refused.
203
+ */
204
+ export declare function assertTargetBelongsTo(principal: ActingPrincipal | null | undefined, target: TargetIds | null | undefined, lookups: OrgKindLookups, opts?: AssertTargetOptions): Promise<AssertTargetResult>;
205
+ export {};
206
+ //# sourceMappingURL=principal-by-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principal-by-id.d.ts","sourceRoot":"","sources":["../src/principal-by-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,eAAe,EAAW,MAAM,uBAAuB,CAAC;AAMtE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;4BAgBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAMtE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5C,KAAK,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,IAAI,CACpC,GAAG,IAAI,EAAE,CAAC,KACP,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAA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S,GAAG;IACtB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AA0GxF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAC/C,OAAO,EAAE,gBAAgB,EACzB,IAAI,SAA2B,GAC9B,OAAO,CAAC,4BAA4B,CAAC,CAsGvC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC7C,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,cAAc,EACvB,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAiD7B"}
@@ -0,0 +1,334 @@
1
+ /**
2
+ * The acting principal by ID, and the target checked by ID.
3
+ *
4
+ * An actor and a target are identified by their stored IDs, never by a name.
5
+ * A name is a display label: it never selects a row and never authorises one.
6
+ *
7
+ * Motivating incident: an agent of organisation A named "eta", calling by name
8
+ * through a service account, completed, updated and deleted the task of
9
+ * organisation B's agent also named "eta" at ten task doors, because every door
10
+ * admitted the caller by comparing names. Two different agents shared a label;
11
+ * nothing compared their IDs.
12
+ *
13
+ * Two functions close that class:
14
+ *
15
+ * - `resolveActingPrincipal(credential, lookups)` turns a VERIFIED credential
16
+ * into `{ principalId, orgId, kind }` read from stored rows, or refuses.
17
+ * - `assertTargetBelongsTo(principal, target, lookups, opts)` admits a target
18
+ * only when its stored organisation ID (and owner ID, where the door is
19
+ * owner-only) equals the principal's resolved IDs.
20
+ *
21
+ * The fleet is the OPERATOR ORGANISATION: the organisation the consumer's
22
+ * `orgKindOf` adapter reports as `"operator"`, read from stored data at run
23
+ * time. No organisation ID is reserved or spelled in this package; an
24
+ * adapter that answers anything else, or nothing, means "not the fleet".
25
+ *
26
+ * RULING 5: membership of the operator org is ORDINARY membership. Its agents
27
+ * and persons resolve as `kind: "agent"` / `"person"` of that org and reach its
28
+ * rows only. Cross-org reach (`kind: "fleet"` + `fleetCrossOrg`) belongs to the
29
+ * operator org's SERVICE ACCOUNT alone; `reserved-fleet-scope` refuses a claim
30
+ * of that scope by any other credential, never plain membership.
31
+ *
32
+ * Pure functions over injected lookups: no database, no framework, no network.
33
+ * The consumer performs each indexed read by ID and passes the function in;
34
+ * every failure (throwing lookup, miss, malformed row, inactive row, wrong
35
+ * organisation) is a typed `IdentityRefusal`, never a default principal.
36
+ *
37
+ * @security This module verifies NOTHING about the credential itself. The IDs
38
+ * in a credential must come from the consumer's verification of what the
39
+ * caller presented (a bearer row, a person's token, the service secret). A
40
+ * client-supplied argument passed as a credential becomes the principal.
41
+ */
42
+ import { z } from "zod";
43
+ import { refusal } from "./identity-refusal.js";
44
+ // ---------------------------------------------------------------------------
45
+ // The credential: verified IDs only, no name field anywhere
46
+ // ---------------------------------------------------------------------------
47
+ /**
48
+ * A verified credential, in the package's vocabulary. Every identity field is
49
+ * an ID. The schemas are STRICT: a credential carrying any other key (an
50
+ * `agentName`, a `callerOrchestrator`, a `name`) is refused whole, so a name
51
+ * cannot be smuggled in beside an ID.
52
+ *
53
+ * - `agent`: an agent's own bearer, verified by the consumer (for example by
54
+ * `validatePresentedBearer`): the agent ID and the organisation the bearer
55
+ * row is stamped with.
56
+ * - `person`: a person's token, verified by the consumer: the stored person
57
+ * ID (the verified subject) and the organisation the token is bound to.
58
+ * - `service`: the service account, verified by the consumer. When it acts
59
+ * for an agent it names that agent BY ID (`actingForAgentId`); the agent
60
+ * is resolved within the service account's own organisation.
61
+ */
62
+ export const actingCredentialSchema = z.discriminatedUnion("kind", [
63
+ z.strictObject({
64
+ kind: z.literal("agent"),
65
+ agentId: z.string().min(1),
66
+ verifiedOrgId: z.string().min(1),
67
+ }),
68
+ z.strictObject({
69
+ kind: z.literal("person"),
70
+ personId: z.string().min(1),
71
+ verifiedOrgId: z.string().min(1),
72
+ }),
73
+ z.strictObject({
74
+ kind: z.literal("service"),
75
+ serviceAccountId: z.string().min(1),
76
+ actingForAgentId: z.string().min(1).optional(),
77
+ }),
78
+ ]);
79
+ // ---------------------------------------------------------------------------
80
+ // The stored rows the consumer's lookups return
81
+ // ---------------------------------------------------------------------------
82
+ /**
83
+ * Each row repeats its own ID, so a loose lookup (prefix match, wrong index)
84
+ * returning another row cannot become a principal. `active` is REQUIRED and
85
+ * must be `true`: an absent flag grants nothing. Extra fields (a display name)
86
+ * are allowed and ignored.
87
+ */
88
+ export const principalRowSchema = z.object({
89
+ id: z.string().min(1),
90
+ orgId: z.string().min(1).nullish(),
91
+ active: z.boolean(),
92
+ });
93
+ export const organisationRowSchema = z.object({
94
+ id: z.string().min(1),
95
+ active: z.boolean(),
96
+ });
97
+ function nonEmpty(value) {
98
+ return typeof value === "string" && value.length > 0;
99
+ }
100
+ function denied(reason, door, detail) {
101
+ return { ok: false, refusal: refusal("RBAC_DENIED", reason, door, detail) };
102
+ }
103
+ /**
104
+ * Reads one principal row BY ID and checks it: the lookup is supplied and does
105
+ * not throw, the row exists, is well formed, repeats the ID asked for, and is
106
+ * active. The lookup's own error text is never surfaced.
107
+ */
108
+ async function loadPrincipalRow(lookup, args, expectedId, what, door) {
109
+ if (typeof lookup !== "function") {
110
+ return denied("principal-lookup-failed", door, `No lookup was supplied for the ${what}.`);
111
+ }
112
+ let raw;
113
+ try {
114
+ raw = await lookup(...args);
115
+ }
116
+ catch {
117
+ return denied("principal-lookup-failed", door, `The ${what} could not be read, so none is resolved.`);
118
+ }
119
+ if (raw === null || raw === undefined) {
120
+ return denied("principal-not-found", door, `No ${what} has this ID.`);
121
+ }
122
+ const parsed = principalRowSchema.safeParse(raw);
123
+ if (!parsed.success || parsed.data.id !== expectedId) {
124
+ return denied("principal-record-invalid", door, `The ${what} record is not well formed.`);
125
+ }
126
+ if (parsed.data.active !== true) {
127
+ return denied("principal-inactive", door, `The ${what} is not active.`);
128
+ }
129
+ return { ok: true, row: parsed.data };
130
+ }
131
+ /**
132
+ * Reads the stored kind of an organisation. Refusal by default: a missing or
133
+ * throwing adapter refuses; a miss or any answer other than exactly
134
+ * `"operator"` / `"client"` is `null`, which is never the fleet.
135
+ */
136
+ async function loadOrgKind(lookups, orgId, door) {
137
+ const lookup = lookups?.orgKindOf;
138
+ if (typeof lookup !== "function") {
139
+ return denied("principal-lookup-failed", door, "No lookup was supplied for the organisation kind.");
140
+ }
141
+ let raw;
142
+ try {
143
+ raw = await lookup(orgId);
144
+ }
145
+ catch {
146
+ return denied("principal-lookup-failed", door, "The organisation kind could not be read, so none is resolved.");
147
+ }
148
+ return { ok: true, kind: raw === "operator" || raw === "client" ? raw : null };
149
+ }
150
+ /** Every organisation, the operator org included, must exist and be active. */
151
+ async function checkOrganisation(orgId, lookups, door) {
152
+ const lookup = lookups.organisationById;
153
+ if (typeof lookup !== "function") {
154
+ return denied("principal-lookup-failed", door, "No lookup was supplied for the organisation.");
155
+ }
156
+ let raw;
157
+ try {
158
+ raw = await lookup(orgId);
159
+ }
160
+ catch {
161
+ return denied("principal-lookup-failed", door, "The organisation could not be read, so none is resolved.");
162
+ }
163
+ const parsed = organisationRowSchema.safeParse(raw);
164
+ if (!parsed.success || parsed.data.id !== orgId || parsed.data.active !== true) {
165
+ return denied("organisation-not-active", door, "The organisation is not mapped or not active.");
166
+ }
167
+ return null;
168
+ }
169
+ function served(principal) {
170
+ return { ok: true, principal };
171
+ }
172
+ /**
173
+ * Resolves the acting principal from a VERIFIED credential to stored IDs, or
174
+ * refuses. Refusal by default: a credential claiming the fleet kind
175
+ * (`reserved-fleet-scope`), a credential that does not parse (including one
176
+ * carrying any name field), a missing or throwing lookup, a miss, a malformed
177
+ * or inactive row, an unstamped row and an inactive organisation are all
178
+ * refused. Nothing is ever resolved by a name, and nothing falls back to a
179
+ * master principal.
180
+ *
181
+ * - agent: the agent row by `agentId`; its stored org must equal the org
182
+ * the credential was verified for. An agent of the operator org resolves
183
+ * as an ordinary `kind: "agent"` of that org (RULING 5).
184
+ * - person: the person row by (`personId`, `verifiedOrgId`); it must be
185
+ * stamped with that org. A person of the operator org resolves as an
186
+ * ordinary `kind: "person"` of that org (RULING 5).
187
+ * - service: the service-account row by `serviceAccountId`. Alone, it acts
188
+ * as itself (`kind: "service"`, or `kind: "fleet"` when `orgKindOf` reports
189
+ * its stored org as `"operator"`). With `actingForAgentId`, the agent row is read by
190
+ * ID and must be stamped with the service account's own org; the principal
191
+ * is that agent, with `viaServiceAccountId` recording the carrier.
192
+ */
193
+ export async function resolveActingPrincipal(credential, lookups, door = "resolveActingPrincipal") {
194
+ if (credential !== null &&
195
+ typeof credential === "object" &&
196
+ credential.kind === "fleet") {
197
+ return denied("reserved-fleet-scope", door, "The fleet scope is held only by the operator organisation's service account; no credential claims it.");
198
+ }
199
+ const parsed = actingCredentialSchema.safeParse(credential);
200
+ if (!parsed.success) {
201
+ return denied("credential-invalid", door, "The credential does not identify a principal by ID.");
202
+ }
203
+ const cred = parsed.data;
204
+ const look = lookups ?? {};
205
+ if (cred.kind === "agent" || cred.kind === "person") {
206
+ // The org's kind is read so a missing or throwing adapter refuses here as
207
+ // on every path; an operator-org member is NOT refused (RULING 5).
208
+ const credKind = await loadOrgKind(look, cred.verifiedOrgId, door);
209
+ if (!credKind.ok)
210
+ return credKind;
211
+ const loaded = cred.kind === "agent"
212
+ ? await loadPrincipalRow(look.agentById, [cred.agentId], cred.agentId, "agent", door)
213
+ : await loadPrincipalRow(look.personById, [cred.personId, cred.verifiedOrgId], cred.personId, "person", door);
214
+ if (!loaded.ok)
215
+ return loaded;
216
+ const rowOrg = loaded.row.orgId;
217
+ if (!nonEmpty(rowOrg)) {
218
+ return denied("no-verified-organisation", door, `The ${cred.kind} is stamped with no organisation.`);
219
+ }
220
+ if (rowOrg !== cred.verifiedOrgId) {
221
+ return denied("other-organisation", door, `The ${cred.kind} belongs to another organisation than its credential.`);
222
+ }
223
+ const orgRefusal = await checkOrganisation(rowOrg, look, door);
224
+ if (orgRefusal !== null)
225
+ return orgRefusal;
226
+ return served({ principalId: loaded.row.id, orgId: rowOrg, kind: cred.kind });
227
+ }
228
+ // service account
229
+ const svc = await loadPrincipalRow(look.serviceAccountById, [cred.serviceAccountId], cred.serviceAccountId, "service account", door);
230
+ if (!svc.ok)
231
+ return svc;
232
+ const svcOrg = svc.row.orgId;
233
+ if (!nonEmpty(svcOrg)) {
234
+ return denied("no-verified-organisation", door, "The service account is stamped with no organisation.");
235
+ }
236
+ const svcKind = await loadOrgKind(look, svcOrg, door);
237
+ if (!svcKind.ok)
238
+ return svcKind;
239
+ const orgRefusal = await checkOrganisation(svcOrg, look, door);
240
+ if (orgRefusal !== null)
241
+ return orgRefusal;
242
+ if (cred.actingForAgentId === undefined) {
243
+ return served({
244
+ principalId: svc.row.id,
245
+ orgId: svcOrg,
246
+ kind: svcKind.kind === "operator" ? "fleet" : "service",
247
+ });
248
+ }
249
+ const agent = await loadPrincipalRow(look.agentById, [cred.actingForAgentId], cred.actingForAgentId, "agent", door);
250
+ if (!agent.ok)
251
+ return agent;
252
+ if (agent.row.orgId !== svcOrg) {
253
+ return denied("acting-agent-other-organisation", door, "The service account may act only for an agent of its own organisation.");
254
+ }
255
+ return served({
256
+ principalId: agent.row.id,
257
+ orgId: svcOrg,
258
+ kind: "agent",
259
+ viaServiceAccountId: svc.row.id,
260
+ });
261
+ }
262
+ // ---------------------------------------------------------------------------
263
+ // assertTargetBelongsTo
264
+ // ---------------------------------------------------------------------------
265
+ /**
266
+ * Admits a target only by comparing its STORED IDs with the principal's
267
+ * resolved IDs, byte for byte. No name field is read; there is none to read.
268
+ *
269
+ * Whether an organisation is the operator org (the fleet) is read from
270
+ * `lookups.orgKindOf`; a missing or throwing adapter refuses.
271
+ *
272
+ * - An absent principal, or one with an empty ID, is refused.
273
+ * - A `kind: "fleet"` principal outside the operator org is refused, and so
274
+ * is a `kind: "service"` principal inside it (the operator org's service
275
+ * account is the fleet). An agent or person of the operator org is an
276
+ * ordinary member of it (RULING 5).
277
+ * - An unstamped target (no `orgId`) is refused to EVERY principal, the
278
+ * fleet principal included. No right is inferred from an absence: a fleet
279
+ * row carries the operator org's ID explicitly, and a row with no
280
+ * organisation is never treated as a master row.
281
+ * - An operator-org row is refused to every client principal.
282
+ * - Otherwise the target's `orgId` must equal the principal's. A fleet
283
+ * principal reaches a client organisation's row only when the door sets
284
+ * `fleetCrossOrg` (a master export) AND `orgKindOf` reports that
285
+ * organisation as `"client"`; an unknown organisation is refused. Any
286
+ * other principal reaching across organisations under `fleetCrossOrg`
287
+ * claims the fleet scope and is refused `reserved-fleet-scope`.
288
+ * - `ownerOnly`: the target's `ownerId` must also equal `principalId`; an
289
+ * absent owner is refused.
290
+ */
291
+ export async function assertTargetBelongsTo(principal, target, lookups, opts = {}) {
292
+ const door = opts.door ?? "assertTargetBelongsTo";
293
+ if (principal === null ||
294
+ typeof principal !== "object" ||
295
+ !nonEmpty(principal.principalId) ||
296
+ !nonEmpty(principal.orgId)) {
297
+ return denied("credential-invalid", door, "No resolved principal stands behind this call.");
298
+ }
299
+ const principalKind = await loadOrgKind(lookups, principal.orgId, door);
300
+ if (!principalKind.ok)
301
+ return principalKind;
302
+ const inFleet = principalKind.kind === "operator";
303
+ const isFleet = principal.kind === "fleet";
304
+ if ((isFleet && !inFleet) || (inFleet && principal.kind === "service")) {
305
+ return denied("reserved-fleet-scope", door, "The principal does not hold the fleet scope.");
306
+ }
307
+ const targetOrg = target?.orgId;
308
+ if (!nonEmpty(targetOrg)) {
309
+ return denied("target-unstamped", door, "The target carries no organisation, so it is not reachable.");
310
+ }
311
+ if (targetOrg !== principal.orgId) {
312
+ const targetKind = await loadOrgKind(lookups, targetOrg, door);
313
+ if (!targetKind.ok)
314
+ return targetKind;
315
+ if (targetKind.kind === "operator") {
316
+ return denied("reserved-fleet-scope", door, "The target is in the fleet scope.");
317
+ }
318
+ if (!isFleet && opts.fleetCrossOrg === true) {
319
+ return denied("reserved-fleet-scope", door, "Cross-organisation reach is held only by the operator organisation's service account.");
320
+ }
321
+ const masterExport = isFleet && opts.fleetCrossOrg === true && targetKind.kind === "client";
322
+ if (!masterExport) {
323
+ return denied("target-other-organisation", door, "The target belongs to another organisation.");
324
+ }
325
+ }
326
+ if (opts.ownerOnly === true) {
327
+ const owner = target?.ownerId;
328
+ if (!nonEmpty(owner) || owner !== principal.principalId) {
329
+ return denied("target-owner-mismatch", door, "Only the target's owner may act on it.");
330
+ }
331
+ }
332
+ return { ok: true };
333
+ }
334
+ //# sourceMappingURL=principal-by-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principal-by-id.js","sourceRoot":"","sources":["../src/principal-by-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAwB,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEtE,8EAA8E;AAC9E,4DAA4D;AAC5D,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACjE,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CA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C,IAAI,KAAK,KAAK,SAAS,CAAC,WAAW,EAAE,CAAC;YACxD,OAAO,MAAM,CAAC,uBAAuB,EAAE,IAAI,EAAE,wCAAwC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -119,6 +119,13 @@ export type GrantFieldDeclaration = readonly string[];
119
119
  * Substring matches that don't fall on a '/' boundary are explicitly rejected
120
120
  * (e.g. namespace="orchestrator/alphabet" does NOT match prefix
121
121
  * "orchestrator/alpha"). This avoids the classic prefix-isolation bypass.
122
+ *
123
+ * @deprecated Since 0.11.0. A `createdBy` name matched against
124
+ * `fromAllowList` selects the row, which backend standard R-53 clause 1
125
+ * forbids: a name never selects or authorises a row. Use
126
+ * `resolveActingPrincipal` and `assertTargetBelongsTo`, which compare stored
127
+ * IDs. Behaviour unchanged; it stays exported until consumers migrate off it,
128
+ * and is removed in a major release.
122
129
  */
123
130
  export declare function passesScopeFilter<T extends ScopeFilterable>(oauthCtx: OAuthCtx, row: T, grantFields?: GrantFieldDeclaration): boolean;
124
131
  /**
@@ -126,6 +133,12 @@ export declare function passesScopeFilter<T extends ScopeFilterable>(oauthCtx: O
126
133
  *
127
134
  * `grantFields` — see `passesScopeFilter`. Defaults to `[]` (0.4.0-identical
128
135
  * behaviour).
136
+ *
137
+ * @deprecated Since 0.11.0. It selects rows through `passesScopeFilter`,
138
+ * where a `createdBy` name selects the row, which backend standard R-53
139
+ * clause 1 forbids. Use `resolveActingPrincipal` and `assertTargetBelongsTo`,
140
+ * which compare stored IDs. Behaviour unchanged; it stays exported until
141
+ * consumers migrate off it, and is removed in a major release.
129
142
  */
130
143
  export declare function scopeFilterList<T extends ScopeFilterable>(oauthCtx: OAuthCtx, rows: T[], grantFields?: GrantFieldDeclaration): T[];
131
144
  /**
@@ -135,6 +148,12 @@ export declare function scopeFilterList<T extends ScopeFilterable>(oauthCtx: OAu
135
148
  *
136
149
  * `grantFields` — see `passesScopeFilter`. Defaults to `[]` (0.4.0-identical
137
150
  * behaviour).
151
+ *
152
+ * @deprecated Since 0.11.0. It admits the row through `passesScopeFilter`,
153
+ * where a `createdBy` name selects the row, which backend standard R-53
154
+ * clause 1 forbids. Use `resolveActingPrincipal` and `assertTargetBelongsTo`,
155
+ * which compare stored IDs. Behaviour unchanged; it stays exported until
156
+ * consumers migrate off it, and is removed in a major release.
138
157
  */
139
158
  export declare function scopeFilterGet<T extends ScopeFilterable>(oauthCtx: OAuthCtx, row: T | null | undefined, grantFields?: GrantFieldDeclaration): T | null;
140
159
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"scope-filter.d.ts","sourceRoot":"","sources":["../src/scope-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAKjC,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjF;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAIpD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,MAAM,EAAE,CAAC;AActD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,EACzD,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,CAAC,EACN,WAAW,GAAE,qBAAuC,GACnD,OAAO,CAeT;AAED;;;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,EACN,WAAW,GAAE,qBAAuC,GACnD,OAAO,CAeT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,eAAe,EACvD,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,CAAC,EAAE,EACT,WAAW,GAAE,qBAAuC,GACnD,CAAC,EAAE,CAGL;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,eAAe,EACtD,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACzB,WAAW,GAAE,qBAAuC,GACnD,CAAC,GAAG,IAAI,CAIV;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAGtD"}
@@ -125,6 +125,13 @@ function grantFieldMatches(value, fromAllowList) {
125
125
  * Substring matches that don't fall on a '/' boundary are explicitly rejected
126
126
  * (e.g. namespace="orchestrator/alphabet" does NOT match prefix
127
127
  * "orchestrator/alpha"). This avoids the classic prefix-isolation bypass.
128
+ *
129
+ * @deprecated Since 0.11.0. A `createdBy` name matched against
130
+ * `fromAllowList` selects the row, which backend standard R-53 clause 1
131
+ * forbids: a name never selects or authorises a row. Use
132
+ * `resolveActingPrincipal` and `assertTargetBelongsTo`, which compare stored
133
+ * IDs. Behaviour unchanged; it stays exported until consumers migrate off it,
134
+ * and is removed in a major release.
128
135
  */
129
136
  export function passesScopeFilter(oauthCtx, row, grantFields = NO_GRANT_FIELDS) {
130
137
  assertOauthCtx(oauthCtx);
@@ -151,6 +158,12 @@ export function passesScopeFilter(oauthCtx, row, grantFields = NO_GRANT_FIELDS)
151
158
  *
152
159
  * `grantFields` — see `passesScopeFilter`. Defaults to `[]` (0.4.0-identical
153
160
  * behaviour).
161
+ *
162
+ * @deprecated Since 0.11.0. It selects rows through `passesScopeFilter`,
163
+ * where a `createdBy` name selects the row, which backend standard R-53
164
+ * clause 1 forbids. Use `resolveActingPrincipal` and `assertTargetBelongsTo`,
165
+ * which compare stored IDs. Behaviour unchanged; it stays exported until
166
+ * consumers migrate off it, and is removed in a major release.
154
167
  */
155
168
  export function scopeFilterList(oauthCtx, rows, grantFields = NO_GRANT_FIELDS) {
156
169
  assertOauthCtx(oauthCtx);
@@ -163,6 +176,12 @@ export function scopeFilterList(oauthCtx, rows, grantFields = NO_GRANT_FIELDS) {
163
176
  *
164
177
  * `grantFields` — see `passesScopeFilter`. Defaults to `[]` (0.4.0-identical
165
178
  * behaviour).
179
+ *
180
+ * @deprecated Since 0.11.0. It admits the row through `passesScopeFilter`,
181
+ * where a `createdBy` name selects the row, which backend standard R-53
182
+ * clause 1 forbids. Use `resolveActingPrincipal` and `assertTargetBelongsTo`,
183
+ * which compare stored IDs. Behaviour unchanged; it stays exported until
184
+ * consumers migrate off it, and is removed in a major release.
166
185
  */
167
186
  export function scopeFilterGet(oauthCtx, row, grantFields = NO_GRANT_FIELDS) {
168
187
  assertOauthCtx(oauthCtx);
@@ -1 +1 @@
1
- {"version":3,"file":"scope-filter.js","sourceRoot":"","sources":["../src/scope-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAa;IAC3C,KAAK,EAAE,QAAQ;IACf,aAAa,EAAE,CAAC,GAAG,CAAC;IACpB,qBAAqB,EAAE,EAAE;IACzB,sBAAsB,EAAE,EAAE;CAC3B,CAAC;AAEF,SAAS,cAAc,CAAC,QAAkB;IACxC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CACjB,2EAA2E;YACzE,0EAA0E,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,MAAc;IACtE,OAAO,SAAS,KAAK,MAAM,IAAI,SAAS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C,IAAI,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAa;IAC3C,cAAc,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantageos/cloud-identity",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Framework-agnostic identity + scope-filter primitives for VantagePeers Cloud (multi-tenant MCP).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -77,6 +77,10 @@
77
77
  "./secret-compare-sync": {
78
78
  "types": "./dist/secret-compare-sync.d.ts",
79
79
  "import": "./dist/secret-compare-sync.js"
80
+ },
81
+ "./principal-by-id": {
82
+ "types": "./dist/principal-by-id.d.ts",
83
+ "import": "./dist/principal-by-id.js"
80
84
  }
81
85
  },
82
86
  "files": [