@armoriq/policy-ir 0.1.2 → 0.1.3
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 +1 -0
- package/dist/document-entry-CDOQVeis.d.cts +229 -0
- package/dist/document-entry-CDOQVeis.d.ts +229 -0
- package/dist/document.cjs +722 -0
- package/dist/document.cjs.map +1 -0
- package/dist/document.d.cts +1 -0
- package/dist/document.d.ts +1 -0
- package/dist/document.js +688 -0
- package/dist/document.js.map +1 -0
- package/dist/index.cjs +117 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -228
- package/dist/index.d.ts +3 -228
- package/dist/index.js +117 -14
- package/dist/index.js.map +1 -1
- package/dist/vectors.cjs +43 -1
- package/dist/vectors.cjs.map +1 -1
- package/dist/vectors.js +43 -1
- package/dist/vectors.js.map +1 -1
- package/package.json +29 -6
- package/vectors/document.json +6 -0
- package/vectors/evaluate.json +37 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ exported from this package, is what every evaluator must pass before release.
|
|
|
16
16
|
| `policyHash(document)` | `sha256:` over the canonical document without `policyHash` |
|
|
17
17
|
| `schemaHash(inputSchema)` | `sha256:` over the canonicalized tool input schema, as the SDKs and the tool inventory compute it |
|
|
18
18
|
| `@armoriq/policy-ir/vectors` | the fixtures: canonical forms, policy hashes, schema hashes |
|
|
19
|
+
| `@armoriq/policy-ir/document` | `parseYaml`, `parseDocument`, `validate`, `serialize` and the source grammar types, with no Node built-ins, for browsers |
|
|
19
20
|
|
|
20
21
|
C0 is complete in this package; the conmap binding of the inventory port and the compile endpoint follow in conmap-auto.
|
|
21
22
|
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
type Severity = 'error' | 'warning';
|
|
2
|
+
interface Diagnostic {
|
|
3
|
+
code: string;
|
|
4
|
+
severity: Severity;
|
|
5
|
+
/** JSON-pointer-like path into the source document, `/spec/tools/rules/Bash/0`. */
|
|
6
|
+
path: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
declare class Diagnostics {
|
|
10
|
+
readonly items: Diagnostic[];
|
|
11
|
+
error(code: string, path: string, message: string): void;
|
|
12
|
+
warning(code: string, path: string, message: string): void;
|
|
13
|
+
get hasErrors(): boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* `armor.policy.v2` intermediate representation.
|
|
18
|
+
*
|
|
19
|
+
* Data, never a program: the same JSON is evaluated by conmap, the Armor CLI
|
|
20
|
+
* daemon, the SDK pre-check and OPA. The document is the hashing and signing
|
|
21
|
+
* boundary, so every field here is part of `policyHash` except `policyHash`.
|
|
22
|
+
*/
|
|
23
|
+
declare const SCHEMA_VERSION: "armor.policy.v2";
|
|
24
|
+
type Verdict = 'allow' | 'hold' | 'block';
|
|
25
|
+
/** Where a document sits in the layering ladder. A boundary is a floor: it can only tighten. */
|
|
26
|
+
type Layer = 'floor' | 'group' | 'agent' | 'member' | 'local';
|
|
27
|
+
type PolicyTarget = {
|
|
28
|
+
org: '*';
|
|
29
|
+
} | {
|
|
30
|
+
group: string;
|
|
31
|
+
} | {
|
|
32
|
+
agent: string;
|
|
33
|
+
mcpServers?: string[];
|
|
34
|
+
} | {
|
|
35
|
+
device: 'local';
|
|
36
|
+
products?: string[];
|
|
37
|
+
};
|
|
38
|
+
interface Defaults {
|
|
39
|
+
tools: Verdict;
|
|
40
|
+
network: Verdict;
|
|
41
|
+
files: Verdict;
|
|
42
|
+
skills: Verdict;
|
|
43
|
+
}
|
|
44
|
+
interface Capture {
|
|
45
|
+
arguments: boolean;
|
|
46
|
+
redact: string[];
|
|
47
|
+
maxBytesPerCall: number;
|
|
48
|
+
sample: number;
|
|
49
|
+
}
|
|
50
|
+
type KeyTier = 'exact' | 'glob';
|
|
51
|
+
type StatementMatch = {
|
|
52
|
+
tool: string;
|
|
53
|
+
keyTier: KeyTier;
|
|
54
|
+
order: number;
|
|
55
|
+
} | {
|
|
56
|
+
capability: string;
|
|
57
|
+
};
|
|
58
|
+
type ConditionOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'glob' | 'regex' | 'notRegex' | 'startsWith' | 'exists';
|
|
59
|
+
interface SchemaBinding {
|
|
60
|
+
/** `sha256:` of the tool's canonical input schema at compile time; null when the inventory had none. */
|
|
61
|
+
schemaHash: string | null;
|
|
62
|
+
}
|
|
63
|
+
interface Condition {
|
|
64
|
+
/** Dotpath into the call: `args.amount`, `args.command.program`, `path`. */
|
|
65
|
+
field: string;
|
|
66
|
+
op: ConditionOp;
|
|
67
|
+
value?: unknown;
|
|
68
|
+
schemaBinding?: SchemaBinding;
|
|
69
|
+
}
|
|
70
|
+
interface Approval {
|
|
71
|
+
approvers: number;
|
|
72
|
+
roles?: string[];
|
|
73
|
+
members?: string[];
|
|
74
|
+
anyMember?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Who a statement applies to. Absent means everyone the document targets. */
|
|
77
|
+
type Subject = {
|
|
78
|
+
membershipId: string;
|
|
79
|
+
} | {
|
|
80
|
+
email: string;
|
|
81
|
+
} | {
|
|
82
|
+
group: string;
|
|
83
|
+
} | {
|
|
84
|
+
product: string;
|
|
85
|
+
};
|
|
86
|
+
interface Provenance {
|
|
87
|
+
ruleKey: string;
|
|
88
|
+
variant: number;
|
|
89
|
+
source: 'yaml' | 'converter' | 'compose' | 'settings-import';
|
|
90
|
+
layer: Layer;
|
|
91
|
+
}
|
|
92
|
+
interface Statement {
|
|
93
|
+
id: string;
|
|
94
|
+
subject: Subject | null;
|
|
95
|
+
match: StatementMatch;
|
|
96
|
+
effect: Verdict;
|
|
97
|
+
conditions: Condition[];
|
|
98
|
+
approval?: Approval;
|
|
99
|
+
/** ISO date-time, or the literal `never`. Always present. */
|
|
100
|
+
expiresAt: string | 'never';
|
|
101
|
+
controls?: string[];
|
|
102
|
+
provenance: Provenance;
|
|
103
|
+
}
|
|
104
|
+
interface PolicyDocument {
|
|
105
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
|
106
|
+
policyId: string;
|
|
107
|
+
/** `sha256:` over the canonical document without this field. */
|
|
108
|
+
policyHash?: string;
|
|
109
|
+
target: PolicyTarget;
|
|
110
|
+
layer: Layer;
|
|
111
|
+
defaults: Defaults;
|
|
112
|
+
capture: Capture;
|
|
113
|
+
/** ISO date-time, or the literal `never`. Always present. */
|
|
114
|
+
expiresAt: string | 'never';
|
|
115
|
+
statements: Statement[];
|
|
116
|
+
}
|
|
117
|
+
declare function layerOfTarget(target: PolicyTarget): Layer;
|
|
118
|
+
|
|
119
|
+
/** The `armor.io/v2` source document after strict parsing, before lowering. */
|
|
120
|
+
interface PolicySource {
|
|
121
|
+
apiVersion: 'armor.io/v2';
|
|
122
|
+
kind: 'Policy';
|
|
123
|
+
metadata: {
|
|
124
|
+
name: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
orgId?: string;
|
|
127
|
+
labels?: Record<string, string>;
|
|
128
|
+
};
|
|
129
|
+
target: SourceTarget;
|
|
130
|
+
precedence?: 'device-first' | 'agent-first';
|
|
131
|
+
spec: PolicySpec;
|
|
132
|
+
}
|
|
133
|
+
type SourceTarget = {
|
|
134
|
+
agent: string;
|
|
135
|
+
mcpServers?: string[];
|
|
136
|
+
} | {
|
|
137
|
+
group: string;
|
|
138
|
+
} | {
|
|
139
|
+
org: '*';
|
|
140
|
+
} | {
|
|
141
|
+
device: 'local';
|
|
142
|
+
};
|
|
143
|
+
interface PolicySpec {
|
|
144
|
+
tools: ToolsSection;
|
|
145
|
+
files?: {
|
|
146
|
+
deny?: string[];
|
|
147
|
+
allowOutsideWorkspace?: boolean;
|
|
148
|
+
};
|
|
149
|
+
network?: {
|
|
150
|
+
default?: Verdict;
|
|
151
|
+
allow?: NetworkEntry[];
|
|
152
|
+
deny?: NetworkEntry[];
|
|
153
|
+
};
|
|
154
|
+
skills?: {
|
|
155
|
+
default?: Verdict;
|
|
156
|
+
hold?: string[];
|
|
157
|
+
block?: string[];
|
|
158
|
+
};
|
|
159
|
+
secrets?: {
|
|
160
|
+
envBlocklist?: string[];
|
|
161
|
+
};
|
|
162
|
+
members?: Record<string, Overlay>;
|
|
163
|
+
products?: Record<string, Overlay>;
|
|
164
|
+
capture?: {
|
|
165
|
+
arguments?: boolean;
|
|
166
|
+
redact?: string[];
|
|
167
|
+
maxBytesPerCall?: number;
|
|
168
|
+
sample?: number;
|
|
169
|
+
};
|
|
170
|
+
approvalDefaults?: Approval;
|
|
171
|
+
expiresAt: string;
|
|
172
|
+
}
|
|
173
|
+
type NetworkEntry = string | {
|
|
174
|
+
host: string;
|
|
175
|
+
reason?: string;
|
|
176
|
+
};
|
|
177
|
+
interface ToolsSection {
|
|
178
|
+
default: Verdict;
|
|
179
|
+
rules?: Record<string, RuleValue>;
|
|
180
|
+
}
|
|
181
|
+
interface Overlay {
|
|
182
|
+
tools?: {
|
|
183
|
+
default?: Verdict;
|
|
184
|
+
rules?: Record<string, RuleValue>;
|
|
185
|
+
};
|
|
186
|
+
expiresAt: string;
|
|
187
|
+
}
|
|
188
|
+
/** A scalar verdict is shorthand for one unconditional variant. */
|
|
189
|
+
type RuleValue = Verdict | RuleVariant[];
|
|
190
|
+
interface RuleVariant {
|
|
191
|
+
action: Verdict;
|
|
192
|
+
when?: Record<string, ConditionSpec>;
|
|
193
|
+
approval?: Approval;
|
|
194
|
+
reason?: string;
|
|
195
|
+
controls?: string[];
|
|
196
|
+
expiresAt: string;
|
|
197
|
+
}
|
|
198
|
+
/** `{gt: 5000}`, `{in: [a, b]}`, `{matches: '^x'}`, `{exists: true}`. Exactly one operator. */
|
|
199
|
+
type ConditionSpec = Partial<Record<SourceOperator, unknown>>;
|
|
200
|
+
declare const SOURCE_OPERATORS: readonly ["eq", "neq", "in", "notIn", "gt", "gte", "lt", "lte", "matches", "notMatches", "startsWith", "glob", "withinWorkspace", "exists"];
|
|
201
|
+
type SourceOperator = (typeof SOURCE_OPERATORS)[number];
|
|
202
|
+
declare const VERDICTS: readonly Verdict[];
|
|
203
|
+
declare const NEVER = "never";
|
|
204
|
+
|
|
205
|
+
interface ParseResult {
|
|
206
|
+
source: PolicySource | null;
|
|
207
|
+
diagnostics: Diagnostics;
|
|
208
|
+
}
|
|
209
|
+
/** Parse `armor.io/v2` YAML text strictly. */
|
|
210
|
+
declare function parseYaml(text: string): ParseResult;
|
|
211
|
+
/** Parse an already-loaded YAML/JSON value strictly. */
|
|
212
|
+
declare function parseDocument(value: unknown): ParseResult;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Everything that can be checked without an inventory. Inventory-dependent
|
|
216
|
+
* checks (roster clamp, glob collisions on real tools, schema binding) live in
|
|
217
|
+
* the compiler.
|
|
218
|
+
*/
|
|
219
|
+
declare function validate(source: PolicySource): Diagnostics;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* PolicySource back to YAML such that `parse(serialize(x))` equals `x`
|
|
223
|
+
* (VC-10). A single unconditional variant with no other fields is written as
|
|
224
|
+
* the scalar shorthand; `expiresAt: never` is written only where the parser
|
|
225
|
+
* would not materialize it identically anyway (everywhere), so it is kept.
|
|
226
|
+
*/
|
|
227
|
+
declare function serialize(source: PolicySource): string;
|
|
228
|
+
|
|
229
|
+
export { type Approval as A, type Condition as C, Diagnostics as D, type KeyTier as K, type Layer as L, NEVER as N, type Overlay as O, type PolicyDocument as P, type RuleValue as R, type Statement as S, type ToolsSection as T, type Verdict as V, type SourceTarget as a, type PolicySource as b, type Capture as c, type ConditionOp as d, type ConditionSpec as e, type Defaults as f, type Diagnostic as g, type NetworkEntry as h, type ParseResult as i, type PolicySpec as j, type PolicyTarget as k, type Provenance as l, type RuleVariant as m, SCHEMA_VERSION as n, SOURCE_OPERATORS as o, type SchemaBinding as p, type Severity as q, type SourceOperator as r, type StatementMatch as s, type Subject as t, VERDICTS as u, layerOfTarget as v, parseDocument as w, parseYaml as x, serialize as y, validate as z };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
type Severity = 'error' | 'warning';
|
|
2
|
+
interface Diagnostic {
|
|
3
|
+
code: string;
|
|
4
|
+
severity: Severity;
|
|
5
|
+
/** JSON-pointer-like path into the source document, `/spec/tools/rules/Bash/0`. */
|
|
6
|
+
path: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
declare class Diagnostics {
|
|
10
|
+
readonly items: Diagnostic[];
|
|
11
|
+
error(code: string, path: string, message: string): void;
|
|
12
|
+
warning(code: string, path: string, message: string): void;
|
|
13
|
+
get hasErrors(): boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* `armor.policy.v2` intermediate representation.
|
|
18
|
+
*
|
|
19
|
+
* Data, never a program: the same JSON is evaluated by conmap, the Armor CLI
|
|
20
|
+
* daemon, the SDK pre-check and OPA. The document is the hashing and signing
|
|
21
|
+
* boundary, so every field here is part of `policyHash` except `policyHash`.
|
|
22
|
+
*/
|
|
23
|
+
declare const SCHEMA_VERSION: "armor.policy.v2";
|
|
24
|
+
type Verdict = 'allow' | 'hold' | 'block';
|
|
25
|
+
/** Where a document sits in the layering ladder. A boundary is a floor: it can only tighten. */
|
|
26
|
+
type Layer = 'floor' | 'group' | 'agent' | 'member' | 'local';
|
|
27
|
+
type PolicyTarget = {
|
|
28
|
+
org: '*';
|
|
29
|
+
} | {
|
|
30
|
+
group: string;
|
|
31
|
+
} | {
|
|
32
|
+
agent: string;
|
|
33
|
+
mcpServers?: string[];
|
|
34
|
+
} | {
|
|
35
|
+
device: 'local';
|
|
36
|
+
products?: string[];
|
|
37
|
+
};
|
|
38
|
+
interface Defaults {
|
|
39
|
+
tools: Verdict;
|
|
40
|
+
network: Verdict;
|
|
41
|
+
files: Verdict;
|
|
42
|
+
skills: Verdict;
|
|
43
|
+
}
|
|
44
|
+
interface Capture {
|
|
45
|
+
arguments: boolean;
|
|
46
|
+
redact: string[];
|
|
47
|
+
maxBytesPerCall: number;
|
|
48
|
+
sample: number;
|
|
49
|
+
}
|
|
50
|
+
type KeyTier = 'exact' | 'glob';
|
|
51
|
+
type StatementMatch = {
|
|
52
|
+
tool: string;
|
|
53
|
+
keyTier: KeyTier;
|
|
54
|
+
order: number;
|
|
55
|
+
} | {
|
|
56
|
+
capability: string;
|
|
57
|
+
};
|
|
58
|
+
type ConditionOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'glob' | 'regex' | 'notRegex' | 'startsWith' | 'exists';
|
|
59
|
+
interface SchemaBinding {
|
|
60
|
+
/** `sha256:` of the tool's canonical input schema at compile time; null when the inventory had none. */
|
|
61
|
+
schemaHash: string | null;
|
|
62
|
+
}
|
|
63
|
+
interface Condition {
|
|
64
|
+
/** Dotpath into the call: `args.amount`, `args.command.program`, `path`. */
|
|
65
|
+
field: string;
|
|
66
|
+
op: ConditionOp;
|
|
67
|
+
value?: unknown;
|
|
68
|
+
schemaBinding?: SchemaBinding;
|
|
69
|
+
}
|
|
70
|
+
interface Approval {
|
|
71
|
+
approvers: number;
|
|
72
|
+
roles?: string[];
|
|
73
|
+
members?: string[];
|
|
74
|
+
anyMember?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Who a statement applies to. Absent means everyone the document targets. */
|
|
77
|
+
type Subject = {
|
|
78
|
+
membershipId: string;
|
|
79
|
+
} | {
|
|
80
|
+
email: string;
|
|
81
|
+
} | {
|
|
82
|
+
group: string;
|
|
83
|
+
} | {
|
|
84
|
+
product: string;
|
|
85
|
+
};
|
|
86
|
+
interface Provenance {
|
|
87
|
+
ruleKey: string;
|
|
88
|
+
variant: number;
|
|
89
|
+
source: 'yaml' | 'converter' | 'compose' | 'settings-import';
|
|
90
|
+
layer: Layer;
|
|
91
|
+
}
|
|
92
|
+
interface Statement {
|
|
93
|
+
id: string;
|
|
94
|
+
subject: Subject | null;
|
|
95
|
+
match: StatementMatch;
|
|
96
|
+
effect: Verdict;
|
|
97
|
+
conditions: Condition[];
|
|
98
|
+
approval?: Approval;
|
|
99
|
+
/** ISO date-time, or the literal `never`. Always present. */
|
|
100
|
+
expiresAt: string | 'never';
|
|
101
|
+
controls?: string[];
|
|
102
|
+
provenance: Provenance;
|
|
103
|
+
}
|
|
104
|
+
interface PolicyDocument {
|
|
105
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
|
106
|
+
policyId: string;
|
|
107
|
+
/** `sha256:` over the canonical document without this field. */
|
|
108
|
+
policyHash?: string;
|
|
109
|
+
target: PolicyTarget;
|
|
110
|
+
layer: Layer;
|
|
111
|
+
defaults: Defaults;
|
|
112
|
+
capture: Capture;
|
|
113
|
+
/** ISO date-time, or the literal `never`. Always present. */
|
|
114
|
+
expiresAt: string | 'never';
|
|
115
|
+
statements: Statement[];
|
|
116
|
+
}
|
|
117
|
+
declare function layerOfTarget(target: PolicyTarget): Layer;
|
|
118
|
+
|
|
119
|
+
/** The `armor.io/v2` source document after strict parsing, before lowering. */
|
|
120
|
+
interface PolicySource {
|
|
121
|
+
apiVersion: 'armor.io/v2';
|
|
122
|
+
kind: 'Policy';
|
|
123
|
+
metadata: {
|
|
124
|
+
name: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
orgId?: string;
|
|
127
|
+
labels?: Record<string, string>;
|
|
128
|
+
};
|
|
129
|
+
target: SourceTarget;
|
|
130
|
+
precedence?: 'device-first' | 'agent-first';
|
|
131
|
+
spec: PolicySpec;
|
|
132
|
+
}
|
|
133
|
+
type SourceTarget = {
|
|
134
|
+
agent: string;
|
|
135
|
+
mcpServers?: string[];
|
|
136
|
+
} | {
|
|
137
|
+
group: string;
|
|
138
|
+
} | {
|
|
139
|
+
org: '*';
|
|
140
|
+
} | {
|
|
141
|
+
device: 'local';
|
|
142
|
+
};
|
|
143
|
+
interface PolicySpec {
|
|
144
|
+
tools: ToolsSection;
|
|
145
|
+
files?: {
|
|
146
|
+
deny?: string[];
|
|
147
|
+
allowOutsideWorkspace?: boolean;
|
|
148
|
+
};
|
|
149
|
+
network?: {
|
|
150
|
+
default?: Verdict;
|
|
151
|
+
allow?: NetworkEntry[];
|
|
152
|
+
deny?: NetworkEntry[];
|
|
153
|
+
};
|
|
154
|
+
skills?: {
|
|
155
|
+
default?: Verdict;
|
|
156
|
+
hold?: string[];
|
|
157
|
+
block?: string[];
|
|
158
|
+
};
|
|
159
|
+
secrets?: {
|
|
160
|
+
envBlocklist?: string[];
|
|
161
|
+
};
|
|
162
|
+
members?: Record<string, Overlay>;
|
|
163
|
+
products?: Record<string, Overlay>;
|
|
164
|
+
capture?: {
|
|
165
|
+
arguments?: boolean;
|
|
166
|
+
redact?: string[];
|
|
167
|
+
maxBytesPerCall?: number;
|
|
168
|
+
sample?: number;
|
|
169
|
+
};
|
|
170
|
+
approvalDefaults?: Approval;
|
|
171
|
+
expiresAt: string;
|
|
172
|
+
}
|
|
173
|
+
type NetworkEntry = string | {
|
|
174
|
+
host: string;
|
|
175
|
+
reason?: string;
|
|
176
|
+
};
|
|
177
|
+
interface ToolsSection {
|
|
178
|
+
default: Verdict;
|
|
179
|
+
rules?: Record<string, RuleValue>;
|
|
180
|
+
}
|
|
181
|
+
interface Overlay {
|
|
182
|
+
tools?: {
|
|
183
|
+
default?: Verdict;
|
|
184
|
+
rules?: Record<string, RuleValue>;
|
|
185
|
+
};
|
|
186
|
+
expiresAt: string;
|
|
187
|
+
}
|
|
188
|
+
/** A scalar verdict is shorthand for one unconditional variant. */
|
|
189
|
+
type RuleValue = Verdict | RuleVariant[];
|
|
190
|
+
interface RuleVariant {
|
|
191
|
+
action: Verdict;
|
|
192
|
+
when?: Record<string, ConditionSpec>;
|
|
193
|
+
approval?: Approval;
|
|
194
|
+
reason?: string;
|
|
195
|
+
controls?: string[];
|
|
196
|
+
expiresAt: string;
|
|
197
|
+
}
|
|
198
|
+
/** `{gt: 5000}`, `{in: [a, b]}`, `{matches: '^x'}`, `{exists: true}`. Exactly one operator. */
|
|
199
|
+
type ConditionSpec = Partial<Record<SourceOperator, unknown>>;
|
|
200
|
+
declare const SOURCE_OPERATORS: readonly ["eq", "neq", "in", "notIn", "gt", "gte", "lt", "lte", "matches", "notMatches", "startsWith", "glob", "withinWorkspace", "exists"];
|
|
201
|
+
type SourceOperator = (typeof SOURCE_OPERATORS)[number];
|
|
202
|
+
declare const VERDICTS: readonly Verdict[];
|
|
203
|
+
declare const NEVER = "never";
|
|
204
|
+
|
|
205
|
+
interface ParseResult {
|
|
206
|
+
source: PolicySource | null;
|
|
207
|
+
diagnostics: Diagnostics;
|
|
208
|
+
}
|
|
209
|
+
/** Parse `armor.io/v2` YAML text strictly. */
|
|
210
|
+
declare function parseYaml(text: string): ParseResult;
|
|
211
|
+
/** Parse an already-loaded YAML/JSON value strictly. */
|
|
212
|
+
declare function parseDocument(value: unknown): ParseResult;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Everything that can be checked without an inventory. Inventory-dependent
|
|
216
|
+
* checks (roster clamp, glob collisions on real tools, schema binding) live in
|
|
217
|
+
* the compiler.
|
|
218
|
+
*/
|
|
219
|
+
declare function validate(source: PolicySource): Diagnostics;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* PolicySource back to YAML such that `parse(serialize(x))` equals `x`
|
|
223
|
+
* (VC-10). A single unconditional variant with no other fields is written as
|
|
224
|
+
* the scalar shorthand; `expiresAt: never` is written only where the parser
|
|
225
|
+
* would not materialize it identically anyway (everywhere), so it is kept.
|
|
226
|
+
*/
|
|
227
|
+
declare function serialize(source: PolicySource): string;
|
|
228
|
+
|
|
229
|
+
export { type Approval as A, type Condition as C, Diagnostics as D, type KeyTier as K, type Layer as L, NEVER as N, type Overlay as O, type PolicyDocument as P, type RuleValue as R, type Statement as S, type ToolsSection as T, type Verdict as V, type SourceTarget as a, type PolicySource as b, type Capture as c, type ConditionOp as d, type ConditionSpec as e, type Defaults as f, type Diagnostic as g, type NetworkEntry as h, type ParseResult as i, type PolicySpec as j, type PolicyTarget as k, type Provenance as l, type RuleVariant as m, SCHEMA_VERSION as n, SOURCE_OPERATORS as o, type SchemaBinding as p, type Severity as q, type SourceOperator as r, type StatementMatch as s, type Subject as t, VERDICTS as u, layerOfTarget as v, parseDocument as w, parseYaml as x, serialize as y, validate as z };
|