@atlasauth/pca-analyzer 0.0.0-stage → 0.1.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 +89 -2
- package/dist/caveats.d.ts +22 -0
- package/dist/caveats.js +88 -0
- package/dist/caveats.js.map +1 -0
- package/dist/enumerate.d.ts +68 -0
- package/dist/enumerate.js +375 -0
- package/dist/enumerate.js.map +1 -0
- package/dist/field.d.ts +42 -0
- package/dist/field.js +232 -0
- package/dist/field.js.map +1 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +374 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +109 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumerate.js","sourceRoot":"","sources":["../src/enumerate.ts"],"names":[],"mappings":";;;AAyCA,0CAIC;AA2CD,0BAWC;AA8BD,sCAyEC;AAED,kCAIC;AAqCD,0CAUC;AAwGD,wBAKC;AAGD,oCAWC;AAED,kCAOC;AAeD,wBAMC;AAxZD,wCAAuF;AAEvF,uCAA2C;AAC3C,mCAAsC;AACtC,mCAA8C;AAG9C;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAG9D,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAC5D,MAAM,cAAc,GAAG,4CAA4C,CAAC;AAEpE,+EAA+E;AAClE,QAAA,wBAAwB,GAAG,OAAO,CAAC;AAahD,SAAgB,eAAe,CAAC,CAAc;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,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SAAgB,MAAM,CAAC,EAAU,EAAE,SAAgC,EAAE,GAAW;IAC9E,IAAI,WAAW,CAAC,EAAE,CAAC,GAAG,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACrD,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;QACtC,IAAI,SAAS,CAAC,GAAG,CAAC;YAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/field.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Condition, type ConditionOp } from '@atlasauth/pca';
|
|
2
|
+
/**
|
|
3
|
+
* The interval + finite-set engine for a single `where` field.
|
|
4
|
+
*
|
|
5
|
+
* PCA's `where` conditions over one field are a conjunction of threshold tests (lt/lte/gt/gte/eq on
|
|
6
|
+
* numbers), membership tests (eq/ne/in/nin over finite values) and string-prefix tests. Any such
|
|
7
|
+
* conjunction partitions the value line into finitely many CELLS on which every condition is constant,
|
|
8
|
+
* bounded by the literals that appear. Picking one representative value per cell is therefore a SOUND
|
|
9
|
+
* AND COMPLETE probe set for the decided fragment: two policies agree on all actions iff they agree on
|
|
10
|
+
* all actions drawn from these representatives (the finite-distinguishing-value property that makes the
|
|
11
|
+
* relational queries decidable by enumeration — see enumerate.ts).
|
|
12
|
+
*
|
|
13
|
+
* `ref` conditions (operand is another field) are NOT a single-field constraint; they are flagged
|
|
14
|
+
* upstream as undecidable and skipped here.
|
|
15
|
+
*/
|
|
16
|
+
/** A sentinel string guaranteed not to equal, be a prefix of, or be prefixed by any policy literal. */
|
|
17
|
+
export declare const FRESH_STRING = "\0atlas-analyzer::fresh-unmatched\0";
|
|
18
|
+
/**
|
|
19
|
+
* Compute the representative probe values for one field from the conjunction of `where` conditions on
|
|
20
|
+
* it. The result is finite and distinguishing for the decided fragment. The caller adds an `absent`
|
|
21
|
+
* representative separately (to probe `exists` and the params-absent fail-closed semantics).
|
|
22
|
+
*/
|
|
23
|
+
export declare function fieldProbes(conditions: readonly Condition[]): unknown[];
|
|
24
|
+
export interface NumInterval {
|
|
25
|
+
lo: number;
|
|
26
|
+
loInclusive: boolean;
|
|
27
|
+
hi: number;
|
|
28
|
+
hiInclusive: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const FULL_INTERVAL: NumInterval;
|
|
31
|
+
/** Tighten an interval by one numeric condition. Returns the same interval for non-numeric operands. */
|
|
32
|
+
export declare function tightenInterval(iv: NumInterval, op: ConditionOp, value: unknown): NumInterval;
|
|
33
|
+
/** An interval is empty iff lo > hi, or lo == hi with either bound exclusive. */
|
|
34
|
+
export declare function intervalEmpty(iv: NumInterval): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Decide whether the numeric subset of a field's `where` conjunction is satisfiable. Detects, e.g.,
|
|
37
|
+
* `amount >= 100 AND amount <= 10` as unsatisfiable (empty interval). Conditions with non-numeric or
|
|
38
|
+
* `ref` operands, and boolean groupings (all_of/any_of/not), do not participate (they are decided by
|
|
39
|
+
* the finite-set / enumeration path); ignoring them only ever widens the interval, so a satisfiable
|
|
40
|
+
* verdict here is sound as a necessary condition.
|
|
41
|
+
*/
|
|
42
|
+
export declare function numericConjunctionSatisfiable(conditions: readonly Condition[]): boolean;
|
package/dist/field.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FULL_INTERVAL = exports.FRESH_STRING = void 0;
|
|
4
|
+
exports.fieldProbes = fieldProbes;
|
|
5
|
+
exports.tightenInterval = tightenInterval;
|
|
6
|
+
exports.intervalEmpty = intervalEmpty;
|
|
7
|
+
exports.numericConjunctionSatisfiable = numericConjunctionSatisfiable;
|
|
8
|
+
const pca_1 = require("@atlasauth/pca");
|
|
9
|
+
/**
|
|
10
|
+
* The interval + finite-set engine for a single `where` field.
|
|
11
|
+
*
|
|
12
|
+
* PCA's `where` conditions over one field are a conjunction of threshold tests (lt/lte/gt/gte/eq on
|
|
13
|
+
* numbers), membership tests (eq/ne/in/nin over finite values) and string-prefix tests. Any such
|
|
14
|
+
* conjunction partitions the value line into finitely many CELLS on which every condition is constant,
|
|
15
|
+
* bounded by the literals that appear. Picking one representative value per cell is therefore a SOUND
|
|
16
|
+
* AND COMPLETE probe set for the decided fragment: two policies agree on all actions iff they agree on
|
|
17
|
+
* all actions drawn from these representatives (the finite-distinguishing-value property that makes the
|
|
18
|
+
* relational queries decidable by enumeration — see enumerate.ts).
|
|
19
|
+
*
|
|
20
|
+
* `ref` conditions (operand is another field) are NOT a single-field constraint; they are flagged
|
|
21
|
+
* upstream as undecidable and skipped here.
|
|
22
|
+
*/
|
|
23
|
+
/** A sentinel string guaranteed not to equal, be a prefix of, or be prefixed by any policy literal. */
|
|
24
|
+
exports.FRESH_STRING = '\u0000atlas-analyzer::fresh-unmatched\u0000';
|
|
25
|
+
function isFiniteNumber(v) {
|
|
26
|
+
return typeof v === 'number' && Number.isFinite(v);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Representatives of a numeric threshold arrangement: below the min, each threshold exactly, the open
|
|
30
|
+
* interval between each pair of consecutive thresholds (its midpoint), and above the max. This is the
|
|
31
|
+
* minimal set on which every `x {lt,lte,gt,gte,eq} t` built from these thresholds is constant per cell.
|
|
32
|
+
*/
|
|
33
|
+
function numericCellReps(thresholds) {
|
|
34
|
+
const sorted = [...new Set(thresholds)].filter(Number.isFinite).sort((a, b) => a - b);
|
|
35
|
+
if (sorted.length === 0)
|
|
36
|
+
return [];
|
|
37
|
+
const first = sorted[0];
|
|
38
|
+
const last = sorted[sorted.length - 1];
|
|
39
|
+
if (first === undefined || last === undefined)
|
|
40
|
+
return [];
|
|
41
|
+
const out = [first - 1];
|
|
42
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
43
|
+
const ti = sorted[i];
|
|
44
|
+
if (ti === undefined)
|
|
45
|
+
continue;
|
|
46
|
+
out.push(ti);
|
|
47
|
+
const tn = sorted[i + 1];
|
|
48
|
+
if (tn !== undefined)
|
|
49
|
+
out.push((ti + tn) / 2);
|
|
50
|
+
}
|
|
51
|
+
out.push(last + 1);
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** A stable key for de-duplicating representative values of mixed type. */
|
|
55
|
+
function valueKey(x) {
|
|
56
|
+
if (x === exports.FRESH_STRING)
|
|
57
|
+
return 's:__fresh__';
|
|
58
|
+
try {
|
|
59
|
+
return typeof x + ':' + JSON.stringify(x);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return typeof x + ':<unserializable>';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Compute the representative probe values for one field from the conjunction of `where` conditions on
|
|
67
|
+
* it. The result is finite and distinguishing for the decided fragment. The caller adds an `absent`
|
|
68
|
+
* representative separately (to probe `exists` and the params-absent fail-closed semantics).
|
|
69
|
+
*/
|
|
70
|
+
function fieldProbes(conditions) {
|
|
71
|
+
const literals = [];
|
|
72
|
+
const thresholds = [];
|
|
73
|
+
const prefixes = [];
|
|
74
|
+
let hasNumericOp = false;
|
|
75
|
+
for (const c of conditions) {
|
|
76
|
+
// Group conditions (all_of/any_of/not) are flattened to their leaves upstream by `collectProbes`;
|
|
77
|
+
// a cross-field `ref` relation is undecidable and also handled upstream. Skip either here.
|
|
78
|
+
if (!(0, pca_1.isLeafCondition)(c) || c.ref !== undefined)
|
|
79
|
+
continue;
|
|
80
|
+
const v = c.value;
|
|
81
|
+
switch (c.op) {
|
|
82
|
+
case 'eq':
|
|
83
|
+
case 'ne':
|
|
84
|
+
literals.push(v);
|
|
85
|
+
if (isFiniteNumber(v)) {
|
|
86
|
+
thresholds.push(v);
|
|
87
|
+
hasNumericOp = true;
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
case 'in':
|
|
91
|
+
case 'nin':
|
|
92
|
+
if (Array.isArray(v)) {
|
|
93
|
+
for (const x of v) {
|
|
94
|
+
literals.push(x);
|
|
95
|
+
if (isFiniteNumber(x)) {
|
|
96
|
+
thresholds.push(x);
|
|
97
|
+
hasNumericOp = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case 'lt':
|
|
103
|
+
case 'lte':
|
|
104
|
+
case 'gt':
|
|
105
|
+
case 'gte':
|
|
106
|
+
if (isFiniteNumber(v)) {
|
|
107
|
+
thresholds.push(v);
|
|
108
|
+
hasNumericOp = true;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case 'prefix':
|
|
112
|
+
case 'like':
|
|
113
|
+
case 'matches':
|
|
114
|
+
case 'is_a':
|
|
115
|
+
// The literal and a strictly-extending variant give the enumerator something to hit; the op
|
|
116
|
+
// itself is flagged undecidable, so the verdict fails safe regardless.
|
|
117
|
+
if (typeof v === 'string') {
|
|
118
|
+
literals.push(v);
|
|
119
|
+
if (c.op === 'prefix')
|
|
120
|
+
prefixes.push(v);
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
case 'member_of':
|
|
124
|
+
if (typeof v === 'string')
|
|
125
|
+
literals.push(v);
|
|
126
|
+
else if (Array.isArray(v))
|
|
127
|
+
for (const x of v)
|
|
128
|
+
if (typeof x === 'string')
|
|
129
|
+
literals.push(x);
|
|
130
|
+
break;
|
|
131
|
+
case 'exists':
|
|
132
|
+
default:
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const out = [];
|
|
137
|
+
const seen = new Set();
|
|
138
|
+
const add = (x) => {
|
|
139
|
+
const k = valueKey(x);
|
|
140
|
+
if (!seen.has(k)) {
|
|
141
|
+
seen.add(k);
|
|
142
|
+
out.push(x);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
for (const l of literals)
|
|
146
|
+
add(l);
|
|
147
|
+
for (const n of numericCellReps(thresholds))
|
|
148
|
+
add(n);
|
|
149
|
+
for (const p of prefixes) {
|
|
150
|
+
add(p);
|
|
151
|
+
add(p + 'x'); // a value strictly extending the prefix (distinguishes prefix from exact)
|
|
152
|
+
}
|
|
153
|
+
add(exports.FRESH_STRING); // a value matching no eq/in/prefix literal
|
|
154
|
+
if (hasNumericOp && thresholds.length > 0) {
|
|
155
|
+
const mx = Math.max(...thresholds);
|
|
156
|
+
if (Number.isFinite(mx))
|
|
157
|
+
add(mx + 1); // a value above every numeric threshold
|
|
158
|
+
}
|
|
159
|
+
return out;
|
|
160
|
+
}
|
|
161
|
+
exports.FULL_INTERVAL = { lo: -Infinity, loInclusive: false, hi: Infinity, hiInclusive: false };
|
|
162
|
+
/** Tighten an interval by one numeric condition. Returns the same interval for non-numeric operands. */
|
|
163
|
+
function tightenInterval(iv, op, value) {
|
|
164
|
+
if (!isFiniteNumber(value))
|
|
165
|
+
return iv;
|
|
166
|
+
const next = { ...iv };
|
|
167
|
+
switch (op) {
|
|
168
|
+
case 'eq':
|
|
169
|
+
if (value > next.lo || (value === next.lo && !next.loInclusive)) {
|
|
170
|
+
next.lo = value;
|
|
171
|
+
next.loInclusive = true;
|
|
172
|
+
}
|
|
173
|
+
if (value < next.hi || (value === next.hi && !next.hiInclusive)) {
|
|
174
|
+
next.hi = value;
|
|
175
|
+
next.hiInclusive = true;
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case 'gte':
|
|
179
|
+
// A stricter existing lower bound (gt at the same value) is kept; only a higher value binds.
|
|
180
|
+
if (value > next.lo) {
|
|
181
|
+
next.lo = value;
|
|
182
|
+
next.loInclusive = true;
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case 'gt':
|
|
186
|
+
if (value > next.lo || (value === next.lo && next.loInclusive)) {
|
|
187
|
+
next.lo = value;
|
|
188
|
+
next.loInclusive = false;
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
case 'lte':
|
|
192
|
+
if (value < next.hi) {
|
|
193
|
+
next.hi = value;
|
|
194
|
+
next.hiInclusive = true;
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
case 'lt':
|
|
198
|
+
if (value < next.hi || (value === next.hi && next.hiInclusive)) {
|
|
199
|
+
next.hi = value;
|
|
200
|
+
next.hiInclusive = false;
|
|
201
|
+
}
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
return next;
|
|
207
|
+
}
|
|
208
|
+
/** An interval is empty iff lo > hi, or lo == hi with either bound exclusive. */
|
|
209
|
+
function intervalEmpty(iv) {
|
|
210
|
+
if (iv.lo > iv.hi)
|
|
211
|
+
return true;
|
|
212
|
+
if (iv.lo === iv.hi)
|
|
213
|
+
return !(iv.loInclusive && iv.hiInclusive);
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Decide whether the numeric subset of a field's `where` conjunction is satisfiable. Detects, e.g.,
|
|
218
|
+
* `amount >= 100 AND amount <= 10` as unsatisfiable (empty interval). Conditions with non-numeric or
|
|
219
|
+
* `ref` operands, and boolean groupings (all_of/any_of/not), do not participate (they are decided by
|
|
220
|
+
* the finite-set / enumeration path); ignoring them only ever widens the interval, so a satisfiable
|
|
221
|
+
* verdict here is sound as a necessary condition.
|
|
222
|
+
*/
|
|
223
|
+
function numericConjunctionSatisfiable(conditions) {
|
|
224
|
+
let iv = exports.FULL_INTERVAL;
|
|
225
|
+
for (const c of conditions) {
|
|
226
|
+
if (!(0, pca_1.isLeafCondition)(c) || c.ref !== undefined)
|
|
227
|
+
continue;
|
|
228
|
+
iv = tightenInterval(iv, c.op, c.value);
|
|
229
|
+
}
|
|
230
|
+
return !intervalEmpty(iv);
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":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atlasauth/pca-analyzer — STATIC ANALYZABILITY OF AUTHORITY.
|
|
3
|
+
*
|
|
4
|
+
* PCA can prove a quantitative trust-budget bound and verify a single action, but on its own it cannot
|
|
5
|
+
* statically answer "what can this whole delegated authority EVER do?". This package decides that over
|
|
6
|
+
* PCA's predicate/caveat policy: reachability, vacuity/totality, delegation-safety subsumption,
|
|
7
|
+
* disjointness, equivalence, and — the distinct safety check — conformance to a declared intent
|
|
8
|
+
* envelope (the "$14k renewal under a $10k cap on an approved vendor still violates intent" class).
|
|
9
|
+
*
|
|
10
|
+
* The engine is a SOUND, BOUNDED decision procedure (Cedar/SymCC-style, but with no SMT dependency):
|
|
11
|
+
* it enumerates a finite, distinguishing set of representative actions built from the literals,
|
|
12
|
+
* thresholds, prefixes, verbs and resource matchers in the policies, and evaluates the REAL
|
|
13
|
+
* `evaluatePredicates` at each. See README.md for the exact decided fragment and the honest
|
|
14
|
+
* incompleteness boundary. Soundness rule: a verdict is reported as proven only when the fragment is
|
|
15
|
+
* fully decided; otherwise it fails safe and is marked `approximate`.
|
|
16
|
+
*/
|
|
17
|
+
import type { Condition } from '@atlasauth/pca';
|
|
18
|
+
import { admits, admitsAction, collectProbes, repToAction, representatives, search, type Rep } from './enumerate';
|
|
19
|
+
import type { AlwaysAllowsResult, AlwaysDeniesResult, AnalyzerAction, DisjointResult, EquivalentResult, Intent, IntentConformanceResult, PolicyInput, ReachableResult, SubsumesResult } from './types';
|
|
20
|
+
export * from './types';
|
|
21
|
+
export { analyzeCaveats } from './caveats';
|
|
22
|
+
export type { CaveatAnalysis } from './caveats';
|
|
23
|
+
export { numericConjunctionSatisfiable, tightenInterval, intervalEmpty, FULL_INTERVAL, type NumInterval, } from './field';
|
|
24
|
+
export { DEFAULT_MAX_COMBINATIONS, toModel, type PolicyModel } from './enumerate';
|
|
25
|
+
export interface AnalyzerOptions {
|
|
26
|
+
/** Cap on the representative grid size; a larger grid fails safe (`approximate`). */
|
|
27
|
+
maxCombinations?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Can any input complete `action` into one the policy ALLOWs? (some predicate matches AND the caveat
|
|
31
|
+
* set is satisfiable). `verb` and `resource` are taken as given; unspecified `params` / `subject` /
|
|
32
|
+
* `env` fields are existentially searched. A returned `witness` is a concrete action verified against
|
|
33
|
+
* the real evaluator, so `reachable: true` is always proven. `reachable: false` is proven only for the
|
|
34
|
+
* decided fragment; otherwise it fails safe to `reachable: true, approximate: true`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function reachable(policy: PolicyInput, action: AnalyzerAction, opts?: AnalyzerOptions): ReachableResult;
|
|
37
|
+
/**
|
|
38
|
+
* Is the policy vacuous — does it deny everything (optionally restricted to `verb`)? Proven only for
|
|
39
|
+
* the decided fragment; any undecidable feature or grid overflow fails safe to `alwaysDenies: false`
|
|
40
|
+
* (assume it can admit something).
|
|
41
|
+
*/
|
|
42
|
+
export declare function alwaysDenies(policy: PolicyInput, verb?: string, opts?: AnalyzerOptions): AlwaysDeniesResult;
|
|
43
|
+
/**
|
|
44
|
+
* Is the policy total for `verb` — does it admit EVERY action of that verb (any resource, any params)?
|
|
45
|
+
* Proven only for the decided fragment; any undecidable feature or grid overflow fails safe to
|
|
46
|
+
* `alwaysAllows: false`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function alwaysAllows(policy: PolicyInput, verb: string, opts?: AnalyzerOptions): AlwaysAllowsResult;
|
|
49
|
+
/**
|
|
50
|
+
* Does policy `a` permit everything `b` permits (admitted(b) ⊆ admitted(a))? This is the
|
|
51
|
+
* delegation-safety check: a child capability must be subsumed by its parent. A counterexample is an
|
|
52
|
+
* action `b` admits that `a` denies. Proven only for the decided fragment; any undecidable feature in
|
|
53
|
+
* either policy, or grid overflow, fails safe to `subsumes: false`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function subsumes(a: PolicyInput, b: PolicyInput, opts?: AnalyzerOptions): SubsumesResult;
|
|
56
|
+
/**
|
|
57
|
+
* Are the two policies' admitted sets disjoint (no action both admit)? A witness is an action both
|
|
58
|
+
* admit. Proven only for the decided fragment; otherwise fails safe to `disjoint: false`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function disjoint(a: PolicyInput, b: PolicyInput, opts?: AnalyzerOptions): DisjointResult;
|
|
61
|
+
/**
|
|
62
|
+
* Do the two policies admit exactly the same actions? A counterexample is an action admitted by one
|
|
63
|
+
* but not the other. Proven only for the decided fragment; otherwise fails safe to `equivalent: false`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function equivalent(a: PolicyInput, b: PolicyInput, opts?: AnalyzerOptions): EquivalentResult;
|
|
66
|
+
/**
|
|
67
|
+
* Does the policy admit ONLY actions inside the declared `intent` envelope (allowed verbs + resource
|
|
68
|
+
* scopes + an amount ceiling)? This is the key safety check distinct from the runtime trust-budget: an
|
|
69
|
+
* action can pass the policy's predicates and stay under budget yet still fall outside what the
|
|
70
|
+
* principal intended — e.g. a $14k renewal admitted under a $10k intent cap because the policy's own
|
|
71
|
+
* ceiling is higher (or absent). Each reported violation is a concrete admitted action outside the
|
|
72
|
+
* envelope, so `conforms: false` with violations is always proven. `conforms: true` is proven only for
|
|
73
|
+
* the decided fragment; an undecidable policy feature, a `re:` intent scope, or grid overflow fails
|
|
74
|
+
* safe to `conforms: false, approximate: true` with no violations listed.
|
|
75
|
+
*/
|
|
76
|
+
export declare function intentConformance(policy: PolicyInput, intent: Intent, opts?: AnalyzerOptions): IntentConformanceResult;
|
|
77
|
+
/** Concrete, exact admission check for a fully-specified action (no existential search). */
|
|
78
|
+
export declare function admitsConcrete(policy: PolicyInput, action: AnalyzerAction): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a predicate's own numeric `where` conjunction is satisfiable (an explicit use of the interval
|
|
81
|
+
* engine; e.g. `amount >= 100 AND amount <= 10` is not). Non-numeric / `ref` conditions are ignored.
|
|
82
|
+
*/
|
|
83
|
+
export declare function predicateNumericSatisfiable(where: readonly Condition[] | undefined): boolean;
|
|
84
|
+
export { admits, admitsAction, collectProbes, representatives, repToAction, search, type Rep };
|