@astram/core 1.2.0 → 1.4.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/dist/admin/admin-service.d.ts +15 -7
- package/dist/admin/admin-service.d.ts.map +1 -1
- package/dist/admin/admin-service.js +18 -10
- package/dist/admin/admin-service.js.map +1 -1
- package/dist/admin/command/grants.d.ts.map +1 -1
- package/dist/admin/command/grants.js +2 -5
- package/dist/admin/command/grants.js.map +1 -1
- package/dist/admin/command/invitations.d.ts.map +1 -1
- package/dist/admin/command/invitations.js +3 -6
- package/dist/admin/command/invitations.js.map +1 -1
- package/dist/admin/command/permissions.d.ts.map +1 -1
- package/dist/admin/command/permissions.js +2 -6
- package/dist/admin/command/permissions.js.map +1 -1
- package/dist/admin/command/pipeline.d.ts +5 -2
- package/dist/admin/command/pipeline.d.ts.map +1 -1
- package/dist/admin/command/pipeline.js +6 -3
- package/dist/admin/command/pipeline.js.map +1 -1
- package/dist/admin/command/policies.d.ts.map +1 -1
- package/dist/admin/command/policies.js +7 -22
- package/dist/admin/command/policies.js.map +1 -1
- package/dist/admin/command/service-accounts.d.ts +17 -11
- package/dist/admin/command/service-accounts.d.ts.map +1 -1
- package/dist/admin/command/service-accounts.js +18 -24
- package/dist/admin/command/service-accounts.js.map +1 -1
- package/dist/admin/command/service.d.ts +5 -1
- package/dist/admin/command/service.d.ts.map +1 -1
- package/dist/admin/command/service.js +3 -5
- package/dist/admin/command/service.js.map +1 -1
- package/dist/admin/command/tiers.d.ts.map +1 -1
- package/dist/admin/command/tiers.js.map +1 -1
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +3 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/ports.d.ts.map +1 -1
- package/dist/admin/ports.js.map +1 -1
- package/dist/admin/query/catalog.d.ts.map +1 -1
- package/dist/admin/query/catalog.js +5 -13
- package/dist/admin/query/catalog.js.map +1 -1
- package/dist/admin/query/index.d.ts +2 -2
- package/dist/admin/query/index.d.ts.map +1 -1
- package/dist/admin/query/index.js +2 -2
- package/dist/admin/query/index.js.map +1 -1
- package/dist/admin/safeguards-impl.d.ts.map +1 -1
- package/dist/admin/safeguards-impl.js +3 -7
- package/dist/admin/safeguards-impl.js.map +1 -1
- package/dist/admin/safeguards.d.ts.map +1 -1
- package/dist/admin/safeguards.js.map +1 -1
- package/dist/admin/types.d.ts +12 -0
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/audit/audit-recorder.d.ts.map +1 -1
- package/dist/audit/audit-recorder.js +1 -2
- package/dist/audit/audit-recorder.js.map +1 -1
- package/dist/audit/sensitive.d.ts.map +1 -1
- package/dist/audit/sensitive.js.map +1 -1
- package/dist/audit/walk.d.ts.map +1 -1
- package/dist/audit/walk.js +1 -4
- package/dist/audit/walk.js.map +1 -1
- package/dist/authentication/authenticator.d.ts.map +1 -1
- package/dist/authentication/authenticator.js.map +1 -1
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/index.d.ts.map +1 -1
- package/dist/authentication/index.js +2 -0
- package/dist/authentication/index.js.map +1 -1
- package/dist/authentication/service-account-authenticator.d.ts +82 -0
- package/dist/authentication/service-account-authenticator.d.ts.map +1 -0
- package/dist/authentication/service-account-authenticator.js +72 -0
- package/dist/authentication/service-account-authenticator.js.map +1 -0
- package/dist/authentication/totp.d.ts.map +1 -1
- package/dist/authentication/totp.js.map +1 -1
- package/dist/authorization/cross-tenant/grant-evaluator.d.ts.map +1 -1
- package/dist/authorization/cross-tenant/grant-evaluator.js.map +1 -1
- package/dist/authorization/decision-authority.d.ts +1 -1
- package/dist/authorization/decision-authority.d.ts.map +1 -1
- package/dist/authorization/decision-authority.js +5 -6
- package/dist/authorization/decision-authority.js.map +1 -1
- package/dist/authorization/default-gates.d.ts.map +1 -1
- package/dist/authorization/default-gates.js.map +1 -1
- package/dist/authorization/delegation/operation-identity.d.ts.map +1 -1
- package/dist/authorization/delegation/operation-identity.js.map +1 -1
- package/dist/authorization/errors.d.ts.map +1 -1
- package/dist/authorization/errors.js.map +1 -1
- package/dist/authorization/gates/object-type.d.ts +2 -2
- package/dist/authorization/gates/object-type.d.ts.map +1 -1
- package/dist/authorization/gates/object-type.js +5 -7
- package/dist/authorization/gates/object-type.js.map +1 -1
- package/dist/authorization/gates/wiring.d.ts.map +1 -1
- package/dist/authorization/gates/wiring.js.map +1 -1
- package/dist/authorization/ports.d.ts +17 -0
- package/dist/authorization/ports.d.ts.map +1 -1
- package/dist/authorization/reason-codes.js.map +1 -1
- package/dist/authorization/record/owner-baseline.d.ts.map +1 -1
- package/dist/authorization/record/owner-baseline.js +1 -3
- package/dist/authorization/record/owner-baseline.js.map +1 -1
- package/dist/authorization/record/permit-tier.d.ts.map +1 -1
- package/dist/authorization/record/permit-tier.js.map +1 -1
- package/dist/authorization/record/shares.d.ts.map +1 -1
- package/dist/authorization/record/shares.js.map +1 -1
- package/dist/encryption/encryption-service.d.ts +63 -0
- package/dist/encryption/encryption-service.d.ts.map +1 -0
- package/dist/encryption/encryption-service.js +229 -0
- package/dist/encryption/encryption-service.js.map +1 -0
- package/dist/encryption/index.d.ts +17 -0
- package/dist/encryption/index.d.ts.map +1 -0
- package/dist/encryption/index.js +15 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/encryption/ports.d.ts +88 -0
- package/dist/encryption/ports.d.ts.map +1 -0
- package/dist/encryption/ports.js +18 -0
- package/dist/encryption/ports.js.map +1 -0
- package/dist/identity/broker.d.ts.map +1 -1
- package/dist/identity/broker.js +2 -4
- package/dist/identity/broker.js.map +1 -1
- package/dist/identity/internal-adapter.d.ts.map +1 -1
- package/dist/identity/internal-adapter.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata/completeness.d.ts.map +1 -1
- package/dist/metadata/completeness.js +2 -2
- package/dist/metadata/completeness.js.map +1 -1
- package/dist/metadata/dependencies.d.ts.map +1 -1
- package/dist/metadata/dependencies.js.map +1 -1
- package/dist/metadata/index.d.ts +19 -0
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +24 -0
- package/dist/metadata/index.js.map +1 -1
- package/dist/metadata/registry.d.ts.map +1 -1
- package/dist/metadata/registry.js +24 -0
- package/dist/metadata/registry.js.map +1 -1
- package/dist/risk/risk-engine.d.ts.map +1 -1
- package/dist/risk/risk-engine.js +1 -3
- package/dist/risk/risk-engine.js.map +1 -1
- package/dist/risk/signals.d.ts.map +1 -1
- package/dist/risk/signals.js +1 -2
- package/dist/risk/signals.js.map +1 -1
- package/dist/risk/thresholds.d.ts.map +1 -1
- package/dist/risk/thresholds.js.map +1 -1
- package/dist/secrets/index.d.ts +15 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +14 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/ports.d.ts +45 -0
- package/dist/secrets/ports.d.ts.map +1 -0
- package/dist/secrets/ports.js +26 -0
- package/dist/secrets/ports.js.map +1 -0
- package/dist/secrets/resolve.d.ts +29 -0
- package/dist/secrets/resolve.d.ts.map +1 -0
- package/dist/secrets/resolve.js +49 -0
- package/dist/secrets/resolve.js.map +1 -0
- package/dist/session/lifetimes.d.ts.map +1 -1
- package/dist/session/lifetimes.js.map +1 -1
- package/dist/session/session-authority.d.ts.map +1 -1
- package/dist/session/session-authority.js.map +1 -1
- package/dist-cjs/admin/admin-service.js +18 -10
- package/dist-cjs/admin/command/grants.js +2 -5
- package/dist-cjs/admin/command/invitations.js +3 -6
- package/dist-cjs/admin/command/permissions.js +2 -6
- package/dist-cjs/admin/command/pipeline.js +6 -3
- package/dist-cjs/admin/command/policies.js +7 -22
- package/dist-cjs/admin/command/service-accounts.js +18 -24
- package/dist-cjs/admin/command/service.js +2 -4
- package/dist-cjs/admin/index.js +3 -2
- package/dist-cjs/admin/query/catalog.js +5 -13
- package/dist-cjs/admin/safeguards-impl.js +3 -7
- package/dist-cjs/audit/audit-recorder.js +1 -2
- package/dist-cjs/audit/walk.js +1 -4
- package/dist-cjs/authentication/index.js +2 -0
- package/dist-cjs/authentication/service-account-authenticator.js +76 -0
- package/dist-cjs/authorization/decision-authority.js +5 -6
- package/dist-cjs/authorization/gates/object-type.js +4 -6
- package/dist-cjs/authorization/record/owner-baseline.js +1 -3
- package/dist-cjs/encryption/encryption-service.js +234 -0
- package/dist-cjs/encryption/index.js +20 -0
- package/dist-cjs/encryption/ports.js +18 -0
- package/dist-cjs/identity/broker.js +1 -3
- package/dist-cjs/index.js +2 -0
- package/dist-cjs/metadata/completeness.js +2 -2
- package/dist-cjs/metadata/index.js +25 -0
- package/dist-cjs/metadata/registry.js +24 -0
- package/dist-cjs/risk/risk-engine.js +1 -3
- package/dist-cjs/risk/signals.js +1 -2
- package/dist-cjs/secrets/index.js +21 -0
- package/dist-cjs/secrets/ports.js +29 -0
- package/dist-cjs/secrets/resolve.js +54 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifetimes.d.ts","sourceRoot":"","sources":["../../src/session/lifetimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,EAAE,qBAItC,CAAC;AAOH;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"lifetimes.d.ts","sourceRoot":"","sources":["../../src/session/lifetimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,EAAE,qBAItC,CAAC;AAOH;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CA6BhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifetimes.js","sourceRoot":"","sources":["../../src/session/lifetimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qEAAqE;AACrE,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAiBnC,wEAAwE;AACxE,MAAM,CAAC,MAAM,yBAAyB,GAA0B,MAAM,CAAC,MAAM,CAAC;IAC5E,WAAW,EAAE,EAAE,GAAG,SAAS;IAC3B,aAAa,EAAE,EAAE,GAAG,MAAM;IAC1B,oBAAoB,EAAE,EAAE,GAAG,MAAM;CAClC,CAAC,CAAC;AAEH,gEAAgE;AAChE,SAAS,kBAAkB,CAAC,CAAU;IACpC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,
|
|
1
|
+
{"version":3,"file":"lifetimes.js","sourceRoot":"","sources":["../../src/session/lifetimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qEAAqE;AACrE,MAAM,SAAS,GAAG,MAAM,CAAC;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AC;QACzC,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-authority.d.ts","sourceRoot":"","sources":["../../src/session/session-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"session-authority.d.ts","sourceRoot":"","sources":["../../src/session/session-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,KAAK,EAAW,gBAAgB,EAAuC,MAAM,YAAY,CAAC;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C;AAgVD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAqBjC;AAED,uFAAuF;AACvF,MAAM,WAAW,6BAA6B;IAC5C,mFAAmF;IACnF,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IACzC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,sDAAsD;IACtD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,sDAAsD;IACtD,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAC3C,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpD,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,gBAAgB,CAW/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-authority.js","sourceRoot":"","sources":["../../src/session/session-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;
|
|
1
|
+
{"version":3,"file":"session-authority.js","sourceRoot":"","sources":["../../src/session/session-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWlD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAE1D,8EAA8E;AAC9E,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C;QACE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,iFAAiF;AACjF,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC,wFAAwF;AACxF,MAAM,oBAAoB,GAAY,IAAI,CAAC;AAE3C,kFAAkF;AAClF,SAAS,MAAM,CAAC,SAAiB;IAC/B,OAAO,eAAe,SAAS,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,oBAAoB;IAEL;IACA;IACA;IACA;IACA;IACA;IACA;IAPnB,YACmB,WAA+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 async function runCommandPipeline(step, decide, blastDeps) {
|
|
|
68
68
|
return { ok: true, value };
|
|
69
69
|
}
|
|
70
70
|
// ---------------------------------------------------------------------------
|
|
71
|
-
//
|
|
71
|
+
// Stub factories — fail-closed skeletons (deprecated; see the real composers).
|
|
72
72
|
// ---------------------------------------------------------------------------
|
|
73
73
|
/**
|
|
74
74
|
* The fail-closed default a query method throws when it has no implementation yet.
|
|
@@ -76,16 +76,20 @@ async function runCommandPipeline(step, decide, blastDeps) {
|
|
|
76
76
|
* rather than silently returning "no data" (which could read as "no access").
|
|
77
77
|
*/
|
|
78
78
|
function notImplementedQuery(method) {
|
|
79
|
-
throw new Error(`[admin-query] ${method} is not implemented
|
|
79
|
+
throw new Error(`[admin-query] ${method} is not implemented in the fail-closed createAdminQueryService stub — use composeAdminQueryService(deps) for the real query service.`);
|
|
80
80
|
}
|
|
81
81
|
/** The fail-closed default a command method returns when unimplemented — a DENY. */
|
|
82
82
|
function notImplementedCommand() {
|
|
83
83
|
return { ok: false, reason: 'not_implemented' };
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* Fail-closed STUB of the admin QUERY service: every method throws
|
|
87
|
+
* `not implemented`. It is kept only as the typed fail-closed default of the
|
|
88
|
+
* frozen contract; it never serves data.
|
|
89
|
+
*
|
|
90
|
+
* @deprecated Use `composeAdminQueryService(deps)` (`admin/query/index.ts`,
|
|
91
|
+
* re-exported from `@astram/core`) — the real query service. This stub stays
|
|
92
|
+
* exported for contract compatibility and will not gain an implementation.
|
|
89
93
|
*/
|
|
90
94
|
function createAdminQueryService(deps) {
|
|
91
95
|
// Captured for the team implementations; unused in the fail-closed skeleton.
|
|
@@ -101,7 +105,7 @@ function createAdminQueryService(deps) {
|
|
|
101
105
|
return notImplementedQuery('explain');
|
|
102
106
|
},
|
|
103
107
|
async simulate() {
|
|
104
|
-
//
|
|
108
|
+
// The real simulate (composeAdminQueryService) forwards to deps.decide.decide(...).
|
|
105
109
|
return notImplementedQuery('simulate');
|
|
106
110
|
},
|
|
107
111
|
async auditView() {
|
|
@@ -110,10 +114,14 @@ function createAdminQueryService(deps) {
|
|
|
110
114
|
};
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
+
* Fail-closed STUB of the admin COMMAND service: every method returns a
|
|
118
|
+
* `not_implemented` DENY. It is kept only as the typed fail-closed default of
|
|
119
|
+
* the frozen contract; it never mutates anything.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Use `createRealAdminCommandService(deps)` (`admin/command/service.ts`,
|
|
122
|
+
* re-exported from `@astram/core`) — the real command service with the
|
|
123
|
+
* §11.3 safeguards. This stub stays exported for contract compatibility and will
|
|
124
|
+
* not gain an implementation.
|
|
117
125
|
*/
|
|
118
126
|
function createAdminCommandService(deps) {
|
|
119
127
|
// Captured for the team implementations; unused in the fail-closed skeleton.
|
|
@@ -103,9 +103,7 @@ function makeGrant(deps) {
|
|
|
103
103
|
principalId: command.principalId,
|
|
104
104
|
permissionKey: command.permissionKey,
|
|
105
105
|
actions: command.actions,
|
|
106
|
-
...(command.conditions !== undefined
|
|
107
|
-
? { conditions: command.conditions }
|
|
108
|
-
: {}),
|
|
106
|
+
...(command.conditions !== undefined ? { conditions: command.conditions } : {}),
|
|
109
107
|
tenantId: command.tenantId,
|
|
110
108
|
});
|
|
111
109
|
},
|
|
@@ -161,8 +159,7 @@ function makeRevoke(deps) {
|
|
|
161
159
|
if (existing === null) {
|
|
162
160
|
return { ok: false, reason: 'not_found' };
|
|
163
161
|
}
|
|
164
|
-
if (!(0, reason_codes_js_1.strictTrue)(mutation.admin.isRoot) &&
|
|
165
|
-
existing.tenantId !== mutation.targetTenantId) {
|
|
162
|
+
if (!(0, reason_codes_js_1.strictTrue)(mutation.admin.isRoot) && existing.tenantId !== mutation.targetTenantId) {
|
|
166
163
|
return {
|
|
167
164
|
ok: false,
|
|
168
165
|
reason: 'unilateral_cross_tenant',
|
|
@@ -154,8 +154,7 @@ function makeTransitionInvitation(deps) {
|
|
|
154
154
|
mutation,
|
|
155
155
|
hasConfirmToken: true, // transitions are not classified destructive per se
|
|
156
156
|
validate: async () => {
|
|
157
|
-
if (typeof command.invitationId !== 'string' ||
|
|
158
|
-
command.invitationId.length === 0) {
|
|
157
|
+
if (typeof command.invitationId !== 'string' || command.invitationId.length === 0) {
|
|
159
158
|
return { ok: false, reason: 'not_found' };
|
|
160
159
|
}
|
|
161
160
|
invitation = await deps.invitationStore.get(command.invitationId);
|
|
@@ -199,8 +198,7 @@ function makeTransitionInvitation(deps) {
|
|
|
199
198
|
const granteeCanAccept = resolvedGrantee !== undefined &&
|
|
200
199
|
resolvedGrantee.length > 0 &&
|
|
201
200
|
resolvedGrantee === mutation.admin.tenantId;
|
|
202
|
-
if (!(0, reason_codes_js_1.strictTrue)(mutation.admin.isRoot) &&
|
|
203
|
-
!granteeCanAccept) {
|
|
201
|
+
if (!(0, reason_codes_js_1.strictTrue)(mutation.admin.isRoot) && !granteeCanAccept) {
|
|
204
202
|
return {
|
|
205
203
|
ok: false,
|
|
206
204
|
reason: 'unilateral_cross_tenant',
|
|
@@ -210,8 +208,7 @@ function makeTransitionInvitation(deps) {
|
|
|
210
208
|
// ACCEPT activates the grant WITHIN THE CEILING — an already-expired
|
|
211
209
|
// invitation cannot be accepted into an active grant (reuse the ceiling's
|
|
212
210
|
// expiry semantics; a stale accept confers nothing).
|
|
213
|
-
if (command.newState === 'accepted' &&
|
|
214
|
-
invitation.expiresAtMs <= clock()) {
|
|
211
|
+
if (command.newState === 'accepted' && invitation.expiresAtMs <= clock()) {
|
|
215
212
|
return {
|
|
216
213
|
ok: false,
|
|
217
214
|
reason: 'invalid_transition',
|
|
@@ -41,12 +41,8 @@ function makeCuratePermission(deps) {
|
|
|
41
41
|
mutate: async () => {
|
|
42
42
|
await deps.catalogStore.setCuration({
|
|
43
43
|
permissionKey,
|
|
44
|
-
...(typeof label === 'string' && label.trim().length > 0
|
|
45
|
-
|
|
46
|
-
: {}),
|
|
47
|
-
...(typeof group === 'string' && group.trim().length > 0
|
|
48
|
-
? { group }
|
|
49
|
-
: {}),
|
|
44
|
+
...(typeof label === 'string' && label.trim().length > 0 ? { label } : {}),
|
|
45
|
+
...(typeof group === 'string' && group.trim().length > 0 ? { group } : {}),
|
|
50
46
|
});
|
|
51
47
|
},
|
|
52
48
|
emitAudit: async (_value, blastRadius) => {
|
|
@@ -74,8 +74,11 @@ async function runAdminCommand(step, decide, blastDeps = {}) {
|
|
|
74
74
|
* this before {@link runAdminCommand} so the safeguard sees the grant/tier/policy/
|
|
75
75
|
* invitation details even when the service passed them as a separate argument.
|
|
76
76
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* ⛔ PRECEDENCE (B-2, security-hardening Phase 5): the command's OWN data — the
|
|
78
|
+
* target that is actually mutated — is merged LAST, so it always wins. A caller
|
|
79
|
+
* key that collides with it (e.g. a spoofed `permissionKey`/`typeKey`/`action`)
|
|
80
|
+
* is overwritten, so the safeguard always decides on the real target. Caller
|
|
81
|
+
* keys the command does not set (e.g. a `confirm` token) are still preserved.
|
|
79
82
|
*/
|
|
80
83
|
function withPayload(mutation, payload) {
|
|
81
84
|
const existing = mutation.payload !== null &&
|
|
@@ -83,7 +86,7 @@ function withPayload(mutation, payload) {
|
|
|
83
86
|
!Array.isArray(mutation.payload)
|
|
84
87
|
? mutation.payload
|
|
85
88
|
: {};
|
|
86
|
-
return { ...mutation, payload: { ...
|
|
89
|
+
return { ...mutation, payload: { ...existing, ...payload } };
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Build the shared `attributes` bag for an `admin_action` audit event, folding in
|
|
@@ -51,25 +51,14 @@ const NULLARY_OPERATORS = new Set([
|
|
|
51
51
|
/** Operators whose operand MUST be an array (set membership). */
|
|
52
52
|
const ARRAY_OPERATORS = new Set(['in', 'not_in']);
|
|
53
53
|
/** Operators that are ownership predicates — only valid on a REFERENCE field. */
|
|
54
|
-
const OWNERSHIP_OPERATORS = new Set([
|
|
55
|
-
'is_owner',
|
|
56
|
-
'is_not_owner',
|
|
57
|
-
]);
|
|
54
|
+
const OWNERSHIP_OPERATORS = new Set(['is_owner', 'is_not_owner']);
|
|
58
55
|
/**
|
|
59
56
|
* Ordered/relational operators (`gt`/`lt`/`gte`/`lte`) — valid on scalar
|
|
60
57
|
* (non-reference) fields, never on a reference field (you don't order a reference).
|
|
61
58
|
*/
|
|
62
|
-
const RELATIONAL_OPERATORS = new Set([
|
|
63
|
-
'gt',
|
|
64
|
-
'lt',
|
|
65
|
-
'gte',
|
|
66
|
-
'lte',
|
|
67
|
-
]);
|
|
59
|
+
const RELATIONAL_OPERATORS = new Set(['gt', 'lt', 'gte', 'lte']);
|
|
68
60
|
/** Text operators (`contains`/`not_contains`) — valid on scalar fields only. */
|
|
69
|
-
const TEXT_OPERATORS = new Set([
|
|
70
|
-
'contains',
|
|
71
|
-
'not_contains',
|
|
72
|
-
]);
|
|
61
|
+
const TEXT_OPERATORS = new Set(['contains', 'not_contains']);
|
|
73
62
|
/**
|
|
74
63
|
* Is `operator` valid for a field, given whether the field is a REFERENCE field
|
|
75
64
|
* (carries `referencesTypeKey`)? This is the field-type↔operator compatibility
|
|
@@ -81,8 +70,7 @@ const TEXT_OPERATORS = new Set([
|
|
|
81
70
|
* valid on any field.
|
|
82
71
|
*/
|
|
83
72
|
function operatorValidForField(operator, field) {
|
|
84
|
-
const isReference = typeof field.referencesTypeKey === 'string' &&
|
|
85
|
-
field.referencesTypeKey.length > 0;
|
|
73
|
+
const isReference = typeof field.referencesTypeKey === 'string' && field.referencesTypeKey.length > 0;
|
|
86
74
|
if (OWNERSHIP_OPERATORS.has(operator)) {
|
|
87
75
|
return isReference;
|
|
88
76
|
}
|
|
@@ -103,14 +91,12 @@ function valueWellFormed(operator, value) {
|
|
|
103
91
|
return value === undefined || value === null;
|
|
104
92
|
}
|
|
105
93
|
if (ARRAY_OPERATORS.has(operator)) {
|
|
106
|
-
return
|
|
107
|
-
value.length > 0 &&
|
|
108
|
-
value.every((v) => isPrimitive(v)));
|
|
94
|
+
return Array.isArray(value) && value.length > 0 && value.every((v) => isPrimitive(v));
|
|
109
95
|
}
|
|
110
96
|
return isPrimitive(value);
|
|
111
97
|
}
|
|
112
98
|
function isPrimitive(v) {
|
|
113
|
-
return
|
|
99
|
+
return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean';
|
|
114
100
|
}
|
|
115
101
|
/**
|
|
116
102
|
* SHAPE validation of a single condition, WITHOUT the registry (used by the grant
|
|
@@ -127,8 +113,7 @@ function isValidCondition(condition) {
|
|
|
127
113
|
if (typeof c.field !== 'string' || c.field.length === 0) {
|
|
128
114
|
return false;
|
|
129
115
|
}
|
|
130
|
-
if (typeof c.operator !== 'string' ||
|
|
131
|
-
!ALL_OPERATORS.has(c.operator)) {
|
|
116
|
+
if (typeof c.operator !== 'string' || !ALL_OPERATORS.has(c.operator)) {
|
|
132
117
|
return false;
|
|
133
118
|
}
|
|
134
119
|
return valueWellFormed(c.operator, c.value);
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
*
|
|
12
12
|
* ⛔ CREDENTIAL CRYPTO. The credential HASH is produced by the Auth layer's hasher
|
|
13
13
|
* port (never here), then persisted via {@link ServiceAccountStore.setCredentialHash}.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* The NEW secret is always CALLER-held (B-6, security-hardening Phase 5): the caller
|
|
15
|
+
* generates it with a CSPRNG and delivers it to the account owner; rotate hashes the
|
|
16
|
+
* caller's `secret` with the injected {@link PasswordHasher}, or stores the caller's
|
|
17
|
+
* `precomputedHash`. Rotate NEVER mints a secret (a minted secret could not be
|
|
18
|
+
* returned, so the rotation would leave an unusable credential). This file NEVER
|
|
19
|
+
* logs/returns a secret or a hash.
|
|
18
20
|
*
|
|
19
21
|
* Revocation is IMMEDIATE (the store's revoke is idempotent).
|
|
20
22
|
*
|
|
@@ -28,12 +30,6 @@ exports.makeRevokeServiceAccount = makeRevokeServiceAccount;
|
|
|
28
30
|
exports.makeSetServiceAccountExpiry = makeSetServiceAccountExpiry;
|
|
29
31
|
const grants_js_1 = require("./grants.js");
|
|
30
32
|
const pipeline_js_1 = require("./pipeline.js");
|
|
31
|
-
function defaultSecret() {
|
|
32
|
-
// A non-cryptographic placeholder is acceptable ONLY because the real secret
|
|
33
|
-
// generation is the adapter's job (this Core file has no crypto dep); the value
|
|
34
|
-
// is immediately hashed and never returned. Adapters inject a CSPRNG generator.
|
|
35
|
-
return `sa-secret-${String(Date.now())}-${String(Math.random()).slice(2)}`;
|
|
36
|
-
}
|
|
37
33
|
function makeCreateServiceAccount(deps) {
|
|
38
34
|
const clock = deps.now ?? Date.now;
|
|
39
35
|
return async function createServiceAccount(mutation, input) {
|
|
@@ -63,9 +59,7 @@ function makeCreateServiceAccount(deps) {
|
|
|
63
59
|
tenantId: input.tenantId,
|
|
64
60
|
label: input.label,
|
|
65
61
|
scope: input.scope,
|
|
66
|
-
...(input.expiresAtMs !== undefined
|
|
67
|
-
? { expiresAtMs: input.expiresAtMs }
|
|
68
|
-
: {}),
|
|
62
|
+
...(input.expiresAtMs !== undefined ? { expiresAtMs: input.expiresAtMs } : {}),
|
|
69
63
|
}),
|
|
70
64
|
emitAudit: async (value, blastRadius) => {
|
|
71
65
|
await deps.audit.record({
|
|
@@ -131,7 +125,6 @@ function makeScopeServiceAccount(deps) {
|
|
|
131
125
|
}
|
|
132
126
|
function makeRotateServiceAccountCredential(deps) {
|
|
133
127
|
const clock = deps.now ?? Date.now;
|
|
134
|
-
const mintSecret = deps.newSecret ?? defaultSecret;
|
|
135
128
|
return async function rotateServiceAccountCredential(mutation, input) {
|
|
136
129
|
return (0, pipeline_js_1.runAdminCommand)({
|
|
137
130
|
mutation,
|
|
@@ -153,21 +146,23 @@ function makeRotateServiceAccountCredential(deps) {
|
|
|
153
146
|
return null;
|
|
154
147
|
},
|
|
155
148
|
mutate: async () => {
|
|
156
|
-
// Produce the HASH
|
|
157
|
-
// injected Auth hasher
|
|
149
|
+
// Produce the HASH from CALLER-held material only (B-6): hash the
|
|
150
|
+
// caller's secret with the injected Auth hasher, else accept the
|
|
151
|
+
// caller's pre-computed hash. NEVER mint-and-discard a secret.
|
|
158
152
|
let hash;
|
|
159
|
-
if (deps.hasher !== undefined
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
if (deps.hasher !== undefined &&
|
|
154
|
+
typeof input.secret === 'string' &&
|
|
155
|
+
input.secret.length > 0) {
|
|
156
|
+
hash = await deps.hasher.hash(input.secret);
|
|
162
157
|
}
|
|
163
158
|
else if (typeof input.precomputedHash === 'string' &&
|
|
164
159
|
input.precomputedHash.length > 0) {
|
|
165
160
|
hash = input.precomputedHash;
|
|
166
161
|
}
|
|
167
162
|
else {
|
|
168
|
-
// No
|
|
169
|
-
//
|
|
170
|
-
throw new Error('rotateServiceAccountCredential:
|
|
163
|
+
// No usable caller material → cannot rotate safely. Throw BEFORE any
|
|
164
|
+
// write so the old credential stays valid and nothing is audited.
|
|
165
|
+
throw new Error('rotateServiceAccountCredential: supply the caller-generated `secret` (with a hasher injected) or a `precomputedHash`');
|
|
171
166
|
}
|
|
172
167
|
await deps.serviceAccountStore.setCredentialHash(input.id, hash);
|
|
173
168
|
},
|
|
@@ -240,8 +235,7 @@ function makeSetServiceAccountExpiry(deps) {
|
|
|
240
235
|
return { ok: false, reason: 'not_found' };
|
|
241
236
|
}
|
|
242
237
|
if (input.expiresAtMs !== null &&
|
|
243
|
-
(typeof input.expiresAtMs !== 'number' ||
|
|
244
|
-
!Number.isFinite(input.expiresAtMs))) {
|
|
238
|
+
(typeof input.expiresAtMs !== 'number' || !Number.isFinite(input.expiresAtMs))) {
|
|
245
239
|
return { ok: false, reason: 'invalid_policy' };
|
|
246
240
|
}
|
|
247
241
|
const existing = await deps.serviceAccountStore.get(input.id);
|
|
@@ -30,9 +30,7 @@ const tiers_js_1 = require("./tiers.js");
|
|
|
30
30
|
function curatePermissionKey(mutation) {
|
|
31
31
|
const payload = mutation.payload;
|
|
32
32
|
const key = payload?.permissionKey;
|
|
33
|
-
return typeof key === 'string' && key.length > 0
|
|
34
|
-
? key
|
|
35
|
-
: undefined;
|
|
33
|
+
return typeof key === 'string' && key.length > 0 ? key : undefined;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
36
|
* Create the REAL admin COMMAND service. Conforms to the frozen
|
|
@@ -69,7 +67,7 @@ function createRealAdminCommandService(deps) {
|
|
|
69
67
|
serviceAccountStore: deps.serviceAccountStore,
|
|
70
68
|
...common,
|
|
71
69
|
...(deps.hasher !== undefined ? { hasher: deps.hasher } : {}),
|
|
72
|
-
|
|
70
|
+
// `deps.newSecret` is deprecated and deliberately NOT forwarded (B-6).
|
|
73
71
|
};
|
|
74
72
|
const createServiceAccount = (0, service_accounts_js_1.makeCreateServiceAccount)(saDeps);
|
|
75
73
|
const scopeServiceAccount = (0, service_accounts_js_1.makeScopeServiceAccount)(saDeps);
|
package/dist-cjs/admin/index.js
CHANGED
|
@@ -51,8 +51,9 @@ __exportStar(require("./ports.js"), exports);
|
|
|
51
51
|
__exportStar(require("./types.js"), exports);
|
|
52
52
|
// The §11.3 SAFEGUARD signatures + fail-closed defaults (Team B implements bodies):
|
|
53
53
|
__exportStar(require("./safeguards.js"), exports);
|
|
54
|
-
// The query/command service
|
|
55
|
-
//
|
|
54
|
+
// The query/command service interfaces + the §11.3 command pipeline order + the
|
|
55
|
+
// DEPRECATED fail-closed stub factories (`createAdminQueryService` /
|
|
56
|
+
// `createAdminCommandService`; use the real composers appended below):
|
|
56
57
|
__exportStar(require("./admin-service.js"), exports);
|
|
57
58
|
// ---------------------------------------------------------------------------
|
|
58
59
|
// INTEGRATION APPEND (Layer-10 integration owner) — surface the REAL engine
|
|
@@ -48,9 +48,7 @@ function humanizeKey(key) {
|
|
|
48
48
|
if (words.length === 0) {
|
|
49
49
|
return key;
|
|
50
50
|
}
|
|
51
|
-
return words
|
|
52
|
-
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
53
|
-
.join(' ');
|
|
51
|
+
return words.map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
56
54
|
* Resolve a permission's human display label. Preference order (no raw ids):
|
|
@@ -116,7 +114,7 @@ async function getCatalog(deps, tenantId) {
|
|
|
116
114
|
entries.push(await buildEntry(action.permissionKey, action, curation, labels, tenantId));
|
|
117
115
|
}
|
|
118
116
|
// Deterministic ordering by the stable permission key.
|
|
119
|
-
entries.sort((x, y) =>
|
|
117
|
+
entries.sort((x, y) => x.permissionKey < y.permissionKey ? -1 : x.permissionKey > y.permissionKey ? 1 : 0);
|
|
120
118
|
return entries;
|
|
121
119
|
}
|
|
122
120
|
/**
|
|
@@ -127,11 +125,7 @@ async function getCatalog(deps, tenantId) {
|
|
|
127
125
|
* - NO live action (curation only) → `orphaned` (drift)
|
|
128
126
|
*/
|
|
129
127
|
async function buildEntry(permissionKey, action, curation, labels, tenantId) {
|
|
130
|
-
const classification = action === undefined
|
|
131
|
-
? 'orphaned'
|
|
132
|
-
: curation !== null
|
|
133
|
-
? 'classified'
|
|
134
|
-
: 'unclassified';
|
|
128
|
+
const classification = action === undefined ? 'orphaned' : curation !== null ? 'classified' : 'unclassified';
|
|
135
129
|
const label = await resolvePermissionLabel(permissionKey, action, curation, labels, tenantId);
|
|
136
130
|
const tier = action?.tier ?? 'gated';
|
|
137
131
|
const actionEntries = action !== undefined ? [toActionEntry(action)] : [];
|
|
@@ -143,9 +137,7 @@ async function buildEntry(permissionKey, action, curation, labels, tenantId) {
|
|
|
143
137
|
actions: actionEntries,
|
|
144
138
|
classification,
|
|
145
139
|
};
|
|
146
|
-
return group !== undefined && group.length > 0
|
|
147
|
-
? { ...base, group }
|
|
148
|
-
: base;
|
|
140
|
+
return group !== undefined && group.length > 0 ? { ...base, group } : base;
|
|
149
141
|
}
|
|
150
142
|
/**
|
|
151
143
|
* Classify an explicit set of permission keys (e.g. the keys a set of grants
|
|
@@ -169,6 +161,6 @@ async function classifyKnownKeys(deps, keys, tenantId) {
|
|
|
169
161
|
const curation = await catalogStore.getCuration(key);
|
|
170
162
|
entries.push(await buildEntry(key, action, curation, labels, tenantId));
|
|
171
163
|
}
|
|
172
|
-
entries.sort((x, y) =>
|
|
164
|
+
entries.sort((x, y) => x.permissionKey < y.permissionKey ? -1 : x.permissionKey > y.permissionKey ? 1 : 0);
|
|
173
165
|
return entries;
|
|
174
166
|
}
|
|
@@ -115,8 +115,7 @@ function requiredAuthorities(command) {
|
|
|
115
115
|
// Payload carries the target permission key (the tier command's subject).
|
|
116
116
|
const key = typeof command.payload === 'string'
|
|
117
117
|
? command.payload
|
|
118
|
-
: command.payload
|
|
119
|
-
?.permissionKey;
|
|
118
|
+
: command.payload?.permissionKey;
|
|
120
119
|
if (typeof key !== 'string') {
|
|
121
120
|
return null;
|
|
122
121
|
}
|
|
@@ -181,8 +180,7 @@ async function checkDelegatedAdminImpl(admin, command, decide) {
|
|
|
181
180
|
// tenant than their own is refused. The ONLY non-root cross-tenant
|
|
182
181
|
// path is the consent invitation (invitation_create), which is not an
|
|
183
182
|
// authority-bounded direct grant and is allowed through here.
|
|
184
|
-
if (AUTHORITY_BOUNDED_KINDS.has(command.kind) &&
|
|
185
|
-
command.targetTenantId !== admin.tenantId) {
|
|
183
|
+
if (AUTHORITY_BOUNDED_KINDS.has(command.kind) && command.targetTenantId !== admin.tenantId) {
|
|
186
184
|
return { ok: false, reason: 'unilateral_cross_tenant' };
|
|
187
185
|
}
|
|
188
186
|
// (2) NON-AUTHORITY-BROADENING kinds (curate, invitation create/transition,
|
|
@@ -255,9 +253,7 @@ async function computeBlastRadiusImpl(command, deps = {}) {
|
|
|
255
253
|
// Cross-tenant whole-object-type invitation — describe the ceiling (§3.7).
|
|
256
254
|
if (command.kind === 'invitation_create') {
|
|
257
255
|
const payload = command.payload;
|
|
258
|
-
const types = Array.isArray(payload?.objectTypeKeys)
|
|
259
|
-
? payload.objectTypeKeys.length
|
|
260
|
-
: 0;
|
|
256
|
+
const types = Array.isArray(payload?.objectTypeKeys) ? payload.objectTypeKeys.length : 0;
|
|
261
257
|
return {
|
|
262
258
|
affectedPrincipalCount: 0,
|
|
263
259
|
description: types > 0
|
|
@@ -257,8 +257,7 @@ function verifyChain(records, hash) {
|
|
|
257
257
|
};
|
|
258
258
|
const recomputedContentHash = hash.hash((0, canonicalize_js_1.canonicalizeEvent)(cleanEvent));
|
|
259
259
|
const recomputedEntryHash = hash.hash(entryPreimage(recomputedContentHash, record.prevHash, record.sequenceNumber));
|
|
260
|
-
if (recomputedContentHash !== record.contentHash ||
|
|
261
|
-
recomputedEntryHash !== record.entryHash) {
|
|
260
|
+
if (recomputedContentHash !== record.contentHash || recomputedEntryHash !== record.entryHash) {
|
|
262
261
|
return { intact: false, brokenIndex: i, reason: 'content_mismatch' };
|
|
263
262
|
}
|
|
264
263
|
// Advance the expected link/sequence to THIS record's recomputed entryHash.
|
package/dist-cjs/audit/walk.js
CHANGED
|
@@ -77,10 +77,7 @@ function isSpecialLeaf(value) {
|
|
|
77
77
|
* `Object.create(null)` bag and a `class Foo {}` instance both qualify.
|
|
78
78
|
*/
|
|
79
79
|
function isDescendableObject(value) {
|
|
80
|
-
return (value !== null &&
|
|
81
|
-
typeof value === 'object' &&
|
|
82
|
-
!Array.isArray(value) &&
|
|
83
|
-
!isSpecialLeaf(value));
|
|
80
|
+
return (value !== null && typeof value === 'object' && !Array.isArray(value) && !isSpecialLeaf(value));
|
|
84
81
|
}
|
|
85
82
|
/**
|
|
86
83
|
* Compute the collision-free structural tag for a `Date` leaf, or `undefined` for
|
|
@@ -40,3 +40,5 @@ __exportStar(require("./credential-resolver.js"), exports);
|
|
|
40
40
|
__exportStar(require("./totp.js"), exports);
|
|
41
41
|
// The Authentication engine + the `createAuthenticator` factory:
|
|
42
42
|
__exportStar(require("./authenticator.js"), exports);
|
|
43
|
+
// Service-account API-key authentication (ADR-0033) — the machine/agent/MCP auth path:
|
|
44
|
+
__exportStar(require("./service-account-authenticator.js"), exports);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_KEY_PREFIX = void 0;
|
|
4
|
+
exports.parseApiKey = parseApiKey;
|
|
5
|
+
exports.createServiceAuthenticator = createServiceAuthenticator;
|
|
6
|
+
/** The API-key prefix that identifies a service-account credential. */
|
|
7
|
+
exports.API_KEY_PREFIX = 'ask_';
|
|
8
|
+
/** Parse `ask_<accountId>_<secret>`. Returns null on ANY malformation (→ uniform deny). */
|
|
9
|
+
function parseApiKey(key) {
|
|
10
|
+
if (typeof key !== 'string' || !key.startsWith(exports.API_KEY_PREFIX))
|
|
11
|
+
return null;
|
|
12
|
+
const rest = key.slice(exports.API_KEY_PREFIX.length);
|
|
13
|
+
const sep = rest.indexOf('_');
|
|
14
|
+
if (sep <= 0)
|
|
15
|
+
return null; // must have a non-empty accountId AND a secret
|
|
16
|
+
const accountId = rest.slice(0, sep);
|
|
17
|
+
const secret = rest.slice(sep + 1);
|
|
18
|
+
if (accountId === '' || secret === '')
|
|
19
|
+
return null;
|
|
20
|
+
return { accountId, secret };
|
|
21
|
+
}
|
|
22
|
+
function createServiceAuthenticator(deps) {
|
|
23
|
+
const now = deps.now ?? (() => Date.now());
|
|
24
|
+
const fail = () => ({ ok: false, reason: 'invalid_key' });
|
|
25
|
+
return {
|
|
26
|
+
async authenticateApiKey(presentedKey) {
|
|
27
|
+
const parsed = parseApiKey(presentedKey);
|
|
28
|
+
if (parsed === null)
|
|
29
|
+
return fail(); // malformed → uniform deny (no enumeration)
|
|
30
|
+
let record;
|
|
31
|
+
try {
|
|
32
|
+
record = await deps.store.getByAccountId(parsed.accountId);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Store outage → fail closed (authentication failure). Distinct from "unknown" only in
|
|
36
|
+
// the server log; the caller sees the same uniform failure.
|
|
37
|
+
return fail();
|
|
38
|
+
}
|
|
39
|
+
if (record === null) {
|
|
40
|
+
// Unknown account. Still spend a verify against a decoy? PasswordHasher.verify already runs
|
|
41
|
+
// near-constant-time; we simply deny. (Timing parity with the argon path is acceptable —
|
|
42
|
+
// the account id is not itself a secret.)
|
|
43
|
+
return fail();
|
|
44
|
+
}
|
|
45
|
+
// Verify the secret against the stored hash (constant-time). A malformed/mismatched hash →
|
|
46
|
+
// the hasher returns false or rejects; either way we deny (fail-closed).
|
|
47
|
+
let matches = false;
|
|
48
|
+
try {
|
|
49
|
+
matches = await deps.hasher.verify(record.secretHash, parsed.secret);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return fail();
|
|
53
|
+
}
|
|
54
|
+
if (matches !== true)
|
|
55
|
+
return fail(); // strict === true
|
|
56
|
+
// Lifecycle: revoked or expired → deny (fail-closed), even on a correct secret.
|
|
57
|
+
const t = now();
|
|
58
|
+
if (record.revokedAtMs !== undefined && record.revokedAtMs <= t)
|
|
59
|
+
return fail();
|
|
60
|
+
if (record.expiresAtMs !== undefined && record.expiresAtMs <= t)
|
|
61
|
+
return fail();
|
|
62
|
+
// Build the tenant-bound service_account Principal — the SAME shape the broker produces, so it
|
|
63
|
+
// flows through decide() unchanged. NEVER root; scope is the account's own (least privilege).
|
|
64
|
+
const principal = {
|
|
65
|
+
kind: 'service_account',
|
|
66
|
+
id: record.accountId,
|
|
67
|
+
activeScopeNodeId: record.tenantId,
|
|
68
|
+
scopeSubtreeNodeIds: record.scopeSubtreeNodeIds.length > 0 ? record.scopeSubtreeNodeIds : [record.tenantId],
|
|
69
|
+
tenantId: record.tenantId,
|
|
70
|
+
roleIds: record.roleIds,
|
|
71
|
+
isRoot: false,
|
|
72
|
+
};
|
|
73
|
+
return { ok: true, principal };
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|