@highflame/policy 2.1.38 → 2.1.40
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/aarm-annotations.gen.d.ts +82 -0
- package/dist/aarm-annotations.gen.js +117 -0
- package/dist/decision-effects.gen.d.ts +8 -0
- package/dist/decision-effects.gen.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const AARM_ANNOTATION_REGISTRY_VERSION = "1.0.0";
|
|
2
|
+
export declare const AARM_ANNOTATION_REGISTRY_INTRODUCED_IN = "R4";
|
|
3
|
+
export declare const AARM_ANNOTATION_REGISTRY_SPEC_URL = "https://aarm.dev/conformance/requirements";
|
|
4
|
+
/**
|
|
5
|
+
* Declared runtime type of an AARM annotation parameter.
|
|
6
|
+
* Constrained to the four primitives the registry parser allows.
|
|
7
|
+
*/
|
|
8
|
+
export type AARMParameterType = 'string' | 'int' | 'float' | 'bool';
|
|
9
|
+
/**
|
|
10
|
+
* Typed parameter value used in Default / Min / Max. Discriminator
|
|
11
|
+
* matches `AARMParameterType`; consumers should type-narrow on the
|
|
12
|
+
* `kind` field rather than reading `value` directly.
|
|
13
|
+
*/
|
|
14
|
+
export type AARMParameterValue = {
|
|
15
|
+
kind: 'string';
|
|
16
|
+
value: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'int';
|
|
19
|
+
value: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'float';
|
|
22
|
+
value: number;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'bool';
|
|
25
|
+
value: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** One parameter on an AARM annotation. */
|
|
28
|
+
export interface AARMParameterDef {
|
|
29
|
+
name: string;
|
|
30
|
+
type: AARMParameterType;
|
|
31
|
+
required: boolean;
|
|
32
|
+
positional: boolean;
|
|
33
|
+
description: string;
|
|
34
|
+
/** Default value when the parameter is omitted; null for required. */
|
|
35
|
+
default: AARMParameterValue | null;
|
|
36
|
+
/** Inclusive lower bound for int/float; null otherwise. */
|
|
37
|
+
min: AARMParameterValue | null;
|
|
38
|
+
/** Inclusive upper bound for int/float; null otherwise. */
|
|
39
|
+
max: AARMParameterValue | null;
|
|
40
|
+
/** Regex pattern (for string parameters); empty string when unset. */
|
|
41
|
+
pattern: string;
|
|
42
|
+
/** Runtime source identifier for typeahead (e.g. 'authn.roles'). */
|
|
43
|
+
valueSource: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One entry in the platform's annotation registry.
|
|
47
|
+
*
|
|
48
|
+
* - `key` is the @<name> bare identifier as it appears in Cedar policy text.
|
|
49
|
+
* - `decisionEffect`, when non-empty, names the Shield decision this
|
|
50
|
+
* annotation drives ('step_up' | 'defer' | 'modify').
|
|
51
|
+
* - `promotesCapability`, when non-empty, names the capabilities.yaml
|
|
52
|
+
* row that becomes implementable once Shield emits the named effect.
|
|
53
|
+
* - `parameters` preserve the order produced by the registry parser:
|
|
54
|
+
* the positional parameter (if any) first, then the rest alphabetically.
|
|
55
|
+
*/
|
|
56
|
+
export interface AARMAnnotationDef {
|
|
57
|
+
key: string;
|
|
58
|
+
description: string;
|
|
59
|
+
aarmRequirement: string;
|
|
60
|
+
promotesCapability: string;
|
|
61
|
+
decisionEffect: string;
|
|
62
|
+
parameters: AARMParameterDef[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Authoritative annotation registry. Treat as read-only —
|
|
66
|
+
* mutation is a programming error.
|
|
67
|
+
*/
|
|
68
|
+
export declare const AARM_ANNOTATIONS: readonly AARMAnnotationDef[];
|
|
69
|
+
/**
|
|
70
|
+
* O(1) lookup over AARM_ANNOTATIONS. Use this when validating raw
|
|
71
|
+
* policy annotations against the registry; the array form is for
|
|
72
|
+
* iteration and stable order.
|
|
73
|
+
*
|
|
74
|
+
* The backing object is built with `Object.create(null)` so a
|
|
75
|
+
* registry author who somehow lands `__proto__` / `constructor` /
|
|
76
|
+
* `hasOwnProperty` as an annotation key (rejected by the Rust
|
|
77
|
+
* registry validator, but defense-in-depth) cannot prototype-
|
|
78
|
+
* pollute the lookup. `Object.freeze` is applied on top to lock
|
|
79
|
+
* the top-level key set; consumers should still treat values as
|
|
80
|
+
* immutable (see the `as const` literal types above).
|
|
81
|
+
*/
|
|
82
|
+
export declare const AARM_ANNOTATION_BY_KEY: Readonly<Record<string, AARMAnnotationDef>>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schemas/annotations.json
|
|
3
|
+
//
|
|
4
|
+
// AARM-aware annotation registry. Single source of truth for the
|
|
5
|
+
// annotations Shield's scheduler interprets at evaluation time and
|
|
6
|
+
// that Studio's editor surfaces for autocomplete/lint. Generic Cedar
|
|
7
|
+
// annotations (@id, @name, @description, @severity, @tags) remain
|
|
8
|
+
// free-form and are unrelated.
|
|
9
|
+
export const AARM_ANNOTATION_REGISTRY_VERSION = '1.0.0';
|
|
10
|
+
export const AARM_ANNOTATION_REGISTRY_INTRODUCED_IN = 'R4';
|
|
11
|
+
export const AARM_ANNOTATION_REGISTRY_SPEC_URL = 'https://aarm.dev/conformance/requirements';
|
|
12
|
+
/**
|
|
13
|
+
* Authoritative annotation registry. Treat as read-only —
|
|
14
|
+
* mutation is a programming error.
|
|
15
|
+
*/
|
|
16
|
+
export const AARM_ANNOTATIONS = [
|
|
17
|
+
{
|
|
18
|
+
key: 'defer_below_confidence',
|
|
19
|
+
description: 'Defer the decision when ANY detector this policy conditions on returned a confidence below the threshold. AARM R3 DEFER on low confidence: prevents both false-positive blocks and false-negative permits at the gray-zone boundary, suspending until a stronger signal arrives.',
|
|
20
|
+
aarmRequirement: 'R3',
|
|
21
|
+
promotesCapability: 'CAP-ENF-005',
|
|
22
|
+
decisionEffect: 'defer',
|
|
23
|
+
parameters: [
|
|
24
|
+
{
|
|
25
|
+
name: 'threshold',
|
|
26
|
+
type: 'float',
|
|
27
|
+
required: true,
|
|
28
|
+
positional: true,
|
|
29
|
+
description: 'Confidence threshold in [0.0, 1.0]. Detector scores strictly less than this value trigger a deferral. 0.0 disables (matches no detector). 1.0 always defers.',
|
|
30
|
+
default: null,
|
|
31
|
+
min: { kind: 'float', value: 0.0 },
|
|
32
|
+
max: { kind: 'float', value: 1.0 },
|
|
33
|
+
pattern: '',
|
|
34
|
+
valueSource: '',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'defer_on_conflict',
|
|
40
|
+
description: 'Defer the decision when two or more equal-priority `forbid` rules disagree about whether to block this action. AARM R3 + R4 DEFER on policy conflict: the scheduler suspends rather than picking deny-by-default, so a policy author can resolve the conflict explicitly. Default behavior absent this annotation remains deny-overrides.',
|
|
41
|
+
aarmRequirement: 'R3',
|
|
42
|
+
promotesCapability: 'CAP-ENF-005',
|
|
43
|
+
decisionEffect: 'defer',
|
|
44
|
+
parameters: [],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'defer_until_context',
|
|
48
|
+
description: 'Defer the decision when a named Cedar context field is null, missing, or the empty string. AARM R3 DEFER on missing context: lets the policy author require a populated field (e.g. `session_max_sensitivity`, `agent_identity_verified`) before letting a decision land, suspending the action rather than evaluating against a half-built session.',
|
|
49
|
+
aarmRequirement: 'R3',
|
|
50
|
+
promotesCapability: 'CAP-ENF-005',
|
|
51
|
+
decisionEffect: 'defer',
|
|
52
|
+
parameters: [
|
|
53
|
+
{
|
|
54
|
+
name: 'field',
|
|
55
|
+
type: 'string',
|
|
56
|
+
required: true,
|
|
57
|
+
positional: true,
|
|
58
|
+
description: 'Dotted Cedar context-attribute path (e.g. `session_max_sensitivity`, `agent.identity_verified`). Matched against the request\'s projected context at evaluation time.',
|
|
59
|
+
default: null,
|
|
60
|
+
min: null,
|
|
61
|
+
max: null,
|
|
62
|
+
pattern: '^[a-zA-Z_][a-zA-Z0-9_.]*$',
|
|
63
|
+
valueSource: '',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: 'step_up_required',
|
|
69
|
+
description: 'Suspend the action pending human approval from an approver with the named role. AARM R4 STEP_UP decision: action does not execute until POST /v1/approvals/{id}/resolve returns allow, OR timeout_seconds elapses (fail-closed: timeout DENYs the action, never permits).',
|
|
70
|
+
aarmRequirement: 'R4',
|
|
71
|
+
promotesCapability: 'CAP-ENF-004',
|
|
72
|
+
decisionEffect: 'step_up',
|
|
73
|
+
parameters: [
|
|
74
|
+
{
|
|
75
|
+
name: 'role',
|
|
76
|
+
type: 'string',
|
|
77
|
+
required: true,
|
|
78
|
+
positional: true,
|
|
79
|
+
description: 'AuthN role string the approver must carry (e.g. "finance_lead", "security_oncall"). Validated against authn.roles at deploy time; unknown roles reject the policy.',
|
|
80
|
+
default: null,
|
|
81
|
+
min: null,
|
|
82
|
+
max: null,
|
|
83
|
+
pattern: '',
|
|
84
|
+
valueSource: 'authn.roles',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'timeout_seconds',
|
|
88
|
+
type: 'int',
|
|
89
|
+
required: false,
|
|
90
|
+
positional: false,
|
|
91
|
+
description: 'Seconds the action waits for approval before fail-closed DENY. Default 24h (86400s); bounded [60s, 7d].',
|
|
92
|
+
default: { kind: 'int', value: 86400 },
|
|
93
|
+
min: { kind: 'int', value: 60 },
|
|
94
|
+
max: { kind: 'int', value: 604800 },
|
|
95
|
+
pattern: '',
|
|
96
|
+
valueSource: '',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
/**
|
|
102
|
+
* O(1) lookup over AARM_ANNOTATIONS. Use this when validating raw
|
|
103
|
+
* policy annotations against the registry; the array form is for
|
|
104
|
+
* iteration and stable order.
|
|
105
|
+
*
|
|
106
|
+
* The backing object is built with `Object.create(null)` so a
|
|
107
|
+
* registry author who somehow lands `__proto__` / `constructor` /
|
|
108
|
+
* `hasOwnProperty` as an annotation key (rejected by the Rust
|
|
109
|
+
* registry validator, but defense-in-depth) cannot prototype-
|
|
110
|
+
* pollute the lookup. `Object.freeze` is applied on top to lock
|
|
111
|
+
* the top-level key set; consumers should still treat values as
|
|
112
|
+
* immutable (see the `as const` literal types above).
|
|
113
|
+
*/
|
|
114
|
+
export const AARM_ANNOTATION_BY_KEY = Object.freeze(AARM_ANNOTATIONS.reduce((acc, ann) => {
|
|
115
|
+
acc[ann.key] = ann;
|
|
116
|
+
return acc;
|
|
117
|
+
}, Object.create(null)));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DecisionEffect: {
|
|
2
|
+
readonly StepUp: "step_up";
|
|
3
|
+
readonly Defer: "defer";
|
|
4
|
+
readonly Modify: "modify";
|
|
5
|
+
};
|
|
6
|
+
export type DecisionEffect = (typeof DecisionEffect)[keyof typeof DecisionEffect];
|
|
7
|
+
/** Every legal decision effect, in canonical order. */
|
|
8
|
+
export declare const AllDecisionEffects: DecisionEffect[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: ALLOWED_DECISION_EFFECTS in codegen/src/lib.rs
|
|
3
|
+
//
|
|
4
|
+
// Canonical decision-effect vocabulary. Studio's policy editor and any
|
|
5
|
+
// other TypeScript consumer should import these symbols rather than
|
|
6
|
+
// hard-coding the string literals.
|
|
7
|
+
export const DecisionEffect = {
|
|
8
|
+
StepUp: "step_up",
|
|
9
|
+
Defer: "defer",
|
|
10
|
+
Modify: "modify",
|
|
11
|
+
};
|
|
12
|
+
/** Every legal decision effect, in canonical order. */
|
|
13
|
+
export const AllDecisionEffects = [
|
|
14
|
+
DecisionEffect.StepUp,
|
|
15
|
+
DecisionEffect.Defer,
|
|
16
|
+
DecisionEffect.Modify,
|
|
17
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './entities.gen.js';
|
|
|
2
2
|
export * from './actions.gen.js';
|
|
3
3
|
export * from './context.gen.js';
|
|
4
4
|
export * from './schema.gen.js';
|
|
5
|
+
export * from './decision-effects.gen.js';
|
|
6
|
+
export * from './aarm-annotations.gen.js';
|
|
5
7
|
export * from './engine.js';
|
|
6
8
|
export * from './builder.js';
|
|
7
9
|
export * from './parser.js';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,12 @@ export * from './entities.gen.js';
|
|
|
7
7
|
export * from './actions.gen.js';
|
|
8
8
|
export * from './context.gen.js';
|
|
9
9
|
export * from './schema.gen.js';
|
|
10
|
+
// Canonical decision-effect vocabulary (AARM R4 Wave A). Always emitted —
|
|
11
|
+
// source is ALLOWED_DECISION_EFFECTS in codegen/src/lib.rs, not annotations.json.
|
|
12
|
+
export * from './decision-effects.gen.js';
|
|
13
|
+
// AARM-aware annotation registry (typed Cedar annotation vocabulary
|
|
14
|
+
// Shield interprets at decision time; Studio/Admin use for lint).
|
|
15
|
+
export * from './aarm-annotations.gen.js';
|
|
10
16
|
// Non-generated modules (require Node.js)
|
|
11
17
|
export * from './engine.js';
|
|
12
18
|
export * from './builder.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './entities.gen.js';
|
|
|
2
2
|
export * from './actions.gen.js';
|
|
3
3
|
export * from './context.gen.js';
|
|
4
4
|
export * from './schema.gen.js';
|
|
5
|
+
export * from './decision-effects.gen.js';
|
|
6
|
+
export * from './aarm-annotations.gen.js';
|
|
5
7
|
export * from './builder.js';
|
|
6
8
|
export * from './errors.js';
|
|
7
9
|
export * from './annotations.js';
|
package/dist/types.js
CHANGED
|
@@ -9,6 +9,12 @@ export * from './entities.gen.js';
|
|
|
9
9
|
export * from './actions.gen.js';
|
|
10
10
|
export * from './context.gen.js';
|
|
11
11
|
export * from './schema.gen.js';
|
|
12
|
+
// Canonical decision-effect vocabulary (browser-safe). Studio's Monaco
|
|
13
|
+
// policy editor imports these typed symbols rather than string literals.
|
|
14
|
+
export * from './decision-effects.gen.js';
|
|
15
|
+
// AARM-aware annotation registry (browser-safe — Studio uses this
|
|
16
|
+
// for Monaco autocomplete + lint of @step_up_required / @defer_* keys).
|
|
17
|
+
export * from './aarm-annotations.gen.js';
|
|
12
18
|
// PolicyBuilder - works in browser (no WASM dependency)
|
|
13
19
|
export * from './builder.js';
|
|
14
20
|
// Error types - works in browser (no WASM dependency)
|