raffel 1.1.27 → 1.1.28
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/middleware/policy/co-located/loader.d.ts.map +1 -1
- package/dist/middleware/policy/co-located/loader.js +5 -4
- package/dist/middleware/policy/co-located/loader.js.map +1 -1
- package/dist/middleware/policy/loader.d.ts.map +1 -1
- package/dist/middleware/policy/loader.js +5 -7
- package/dist/middleware/policy/loader.js.map +1 -1
- package/dist/middleware/policy/schema.d.ts +194 -0
- package/dist/middleware/policy/schema.d.ts.map +1 -0
- package/dist/middleware/policy/schema.js +110 -0
- package/dist/middleware/policy/schema.js.map +1 -0
- package/dist/ui/middleware/policy/co-located/loader.d.ts.map +1 -1
- package/dist/ui/middleware/policy/schema.d.ts +194 -0
- package/dist/ui/middleware/policy/schema.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAA;AAEpF,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,eAAe,CAAA;AAuBtB,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,oBAAoB,EAAE,CAAA;CAC9B;AAiDD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CA0C9B"}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Pure validation lives in the JSON schema — the loader only adds I/O.
|
|
10
10
|
*/
|
|
11
|
-
import { readFileSync } from 'node:fs';
|
|
12
11
|
import { extname } from 'node:path';
|
|
13
12
|
// `ajv` is a CommonJS package without an ESM wrapper. Node 22's strict
|
|
14
13
|
// loader rejects `import { Ajv } from 'ajv'`, and `import Ajv from 'ajv'`
|
|
@@ -18,15 +17,17 @@ import { createRequire } from 'node:module';
|
|
|
18
17
|
const requireAjv = createRequire(import.meta.url);
|
|
19
18
|
const Ajv = requireAjv('ajv');
|
|
20
19
|
import { load as parseYaml } from 'js-yaml';
|
|
20
|
+
import { policySchema } from '../schema.js';
|
|
21
21
|
import { ancestorDirs, folderPolicyCandidates, siblingPolicyCandidates, } from './resolver.js';
|
|
22
22
|
let validator;
|
|
23
23
|
function getValidator() {
|
|
24
24
|
if (validator)
|
|
25
25
|
return validator;
|
|
26
|
-
const schemaPath = new URL('../schema.json', import.meta.url);
|
|
27
|
-
const schema = JSON.parse(readFileSync(schemaPath, 'utf-8'));
|
|
28
26
|
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
29
|
-
|
|
27
|
+
// Canonical schema is the TS literal in `../schema.ts`. The equivalent
|
|
28
|
+
// `../schema.json` exists for external tooling and is kept in sync by
|
|
29
|
+
// `schema-sync.unit.test.ts`.
|
|
30
|
+
validator = ajv.compile(policySchema);
|
|
30
31
|
return validator;
|
|
31
32
|
}
|
|
32
33
|
function formatAjvErrors(errors, file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,gCAAgC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAA8C,CAAA;AAC1E,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAO3C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EACL,YAAY,EACZ,sBAAsB,EAEtB,uBAAuB,GACxB,MAAM,eAAe,CAAA;AAEtB,IAAI,SAES,CAAA;AAEb,SAAS,YAAY;IACnB,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IACvD,uEAAuE;IACvE,sEAAsE;IACtE,8BAA8B;IAC9B,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,YAAiC,CAAgC,CAAA;IACzF,OAAO,SAAU,CAAA;AACnB,CAAC;AAED,SAAS,eAAe,CAAC,MAAwC,EAAE,IAAY;IAC7E,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,IAAI,6BAA6B,CAAA;IAC/E,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EA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/C,iBAAiB,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CACxD,CAAA;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;YAClE,MAAK;QACP,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/middleware/policy/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAEV,MAAM,EACN,eAAe,EAChB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/middleware/policy/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAEV,MAAM,EACN,eAAe,EAChB,MAAM,YAAY,CAAA;AAenB,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACnD;AAED,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,kFAAkF;IAClF,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAiCD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAoDpE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA2B1C"}
|
|
@@ -17,18 +17,16 @@ import { join, resolve } from 'node:path';
|
|
|
17
17
|
import { createRequire } from 'node:module';
|
|
18
18
|
const requireAjv = createRequire(import.meta.url);
|
|
19
19
|
const Ajv = requireAjv('ajv');
|
|
20
|
-
|
|
21
|
-
// loader free of import-assert syntax.
|
|
22
|
-
function loadSchema() {
|
|
23
|
-
const schemaPath = new URL('./schema.json', import.meta.url);
|
|
24
|
-
return JSON.parse(readFileSync(schemaPath, 'utf-8'));
|
|
25
|
-
}
|
|
20
|
+
import { policySchema } from './schema.js';
|
|
26
21
|
let validator;
|
|
27
22
|
function getValidator() {
|
|
28
23
|
if (validator)
|
|
29
24
|
return validator;
|
|
30
25
|
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
31
|
-
|
|
26
|
+
// `policySchema` is the canonical schema as a TS literal; the equivalent
|
|
27
|
+
// `schema.json` is kept around for external tooling and the unit test
|
|
28
|
+
// `schema-sync.unit.test.ts` enforces they stay byte-equivalent.
|
|
29
|
+
validator = ajv.compile(policySchema);
|
|
32
30
|
return validator;
|
|
33
31
|
}
|
|
34
32
|
function walkJsonFiles(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/middleware/policy/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,gCAAgC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAA8C,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.js","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AM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAA;YACxC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,OAAO,eAAe,OAAO,EAAE,CAAC,CAAA;QACrF,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACnB,CAAC;IAED,uBAAuB;IACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,qCAAqC,CAAC,CAAA;QAClG,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,kCAAkC,CAAC,CAAA;QAC5F,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,oCAAoC,CAAC,CAAA;IAClG,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema (draft-07) describing a single policy entry.
|
|
3
|
+
*
|
|
4
|
+
* `schema.json` and `schema.ts` are kept in sync — both express the same
|
|
5
|
+
* contract. The JSON file remains the declarative source for external
|
|
6
|
+
* tooling (editor JSON Schema completion, meta-schema validators, docs).
|
|
7
|
+
* This TypeScript module is what the loader actually imports at runtime,
|
|
8
|
+
* because:
|
|
9
|
+
* 1. `tsc` ships it into `dist/` automatically (no asset-copy step needed);
|
|
10
|
+
* 2. it does not depend on `fs.readFileSync` or ESM JSON import assertions;
|
|
11
|
+
* 3. an `as const` literal gives downstream code real types if needed.
|
|
12
|
+
*
|
|
13
|
+
* A unit test (`test/middleware/policy/schema-sync.unit.test.ts`) asserts
|
|
14
|
+
* `policySchema` deep-equals `JSON.parse(readFileSync(schema.json))` so any
|
|
15
|
+
* drift between the two files is caught at CI.
|
|
16
|
+
*/
|
|
17
|
+
export declare const policySchema: {
|
|
18
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
19
|
+
readonly $id: "https://raffel.dev/schemas/json-policy.json";
|
|
20
|
+
readonly title: "JsonPolicy";
|
|
21
|
+
readonly description: "Authorization policy loadable from JSON. Either `match` or `customCondition` may be present, not both.";
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly required: readonly ["id", "effect", "principals", "actions", "resources"];
|
|
24
|
+
readonly additionalProperties: false;
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly id: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly minLength: 1;
|
|
29
|
+
};
|
|
30
|
+
readonly description: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly effect: {
|
|
34
|
+
readonly enum: readonly ["allow", "deny", "audit"];
|
|
35
|
+
};
|
|
36
|
+
readonly principals: {
|
|
37
|
+
readonly type: "array";
|
|
38
|
+
readonly items: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly actions: {
|
|
43
|
+
readonly type: "array";
|
|
44
|
+
readonly items: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly resources: {
|
|
49
|
+
readonly type: "array";
|
|
50
|
+
readonly items: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly match: {
|
|
55
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
56
|
+
};
|
|
57
|
+
readonly scope: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly properties: {
|
|
61
|
+
readonly routes: {
|
|
62
|
+
readonly type: "array";
|
|
63
|
+
readonly items: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly channels: {
|
|
68
|
+
readonly type: "array";
|
|
69
|
+
readonly items: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly protocols: {
|
|
74
|
+
readonly type: "array";
|
|
75
|
+
readonly items: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly customCondition: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly minLength: 1;
|
|
84
|
+
};
|
|
85
|
+
readonly _source: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
};
|
|
88
|
+
readonly _index: {
|
|
89
|
+
readonly type: "integer";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly not: {
|
|
93
|
+
readonly required: readonly ["match", "customCondition"];
|
|
94
|
+
};
|
|
95
|
+
readonly definitions: {
|
|
96
|
+
readonly MatchNode: {
|
|
97
|
+
readonly oneOf: readonly [{
|
|
98
|
+
readonly type: "object";
|
|
99
|
+
readonly properties: {
|
|
100
|
+
readonly anyOf: {
|
|
101
|
+
readonly type: "array";
|
|
102
|
+
readonly items: {
|
|
103
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
readonly required: readonly ["anyOf"];
|
|
108
|
+
readonly additionalProperties: false;
|
|
109
|
+
}, {
|
|
110
|
+
readonly type: "object";
|
|
111
|
+
readonly properties: {
|
|
112
|
+
readonly allOf: {
|
|
113
|
+
readonly type: "array";
|
|
114
|
+
readonly items: {
|
|
115
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
readonly required: readonly ["allOf"];
|
|
120
|
+
readonly additionalProperties: false;
|
|
121
|
+
}, {
|
|
122
|
+
readonly type: "object";
|
|
123
|
+
readonly properties: {
|
|
124
|
+
readonly not: {
|
|
125
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly required: readonly ["not"];
|
|
129
|
+
readonly additionalProperties: false;
|
|
130
|
+
}, {
|
|
131
|
+
readonly type: "object";
|
|
132
|
+
readonly additionalProperties: {
|
|
133
|
+
readonly $ref: "#/definitions/MatchValue";
|
|
134
|
+
};
|
|
135
|
+
}];
|
|
136
|
+
};
|
|
137
|
+
readonly MatchValue: {
|
|
138
|
+
readonly oneOf: readonly [{
|
|
139
|
+
readonly type: readonly ["string", "number", "boolean", "null"];
|
|
140
|
+
}, {
|
|
141
|
+
readonly $ref: "#/definitions/MatchOperator";
|
|
142
|
+
}];
|
|
143
|
+
};
|
|
144
|
+
readonly MatchOperator: {
|
|
145
|
+
readonly type: "object";
|
|
146
|
+
readonly additionalProperties: false;
|
|
147
|
+
readonly properties: {
|
|
148
|
+
readonly '==': {};
|
|
149
|
+
readonly '!=': {};
|
|
150
|
+
readonly '<': {
|
|
151
|
+
readonly type: readonly ["number", "string"];
|
|
152
|
+
};
|
|
153
|
+
readonly '<=': {
|
|
154
|
+
readonly type: readonly ["number", "string"];
|
|
155
|
+
};
|
|
156
|
+
readonly '>': {
|
|
157
|
+
readonly type: readonly ["number", "string"];
|
|
158
|
+
};
|
|
159
|
+
readonly '>=': {
|
|
160
|
+
readonly type: readonly ["number", "string"];
|
|
161
|
+
};
|
|
162
|
+
readonly in: {
|
|
163
|
+
readonly oneOf: readonly [{
|
|
164
|
+
readonly type: "array";
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
}];
|
|
168
|
+
};
|
|
169
|
+
readonly notIn: {
|
|
170
|
+
readonly oneOf: readonly [{
|
|
171
|
+
readonly type: "array";
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "string";
|
|
174
|
+
}];
|
|
175
|
+
};
|
|
176
|
+
readonly regex: {
|
|
177
|
+
readonly type: "string";
|
|
178
|
+
};
|
|
179
|
+
readonly startsWith: {
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
};
|
|
182
|
+
readonly endsWith: {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
};
|
|
185
|
+
readonly contains: {};
|
|
186
|
+
readonly exists: {
|
|
187
|
+
readonly type: "boolean";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly minProperties: 1;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/middleware/policy/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ff,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema (draft-07) describing a single policy entry.
|
|
3
|
+
*
|
|
4
|
+
* `schema.json` and `schema.ts` are kept in sync — both express the same
|
|
5
|
+
* contract. The JSON file remains the declarative source for external
|
|
6
|
+
* tooling (editor JSON Schema completion, meta-schema validators, docs).
|
|
7
|
+
* This TypeScript module is what the loader actually imports at runtime,
|
|
8
|
+
* because:
|
|
9
|
+
* 1. `tsc` ships it into `dist/` automatically (no asset-copy step needed);
|
|
10
|
+
* 2. it does not depend on `fs.readFileSync` or ESM JSON import assertions;
|
|
11
|
+
* 3. an `as const` literal gives downstream code real types if needed.
|
|
12
|
+
*
|
|
13
|
+
* A unit test (`test/middleware/policy/schema-sync.unit.test.ts`) asserts
|
|
14
|
+
* `policySchema` deep-equals `JSON.parse(readFileSync(schema.json))` so any
|
|
15
|
+
* drift between the two files is caught at CI.
|
|
16
|
+
*/
|
|
17
|
+
export const policySchema = {
|
|
18
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
19
|
+
$id: 'https://raffel.dev/schemas/json-policy.json',
|
|
20
|
+
title: 'JsonPolicy',
|
|
21
|
+
description: 'Authorization policy loadable from JSON. Either `match` or `customCondition` may be present, not both.',
|
|
22
|
+
type: 'object',
|
|
23
|
+
required: ['id', 'effect', 'principals', 'actions', 'resources'],
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
properties: {
|
|
26
|
+
id: { type: 'string', minLength: 1 },
|
|
27
|
+
description: { type: 'string' },
|
|
28
|
+
effect: { enum: ['allow', 'deny', 'audit'] },
|
|
29
|
+
principals: { type: 'array', items: { type: 'string' } },
|
|
30
|
+
actions: { type: 'array', items: { type: 'string' } },
|
|
31
|
+
resources: { type: 'array', items: { type: 'string' } },
|
|
32
|
+
match: { $ref: '#/definitions/MatchNode' },
|
|
33
|
+
scope: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
properties: {
|
|
37
|
+
routes: { type: 'array', items: { type: 'string' } },
|
|
38
|
+
channels: { type: 'array', items: { type: 'string' } },
|
|
39
|
+
protocols: { type: 'array', items: { type: 'string' } },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
customCondition: { type: 'string', minLength: 1 },
|
|
43
|
+
_source: { type: 'string' },
|
|
44
|
+
_index: { type: 'integer' },
|
|
45
|
+
},
|
|
46
|
+
not: {
|
|
47
|
+
required: ['match', 'customCondition'],
|
|
48
|
+
},
|
|
49
|
+
definitions: {
|
|
50
|
+
MatchNode: {
|
|
51
|
+
oneOf: [
|
|
52
|
+
{
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
anyOf: { type: 'array', items: { $ref: '#/definitions/MatchNode' } },
|
|
56
|
+
},
|
|
57
|
+
required: ['anyOf'],
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
allOf: { type: 'array', items: { $ref: '#/definitions/MatchNode' } },
|
|
64
|
+
},
|
|
65
|
+
required: ['allOf'],
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {
|
|
71
|
+
not: { $ref: '#/definitions/MatchNode' },
|
|
72
|
+
},
|
|
73
|
+
required: ['not'],
|
|
74
|
+
additionalProperties: false,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'object',
|
|
78
|
+
additionalProperties: { $ref: '#/definitions/MatchValue' },
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
MatchValue: {
|
|
83
|
+
oneOf: [
|
|
84
|
+
{ type: ['string', 'number', 'boolean', 'null'] },
|
|
85
|
+
{ $ref: '#/definitions/MatchOperator' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
MatchOperator: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
additionalProperties: false,
|
|
91
|
+
properties: {
|
|
92
|
+
'==': {},
|
|
93
|
+
'!=': {},
|
|
94
|
+
'<': { type: ['number', 'string'] },
|
|
95
|
+
'<=': { type: ['number', 'string'] },
|
|
96
|
+
'>': { type: ['number', 'string'] },
|
|
97
|
+
'>=': { type: ['number', 'string'] },
|
|
98
|
+
in: { oneOf: [{ type: 'array' }, { type: 'string' }] },
|
|
99
|
+
notIn: { oneOf: [{ type: 'array' }, { type: 'string' }] },
|
|
100
|
+
regex: { type: 'string' },
|
|
101
|
+
startsWith: { type: 'string' },
|
|
102
|
+
endsWith: { type: 'string' },
|
|
103
|
+
contains: {},
|
|
104
|
+
exists: { type: 'boolean' },
|
|
105
|
+
},
|
|
106
|
+
minProperties: 1,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/middleware/policy/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,yCAAyC;IAClD,GAAG,EAAE,6CAA6C;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EACT,wGAAwG;IAC1G,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC;IAChE,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;QACpC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC5C,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACxD,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACrD,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACvD,KAAK,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;QAC1C,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,K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ACD,aAAa,EAAE,CAAC;SACjB;KACF;CACO,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/middleware/policy/co-located/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAA;AAEpF,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,eAAe,CAAA;AAuBtB,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,oBAAoB,EAAE,CAAA;CAC9B;AAiDD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CA0C9B"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema (draft-07) describing a single policy entry.
|
|
3
|
+
*
|
|
4
|
+
* `schema.json` and `schema.ts` are kept in sync — both express the same
|
|
5
|
+
* contract. The JSON file remains the declarative source for external
|
|
6
|
+
* tooling (editor JSON Schema completion, meta-schema validators, docs).
|
|
7
|
+
* This TypeScript module is what the loader actually imports at runtime,
|
|
8
|
+
* because:
|
|
9
|
+
* 1. `tsc` ships it into `dist/` automatically (no asset-copy step needed);
|
|
10
|
+
* 2. it does not depend on `fs.readFileSync` or ESM JSON import assertions;
|
|
11
|
+
* 3. an `as const` literal gives downstream code real types if needed.
|
|
12
|
+
*
|
|
13
|
+
* A unit test (`test/middleware/policy/schema-sync.unit.test.ts`) asserts
|
|
14
|
+
* `policySchema` deep-equals `JSON.parse(readFileSync(schema.json))` so any
|
|
15
|
+
* drift between the two files is caught at CI.
|
|
16
|
+
*/
|
|
17
|
+
export declare const policySchema: {
|
|
18
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
19
|
+
readonly $id: "https://raffel.dev/schemas/json-policy.json";
|
|
20
|
+
readonly title: "JsonPolicy";
|
|
21
|
+
readonly description: "Authorization policy loadable from JSON. Either `match` or `customCondition` may be present, not both.";
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly required: readonly ["id", "effect", "principals", "actions", "resources"];
|
|
24
|
+
readonly additionalProperties: false;
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly id: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly minLength: 1;
|
|
29
|
+
};
|
|
30
|
+
readonly description: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly effect: {
|
|
34
|
+
readonly enum: readonly ["allow", "deny", "audit"];
|
|
35
|
+
};
|
|
36
|
+
readonly principals: {
|
|
37
|
+
readonly type: "array";
|
|
38
|
+
readonly items: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly actions: {
|
|
43
|
+
readonly type: "array";
|
|
44
|
+
readonly items: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly resources: {
|
|
49
|
+
readonly type: "array";
|
|
50
|
+
readonly items: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly match: {
|
|
55
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
56
|
+
};
|
|
57
|
+
readonly scope: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly properties: {
|
|
61
|
+
readonly routes: {
|
|
62
|
+
readonly type: "array";
|
|
63
|
+
readonly items: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly channels: {
|
|
68
|
+
readonly type: "array";
|
|
69
|
+
readonly items: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly protocols: {
|
|
74
|
+
readonly type: "array";
|
|
75
|
+
readonly items: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly customCondition: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly minLength: 1;
|
|
84
|
+
};
|
|
85
|
+
readonly _source: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
};
|
|
88
|
+
readonly _index: {
|
|
89
|
+
readonly type: "integer";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly not: {
|
|
93
|
+
readonly required: readonly ["match", "customCondition"];
|
|
94
|
+
};
|
|
95
|
+
readonly definitions: {
|
|
96
|
+
readonly MatchNode: {
|
|
97
|
+
readonly oneOf: readonly [{
|
|
98
|
+
readonly type: "object";
|
|
99
|
+
readonly properties: {
|
|
100
|
+
readonly anyOf: {
|
|
101
|
+
readonly type: "array";
|
|
102
|
+
readonly items: {
|
|
103
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
readonly required: readonly ["anyOf"];
|
|
108
|
+
readonly additionalProperties: false;
|
|
109
|
+
}, {
|
|
110
|
+
readonly type: "object";
|
|
111
|
+
readonly properties: {
|
|
112
|
+
readonly allOf: {
|
|
113
|
+
readonly type: "array";
|
|
114
|
+
readonly items: {
|
|
115
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
readonly required: readonly ["allOf"];
|
|
120
|
+
readonly additionalProperties: false;
|
|
121
|
+
}, {
|
|
122
|
+
readonly type: "object";
|
|
123
|
+
readonly properties: {
|
|
124
|
+
readonly not: {
|
|
125
|
+
readonly $ref: "#/definitions/MatchNode";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly required: readonly ["not"];
|
|
129
|
+
readonly additionalProperties: false;
|
|
130
|
+
}, {
|
|
131
|
+
readonly type: "object";
|
|
132
|
+
readonly additionalProperties: {
|
|
133
|
+
readonly $ref: "#/definitions/MatchValue";
|
|
134
|
+
};
|
|
135
|
+
}];
|
|
136
|
+
};
|
|
137
|
+
readonly MatchValue: {
|
|
138
|
+
readonly oneOf: readonly [{
|
|
139
|
+
readonly type: readonly ["string", "number", "boolean", "null"];
|
|
140
|
+
}, {
|
|
141
|
+
readonly $ref: "#/definitions/MatchOperator";
|
|
142
|
+
}];
|
|
143
|
+
};
|
|
144
|
+
readonly MatchOperator: {
|
|
145
|
+
readonly type: "object";
|
|
146
|
+
readonly additionalProperties: false;
|
|
147
|
+
readonly properties: {
|
|
148
|
+
readonly '==': {};
|
|
149
|
+
readonly '!=': {};
|
|
150
|
+
readonly '<': {
|
|
151
|
+
readonly type: readonly ["number", "string"];
|
|
152
|
+
};
|
|
153
|
+
readonly '<=': {
|
|
154
|
+
readonly type: readonly ["number", "string"];
|
|
155
|
+
};
|
|
156
|
+
readonly '>': {
|
|
157
|
+
readonly type: readonly ["number", "string"];
|
|
158
|
+
};
|
|
159
|
+
readonly '>=': {
|
|
160
|
+
readonly type: readonly ["number", "string"];
|
|
161
|
+
};
|
|
162
|
+
readonly in: {
|
|
163
|
+
readonly oneOf: readonly [{
|
|
164
|
+
readonly type: "array";
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
}];
|
|
168
|
+
};
|
|
169
|
+
readonly notIn: {
|
|
170
|
+
readonly oneOf: readonly [{
|
|
171
|
+
readonly type: "array";
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "string";
|
|
174
|
+
}];
|
|
175
|
+
};
|
|
176
|
+
readonly regex: {
|
|
177
|
+
readonly type: "string";
|
|
178
|
+
};
|
|
179
|
+
readonly startsWith: {
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
};
|
|
182
|
+
readonly endsWith: {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
};
|
|
185
|
+
readonly contains: {};
|
|
186
|
+
readonly exists: {
|
|
187
|
+
readonly type: "boolean";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly minProperties: 1;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/middleware/policy/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ff,CAAA"}
|