@pegasimed.com/pegasi-sail-connect-shared 0.1.0-dev.0 → 0.2.0-dev.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/README.md +398 -125
- package/dist/authorization/index.d.ts +3 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +3 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/internal-authorization.d.ts +105 -0
- package/dist/authorization/internal-authorization.d.ts.map +1 -0
- package/dist/authorization/internal-authorization.js +287 -0
- package/dist/authorization/internal-authorization.js.map +1 -0
- package/dist/capabilities/catalog-data.d.ts +3917 -0
- package/dist/capabilities/catalog-data.d.ts.map +1 -0
- package/dist/capabilities/catalog-data.js +4244 -0
- package/dist/capabilities/catalog-data.js.map +1 -0
- package/dist/capabilities/catalog.d.ts +38 -0
- package/dist/capabilities/catalog.d.ts.map +1 -0
- package/dist/capabilities/catalog.js +91 -0
- package/dist/capabilities/catalog.js.map +1 -0
- package/dist/capabilities/index.d.ts +8 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +8 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/list.d.ts +46 -0
- package/dist/capabilities/list.d.ts.map +1 -0
- package/dist/capabilities/list.js +80 -0
- package/dist/capabilities/list.js.map +1 -0
- package/dist/capabilities/match.d.ts +42 -0
- package/dist/capabilities/match.d.ts.map +1 -0
- package/dist/capabilities/match.js +139 -0
- package/dist/capabilities/match.js.map +1 -0
- package/dist/capabilities/migration-data.d.ts +2424 -0
- package/dist/capabilities/migration-data.d.ts.map +1 -0
- package/dist/capabilities/migration-data.js +2646 -0
- package/dist/capabilities/migration-data.js.map +1 -0
- package/dist/capabilities/migration.d.ts +176 -0
- package/dist/capabilities/migration.d.ts.map +1 -0
- package/dist/capabilities/migration.js +209 -0
- package/dist/capabilities/migration.js.map +1 -0
- package/dist/capabilities/types.d.ts +124 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +2 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capabilities/validate.d.ts +19 -0
- package/dist/capabilities/validate.d.ts.map +1 -0
- package/dist/capabilities/validate.js +235 -0
- package/dist/capabilities/validate.js.map +1 -0
- 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/package.json +111 -102
- package/scripts/check-service-keys.mjs +250 -0
- package/scripts/lint-phi.mjs +266 -266
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export type CapabilityProduct = "sail" | "connect";
|
|
2
|
+
/**
|
|
3
|
+
* Every catalog entry is an `operation`: a key a service can require and the
|
|
4
|
+
* only form a grant can take. There are no wildcard grants.
|
|
5
|
+
*/
|
|
6
|
+
export type CapabilityKind = "operation";
|
|
7
|
+
/** Role bundles that receive a key automatically. */
|
|
8
|
+
export type CapabilityRoleDefault = "tenant_admin";
|
|
9
|
+
export type PermissionMigrationOp = "rename" | "merge" | "split" | "retire" | "keep";
|
|
10
|
+
/** How carefully an administrator should grant the key; absent means normal. */
|
|
11
|
+
export type CapabilitySensitivity = "normal" | "sensitive";
|
|
12
|
+
export interface CapabilityDefinition {
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly service: string;
|
|
15
|
+
readonly resource: string;
|
|
16
|
+
readonly action: string;
|
|
17
|
+
readonly displayName: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly groupKey: string;
|
|
20
|
+
readonly groupDisplayName: string;
|
|
21
|
+
readonly order: number;
|
|
22
|
+
readonly products: readonly CapabilityProduct[];
|
|
23
|
+
/** Whether a tenant administrator may assign the key to tenant users. */
|
|
24
|
+
readonly tenantAssignable: boolean;
|
|
25
|
+
readonly kind: CapabilityKind;
|
|
26
|
+
/**
|
|
27
|
+
* Presented by a service identity, never by a tenant user: not
|
|
28
|
+
* tenant-assignable, no roleDefaults and omitted from migrated user grants.
|
|
29
|
+
*/
|
|
30
|
+
readonly serviceToService: boolean;
|
|
31
|
+
readonly roleDefaults: readonly CapabilityRoleDefault[];
|
|
32
|
+
/** Why a flag was set conservatively or what the owner still has to decide. */
|
|
33
|
+
readonly notes?: string;
|
|
34
|
+
/** Curated sensitivity for administration screens; absent means normal. */
|
|
35
|
+
readonly sensitivity?: CapabilitySensitivity;
|
|
36
|
+
/** Curated warning shown before granting the key. */
|
|
37
|
+
readonly warning?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CapabilityGrammar {
|
|
40
|
+
readonly segments: number;
|
|
41
|
+
readonly segmentPattern: string;
|
|
42
|
+
readonly defaultResource: string;
|
|
43
|
+
readonly baseActions: readonly string[];
|
|
44
|
+
readonly specialActions: readonly string[];
|
|
45
|
+
readonly scopeSuffix: string;
|
|
46
|
+
/** Always null: no segment of a key or a grant can be a wildcard. */
|
|
47
|
+
readonly wildcardSegment: null;
|
|
48
|
+
}
|
|
49
|
+
export interface PermissionMigrationEntryDefinition {
|
|
50
|
+
readonly old: string;
|
|
51
|
+
readonly op: PermissionMigrationOp;
|
|
52
|
+
readonly canonical: readonly string[];
|
|
53
|
+
/** The exact grants an owner of the old key receives after migration. */
|
|
54
|
+
readonly grantMigration: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* Grants for a stored value that differs from `old` only by case: the
|
|
57
|
+
* destinations whose old checks lower-cased the granted value. null when
|
|
58
|
+
* none did (the variant goes to unknown).
|
|
59
|
+
*/
|
|
60
|
+
readonly caseVariantGrants: readonly string[] | null;
|
|
61
|
+
/**
|
|
62
|
+
* Grants for a stored value that equals `old` with surrounding spaces: the
|
|
63
|
+
* destinations whose old checks trimmed the granted value. null when none
|
|
64
|
+
* did (the variant goes to unknown).
|
|
65
|
+
*/
|
|
66
|
+
readonly spaceVariantGrants: readonly string[] | null;
|
|
67
|
+
readonly note: string;
|
|
68
|
+
}
|
|
69
|
+
/** Old keys a service stores per entity and compares by equality (e.g. schedules-api profile grants). */
|
|
70
|
+
export interface PermissionProfileGrantRuleDefinition {
|
|
71
|
+
readonly service: string;
|
|
72
|
+
readonly field: string;
|
|
73
|
+
readonly evidence: string;
|
|
74
|
+
readonly keys: readonly {
|
|
75
|
+
readonly old: string;
|
|
76
|
+
readonly canonical: string;
|
|
77
|
+
}[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Data-migration rule for stored old service-prefix grants (`servicio:*`),
|
|
81
|
+
* with evidence and the enumerated lists it produces. It is not a grant form.
|
|
82
|
+
*/
|
|
83
|
+
export interface PermissionPrefixRuleDefinition {
|
|
84
|
+
readonly note: string;
|
|
85
|
+
readonly services: readonly {
|
|
86
|
+
readonly service: string;
|
|
87
|
+
readonly evidence: string;
|
|
88
|
+
}[];
|
|
89
|
+
readonly excludedServices: readonly {
|
|
90
|
+
readonly service: string;
|
|
91
|
+
readonly evidence: string;
|
|
92
|
+
}[];
|
|
93
|
+
/** Keys a prefix service compared by equality although its wildcard matcher could reach them: a prefix never satisfied them. */
|
|
94
|
+
readonly exactChecked: readonly {
|
|
95
|
+
readonly key: string;
|
|
96
|
+
readonly evidence: string;
|
|
97
|
+
}[];
|
|
98
|
+
/** Literal-only keys (never satisfied by an old wildcard) that the old prefix matcher did satisfy. */
|
|
99
|
+
readonly exactAllowed: readonly {
|
|
100
|
+
readonly key: string;
|
|
101
|
+
readonly evidence: string;
|
|
102
|
+
}[];
|
|
103
|
+
/** Literal-only keys of a namespace that the old prefix matcher did not satisfy: left out of the lists. */
|
|
104
|
+
readonly exactExcluded: readonly {
|
|
105
|
+
readonly key: string;
|
|
106
|
+
readonly evidence: string;
|
|
107
|
+
}[];
|
|
108
|
+
/** `servicio:*` (exact, lower case) -> enumerated explicit keys. */
|
|
109
|
+
readonly grants: Readonly<Record<string, readonly string[]>>;
|
|
110
|
+
/** Same, for a case variant of the prefix (only services whose checks lower-cased). */
|
|
111
|
+
readonly caseVariantGrants: Readonly<Record<string, readonly string[]>>;
|
|
112
|
+
/** Same, for the prefix with surrounding spaces (only services whose checks trimmed). */
|
|
113
|
+
readonly spaceVariantGrants: Readonly<Record<string, readonly string[]>>;
|
|
114
|
+
}
|
|
115
|
+
export interface PermissionLevelRuleDefinition {
|
|
116
|
+
readonly source: "permissionLevels";
|
|
117
|
+
readonly module: string;
|
|
118
|
+
readonly levels: readonly {
|
|
119
|
+
readonly level: number;
|
|
120
|
+
readonly grants: readonly string[];
|
|
121
|
+
}[];
|
|
122
|
+
readonly note: string;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AAEzC,qDAAqD;AACrD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErF,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QA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AC;IACvF,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7D,uFAAuF;IACvF,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IACxE,yFAAyF;IACzF,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CapabilityDefinition } from "./types.js";
|
|
2
|
+
export type CapabilityViolationCode = "invalid-catalog" | "invalid-entry" | "invalid-field" | "invalid-key-shape" | "invalid-segment" | "segment-mismatch" | "unknown-service" | "duplicate-key" | "duplicate-order" | "invalid-kind" | "invalid-action" | "wildcard-forbidden" | "scope-suffix-assignable" | "service-to-service-assignable" | "service-to-service-role-defaults" | "invalid-products" | "missing-products" | "invalid-role-defaults" | "invalid-sensitivity" | "invalid-warning";
|
|
3
|
+
export interface CapabilityViolation {
|
|
4
|
+
/** Position of the entry in the catalog; -1 for catalog-level violations. */
|
|
5
|
+
readonly index: number;
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly code: CapabilityViolationCode;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Checks a catalog against the canonical grammar and the catalog invariants:
|
|
12
|
+
* explicit keys only (any `*` is `wildcard-forbidden`), a real product on every
|
|
13
|
+
* entry, and service-to-service keys never assignable nor role defaults.
|
|
14
|
+
* Returns every violation found; never throws, whatever the input (hostile
|
|
15
|
+
* proxies, revoked proxies and throwing accessors become invalid-catalog or
|
|
16
|
+
* invalid-entry violations).
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateCapabilityCatalog(catalog: readonly CapabilityDefinition[]): CapabilityViolation[];
|
|
19
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/capabilities/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAC/B,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,oBAAoB,GACpB,yBAAyB,GACzB,+BAA+B,GAC/B,kCAAkC,GAClC,kBAAkB,GAClB,kBAAkB,GAClB,uBAAuB,GACvB,qBAAqB,GACrB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAoLD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,mBAAmB,EAAE,CAOzG"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { CAPABILITY_GRAMMAR, CAPABILITY_SERVICES } from "./catalog-data.js";
|
|
2
|
+
import { OWN_ACCESSOR, appendOwn, ownDataValue, readList } from "./list.js";
|
|
3
|
+
const WILDCARD = "*";
|
|
4
|
+
const SEGMENT = new RegExp(CAPABILITY_GRAMMAR.segmentPattern);
|
|
5
|
+
const ACTIONS = new Set([...CAPABILITY_GRAMMAR.baseActions, ...CAPABILITY_GRAMMAR.specialActions]);
|
|
6
|
+
const SERVICES = new Set(CAPABILITY_SERVICES);
|
|
7
|
+
const PRODUCTS = new Set(["sail", "connect"]);
|
|
8
|
+
const ROLE_DEFAULTS = new Set(["tenant_admin"]);
|
|
9
|
+
const SENSITIVITIES = new Set(["normal", "sensitive"]);
|
|
10
|
+
const TEXT_FIELDS = ["displayName", "description", "groupKey", "groupDisplayName"];
|
|
11
|
+
const FLAG_FIELDS = ["tenantAssignable", "serviceToService"];
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
function isUniqueStringArray(value, allowed) {
|
|
16
|
+
return (Array.isArray(value) &&
|
|
17
|
+
value.every((item) => typeof item === "string" && allowed.has(item)) &&
|
|
18
|
+
new Set(value).size === value.length);
|
|
19
|
+
}
|
|
20
|
+
function checkFields(entry, report) {
|
|
21
|
+
for (const field of TEXT_FIELDS) {
|
|
22
|
+
const value = entry[field];
|
|
23
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
24
|
+
report("invalid-field", `${field} must be a non-empty string.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
for (const field of FLAG_FIELDS) {
|
|
28
|
+
if (typeof entry[field] !== "boolean") {
|
|
29
|
+
report("invalid-field", `${field} must be a boolean.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (typeof entry.order !== "number" || !Number.isInteger(entry.order) || entry.order < 1) {
|
|
33
|
+
report("invalid-field", "order must be a positive integer.");
|
|
34
|
+
}
|
|
35
|
+
if (entry.kind !== "operation") {
|
|
36
|
+
report("invalid-kind", "kind must be operation: the catalog has no wildcard grants.");
|
|
37
|
+
}
|
|
38
|
+
if (entry.notes !== undefined && (typeof entry.notes !== "string" || entry.notes.trim().length === 0)) {
|
|
39
|
+
report("invalid-field", "notes, when present, must be a non-empty string.");
|
|
40
|
+
}
|
|
41
|
+
if (entry.sensitivity !== undefined && !SENSITIVITIES.has(entry.sensitivity)) {
|
|
42
|
+
report("invalid-sensitivity", "sensitivity, when present, must be normal or sensitive.");
|
|
43
|
+
}
|
|
44
|
+
if (entry.warning !== undefined && (typeof entry.warning !== "string" || entry.warning.trim().length === 0)) {
|
|
45
|
+
report("invalid-warning", "warning, when present, must be a non-empty string.");
|
|
46
|
+
}
|
|
47
|
+
if (!isUniqueStringArray(entry.products, PRODUCTS)) {
|
|
48
|
+
report("invalid-products", "products must be a list of distinct values among sail and connect.");
|
|
49
|
+
}
|
|
50
|
+
else if (entry.products.length === 0) {
|
|
51
|
+
report("missing-products", "Every entry needs at least one real product (sail or connect).");
|
|
52
|
+
}
|
|
53
|
+
if (!isUniqueStringArray(entry.roleDefaults, ROLE_DEFAULTS)) {
|
|
54
|
+
report("invalid-role-defaults", "roleDefaults must be a list of distinct values among tenant_admin.");
|
|
55
|
+
}
|
|
56
|
+
if (entry.serviceToService === true && entry.tenantAssignable !== false) {
|
|
57
|
+
report("service-to-service-assignable", "A service-to-service key can never be tenant-assignable.");
|
|
58
|
+
}
|
|
59
|
+
if (entry.serviceToService === true && Array.isArray(entry.roleDefaults) && entry.roleDefaults.length > 0) {
|
|
60
|
+
report("service-to-service-role-defaults", "A service-to-service key cannot be granted by default to a tenant user role.");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function checkAction(action, entry, report) {
|
|
64
|
+
const suffix = CAPABILITY_GRAMMAR.scopeSuffix;
|
|
65
|
+
const scoped = action.endsWith(suffix);
|
|
66
|
+
const base = scoped ? action.slice(0, -suffix.length) : action;
|
|
67
|
+
if (!ACTIONS.has(base)) {
|
|
68
|
+
report("invalid-action", `Action "${action}" is outside the closed vocabulary.`);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (scoped && entry.tenantAssignable !== false) {
|
|
72
|
+
report("scope-suffix-assignable", `The ${suffix} scope suffix (cross-license access) is only valid on non-tenant-assignable keys.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function checkKey(entry, report) {
|
|
76
|
+
const key = entry.key;
|
|
77
|
+
if (typeof key !== "string") {
|
|
78
|
+
report("invalid-field", "key must be a string.");
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (key.includes(WILDCARD)) {
|
|
82
|
+
report("wildcard-forbidden", "No segment of a key can be or contain a wildcard: every grant is an explicit key.");
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const segments = key.split(":");
|
|
86
|
+
if (segments.length !== CAPABILITY_GRAMMAR.segments) {
|
|
87
|
+
report("invalid-key-shape", `Key must have exactly ${CAPABILITY_GRAMMAR.segments} segments.`);
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const [service, resource, action] = segments;
|
|
91
|
+
if (entry.service !== service || entry.resource !== resource || entry.action !== action) {
|
|
92
|
+
report("segment-mismatch", "service, resource and action must equal the key segments.");
|
|
93
|
+
}
|
|
94
|
+
for (const segment of segments) {
|
|
95
|
+
if (!SEGMENT.test(segment)) {
|
|
96
|
+
report("invalid-segment", `Segment "${segment}" is not lowercase kebab-case.`);
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (!SERVICES.has(service)) {
|
|
101
|
+
report("unknown-service", `Service "${service}" is not a known owning service.`);
|
|
102
|
+
}
|
|
103
|
+
return segments;
|
|
104
|
+
}
|
|
105
|
+
const ENTRY_FIELDS = [
|
|
106
|
+
"key",
|
|
107
|
+
"service",
|
|
108
|
+
"resource",
|
|
109
|
+
"action",
|
|
110
|
+
"displayName",
|
|
111
|
+
"description",
|
|
112
|
+
"groupKey",
|
|
113
|
+
"groupDisplayName",
|
|
114
|
+
"order",
|
|
115
|
+
"products",
|
|
116
|
+
"tenantAssignable",
|
|
117
|
+
"kind",
|
|
118
|
+
"serviceToService",
|
|
119
|
+
"roleDefaults",
|
|
120
|
+
"notes",
|
|
121
|
+
"sensitivity",
|
|
122
|
+
"warning"
|
|
123
|
+
];
|
|
124
|
+
const ARRAY_FIELDS = new Set(["products", "roleDefaults"]);
|
|
125
|
+
// Marks a catalog element (or entry) whose inspection threw.
|
|
126
|
+
const UNREADABLE = Symbol("unreadable");
|
|
127
|
+
// Plain copy of an array (readList: by index, bounded); a non-array is
|
|
128
|
+
// returned as is. Throws when the array is unreadable, so the entry is.
|
|
129
|
+
function copyArray(value) {
|
|
130
|
+
const read = readList(value);
|
|
131
|
+
if (read.status === "unreadable") {
|
|
132
|
+
throw new Error("unreadable array");
|
|
133
|
+
}
|
|
134
|
+
return read.status === "ok" ? read.items : value;
|
|
135
|
+
}
|
|
136
|
+
// Plain snapshot of an entry's own data fields, so the checks never touch the
|
|
137
|
+
// input again: an inherited field (a polluted Object.prototype) counts as
|
|
138
|
+
// absent. undefined when it is not an object; UNREADABLE when reading throws
|
|
139
|
+
// or a field is an accessor (never run).
|
|
140
|
+
function snapshotEntry(value) {
|
|
141
|
+
try {
|
|
142
|
+
if (!isRecord(value)) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
const snapshot = Object.create(null);
|
|
146
|
+
for (const field of ENTRY_FIELDS) {
|
|
147
|
+
const fieldValue = ownDataValue(value, field);
|
|
148
|
+
if (fieldValue === OWN_ACCESSOR) {
|
|
149
|
+
return UNREADABLE;
|
|
150
|
+
}
|
|
151
|
+
snapshot[field] = ARRAY_FIELDS.has(field) ? copyArray(fieldValue) : fieldValue;
|
|
152
|
+
}
|
|
153
|
+
return snapshot;
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return UNREADABLE;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Plain copy of the catalog's elements (readList: by index, at most
|
|
160
|
+
// MAX_LIST_LENGTH); undefined when it is not an array; throws when unreadable.
|
|
161
|
+
function readCatalog(catalog) {
|
|
162
|
+
const read = readList(catalog);
|
|
163
|
+
if (read.status === "unreadable") {
|
|
164
|
+
throw new Error("unreadable catalog");
|
|
165
|
+
}
|
|
166
|
+
return read.status === "ok" ? read.items : undefined;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Checks a catalog against the canonical grammar and the catalog invariants:
|
|
170
|
+
* explicit keys only (any `*` is `wildcard-forbidden`), a real product on every
|
|
171
|
+
* entry, and service-to-service keys never assignable nor role defaults.
|
|
172
|
+
* Returns every violation found; never throws, whatever the input (hostile
|
|
173
|
+
* proxies, revoked proxies and throwing accessors become invalid-catalog or
|
|
174
|
+
* invalid-entry violations).
|
|
175
|
+
*/
|
|
176
|
+
export function validateCapabilityCatalog(catalog) {
|
|
177
|
+
const violations = [];
|
|
178
|
+
try {
|
|
179
|
+
return collectViolations(catalog, violations);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return [...violations, { index: -1, key: "", code: "invalid-catalog", message: "The catalog could not be validated." }];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function collectViolations(catalog, violations) {
|
|
186
|
+
let items;
|
|
187
|
+
try {
|
|
188
|
+
items = readCatalog(catalog);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return [{ index: -1, key: "", code: "invalid-catalog", message: "The catalog could not be read." }];
|
|
192
|
+
}
|
|
193
|
+
if (items === undefined) {
|
|
194
|
+
return [{ index: -1, key: "", code: "invalid-catalog", message: "The catalog must be an array." }];
|
|
195
|
+
}
|
|
196
|
+
const snapshots = items.map((item) => snapshotEntry(item));
|
|
197
|
+
const seenKeys = new Map();
|
|
198
|
+
const seenOrders = new Map();
|
|
199
|
+
snapshots.forEach((value, index) => {
|
|
200
|
+
const key = isRecord(value) && typeof value.key === "string" ? value.key : "";
|
|
201
|
+
// appendOwn: a setter inherited from Array.prototype cannot replace or drop a violation.
|
|
202
|
+
const report = (code, message) => appendOwn(violations, { index, key, code, message });
|
|
203
|
+
if (value === UNREADABLE) {
|
|
204
|
+
report("invalid-entry", "The catalog entry could not be read.");
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (!isRecord(value)) {
|
|
208
|
+
report("invalid-entry", "Each catalog entry must be an object.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
checkFields(value, report);
|
|
212
|
+
const segments = checkKey(value, report);
|
|
213
|
+
if (typeof value.key === "string") {
|
|
214
|
+
if (seenKeys.has(value.key)) {
|
|
215
|
+
report("duplicate-key", `Key already defined at index ${seenKeys.get(value.key)}.`);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
seenKeys.set(value.key, index);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (typeof value.order === "number") {
|
|
222
|
+
if (seenOrders.has(value.order)) {
|
|
223
|
+
report("duplicate-order", `order already used at index ${seenOrders.get(value.order)}.`);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
seenOrders.set(value.order, index);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (segments !== undefined) {
|
|
230
|
+
checkAction(segments[2], value, report);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
return violations;
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/capabilities/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,SAAS,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AC;gBACN,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAW,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|