@aws/cloudformation-validate 1.1.0-beta → 1.3.0-beta
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 +19 -26
- package/THIRD-PARTY-LICENSES.txt +43 -279
- package/bindings_wasm.d.ts +803 -269
- package/bindings_wasm.js +55 -58
- package/bindings_wasm_bg.wasm +0 -0
- package/index.d.ts +1 -0
- package/package.json +1 -5
package/bindings_wasm.d.ts
CHANGED
|
@@ -1,373 +1,938 @@
|
|
|
1
1
|
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A pre-read rule file provided by the caller (custom Rego/CEL or Guard DSL).
|
|
6
|
+
*
|
|
7
|
+
* `name` identifies the rule source in error messages and logging. For a
|
|
8
|
+
* file-backed rule this is typically the filesystem path; otherwise it is
|
|
9
|
+
* whatever label the caller provides.
|
|
10
|
+
*
|
|
11
|
+
* `content` is the full source text of the rule file.
|
|
12
|
+
*/
|
|
13
|
+
export interface ExternalRuleSource {
|
|
14
|
+
name: string;
|
|
15
|
+
content: string;
|
|
8
16
|
}
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A property path paired with a variable name referenced there.
|
|
20
|
+
*/
|
|
21
|
+
export interface PathVariable {
|
|
11
22
|
path: string;
|
|
12
|
-
|
|
13
|
-
nullInTrueBranch: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface DetailedDiagnostic {
|
|
17
|
-
ruleId: string;
|
|
18
|
-
severity: Severity;
|
|
19
|
-
message: string;
|
|
20
|
-
source: RuleOrigin;
|
|
21
|
-
resourceId?: string;
|
|
22
|
-
resourceType?: string;
|
|
23
|
-
propertyPath?: string;
|
|
24
|
-
suggestedFix?: string;
|
|
25
|
-
category?: string;
|
|
26
|
-
startLine?: number;
|
|
27
|
-
startColumn?: number;
|
|
28
|
-
endLine?: number;
|
|
29
|
-
endColumn?: number;
|
|
30
|
-
relatedResources?: RelatedResource[];
|
|
31
|
-
conditionScenario?: Record<string, boolean> | undefined;
|
|
32
|
-
documentationUrl?: string;
|
|
33
|
-
ruleDescription?: string;
|
|
34
|
-
phase?: Phase;
|
|
35
|
-
section?: string;
|
|
36
|
-
context?: ViolationContext;
|
|
23
|
+
variable: string;
|
|
37
24
|
}
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
diagnostics: DetailedDiagnostic[];
|
|
26
|
+
/**
|
|
27
|
+
* A property path paired with the reference target found there.
|
|
28
|
+
*/
|
|
29
|
+
export interface PathTarget {
|
|
30
|
+
path: string;
|
|
31
|
+
target: string;
|
|
46
32
|
}
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A property that is dropped (resolves to AWS::NoValue) in one branch of an Fn::If condition.
|
|
36
|
+
*/
|
|
37
|
+
export interface ConditionalNullEntry {
|
|
38
|
+
/**
|
|
39
|
+
* Dot-separated property path that becomes absent in one branch.
|
|
40
|
+
*/
|
|
41
|
+
path: string;
|
|
42
|
+
/**
|
|
43
|
+
* Name of the condition governing the Fn::If that drops this property.
|
|
44
|
+
*/
|
|
45
|
+
condition: string;
|
|
46
|
+
/**
|
|
47
|
+
* True when the property is absent in the condition\'s true branch; false when absent in the false branch.
|
|
48
|
+
*/
|
|
49
|
+
nullInTrueBranch: boolean;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A property that resolves to null in one branch of a condition.
|
|
54
|
+
*/
|
|
55
|
+
export interface ConditionalNull {
|
|
55
56
|
path: string;
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
condition: string;
|
|
58
|
+
/**
|
|
59
|
+
* True if the property is null in the condition\'s true branch; false if null in the false branch.
|
|
60
|
+
*/
|
|
61
|
+
nullInTrue: boolean;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
/**
|
|
65
|
+
* A property value after CloudFormation intrinsics (Ref, Fn::GetAtt, Fn::Sub, Fn::If, ...)
|
|
66
|
+
* have been resolved as far as possible. Depending on how much can be known before
|
|
67
|
+
* deployment, a value is fully concrete, a reference to another resource, one of several
|
|
68
|
+
* possible values, conditional on a template condition, or opaque until deploy time.
|
|
69
|
+
*/
|
|
70
|
+
export type ResolvedValue =
|
|
71
|
+
| { Concrete: { value: JsonValue } }
|
|
72
|
+
| { List: { items: ResolvedValue[] } }
|
|
73
|
+
| { Map: { entries: MapEntry[] } }
|
|
74
|
+
| { Enum: { variants: ResolvedValue[] } }
|
|
75
|
+
| { Conditional: { condition: string; if_true: ResolvedValue; if_false: ResolvedValue } }
|
|
76
|
+
| { Reference: { target: string; kind: RefKind } }
|
|
77
|
+
| { Dynamic: { reason: string } }
|
|
78
|
+
| { TypedDynamic: { reason: string; param_type: string } };
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
resourceConditionMap: Record<string, string>;
|
|
74
|
-
mappings: JsonValue;
|
|
75
|
-
resources: Record<string, DiagnosticResource>;
|
|
76
|
-
outputs: Record<string, DiagnosticOutput>;
|
|
77
|
-
edges: ReferenceEdge[];
|
|
78
|
-
cycles: string[][];
|
|
79
|
-
outputEmptyJoins: string[];
|
|
80
|
-
samImplicitResources: string[];
|
|
81
|
-
globalsParamRefs: string[];
|
|
82
|
-
isCdk: boolean;
|
|
83
|
-
hasParseErrors: boolean;
|
|
84
|
-
parsedRules: DiagnosticRule[];
|
|
85
|
-
resolutionSources: ResolutionSource[];
|
|
80
|
+
/**
|
|
81
|
+
* A range in the source template. Lines and columns are 1-based.
|
|
82
|
+
*/
|
|
83
|
+
export interface SourceSpan {
|
|
84
|
+
startLine: number;
|
|
85
|
+
startColumn: number;
|
|
86
|
+
endLine: number;
|
|
87
|
+
endColumn: number;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/**
|
|
91
|
+
* A reference a resource makes to another resource or parameter.
|
|
92
|
+
*/
|
|
93
|
+
export interface OutgoingRef {
|
|
94
|
+
/**
|
|
95
|
+
* Property path within the resource where the reference occurs.
|
|
96
|
+
*/
|
|
97
|
+
sourcePath: string;
|
|
98
|
+
/**
|
|
99
|
+
* Logical ID of the referenced resource or parameter.
|
|
100
|
+
*/
|
|
101
|
+
target: string;
|
|
102
|
+
/**
|
|
103
|
+
* How the reference is made, such as Ref, GetAtt, Sub, or DependsOn.
|
|
104
|
+
*/
|
|
105
|
+
kind: string;
|
|
106
|
+
/**
|
|
107
|
+
* For a GetAtt or Sub reference, the attribute or variable name being referenced.
|
|
108
|
+
*/
|
|
109
|
+
attr?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Name of the condition under which this reference is active, if it is inside a conditional branch.
|
|
112
|
+
*/
|
|
113
|
+
conditionContext?: string;
|
|
92
114
|
}
|
|
93
115
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
/**
|
|
117
|
+
* A reference made to this resource by another resource.
|
|
118
|
+
*/
|
|
119
|
+
export interface IncomingRef {
|
|
120
|
+
/**
|
|
121
|
+
* Logical ID of the resource that makes the reference.
|
|
122
|
+
*/
|
|
123
|
+
source: string;
|
|
124
|
+
/**
|
|
125
|
+
* Property path within the source where the reference occurs.
|
|
126
|
+
*/
|
|
127
|
+
sourcePath: string;
|
|
128
|
+
/**
|
|
129
|
+
* How the reference is made, such as Ref, GetAtt, Sub, or DependsOn.
|
|
130
|
+
*/
|
|
131
|
+
kind: string;
|
|
132
|
+
/**
|
|
133
|
+
* For a GetAtt or Sub reference, the attribute or variable name being referenced.
|
|
134
|
+
*/
|
|
135
|
+
attr?: string;
|
|
101
136
|
}
|
|
102
137
|
|
|
138
|
+
/**
|
|
139
|
+
* A resource after intrinsic resolution, with its properties, references, and detected findings.
|
|
140
|
+
*/
|
|
103
141
|
export interface DiagnosticResource {
|
|
104
142
|
resourceType: string;
|
|
105
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Name of the condition gating whether this resource is created, if any.
|
|
145
|
+
*/
|
|
146
|
+
condition?: string;
|
|
106
147
|
dependsOn: string[];
|
|
107
|
-
deletionPolicy
|
|
108
|
-
updateReplacePolicy
|
|
109
|
-
creationPolicy
|
|
110
|
-
updatePolicy
|
|
148
|
+
deletionPolicy?: JsonValue;
|
|
149
|
+
updateReplacePolicy?: JsonValue;
|
|
150
|
+
creationPolicy?: JsonValue;
|
|
151
|
+
updatePolicy?: JsonValue;
|
|
152
|
+
/**
|
|
153
|
+
* The resource\'s properties with intrinsics resolved where possible.
|
|
154
|
+
*/
|
|
111
155
|
properties: Record<string, JsonValue>;
|
|
112
156
|
outgoingRefs: OutgoingRef[];
|
|
113
157
|
incomingRefs: IncomingRef[];
|
|
158
|
+
/**
|
|
159
|
+
* Mapping names referenced by Fn::FindInMap within this resource.
|
|
160
|
+
*/
|
|
114
161
|
findInMapRefs: string[];
|
|
162
|
+
/**
|
|
163
|
+
* Fn::Sub uses whose template is a single variable with no surrounding text, which could be written as a plain reference.
|
|
164
|
+
*/
|
|
115
165
|
simpleSubs: PathVariable[];
|
|
166
|
+
/**
|
|
167
|
+
* Property paths where Fn::Sub has no variables to substitute.
|
|
168
|
+
*/
|
|
116
169
|
redundantSubs: string[];
|
|
170
|
+
/**
|
|
171
|
+
* Property paths where Fn::Join uses an empty delimiter, concatenating its elements directly.
|
|
172
|
+
*/
|
|
117
173
|
emptyJoins: string[];
|
|
174
|
+
/**
|
|
175
|
+
* Property paths where an ARN hardcodes the aws partition instead of using AWS::Partition.
|
|
176
|
+
*/
|
|
118
177
|
hardcodedPartitionArns: string[];
|
|
178
|
+
/**
|
|
179
|
+
* Properties that resolve to null in one branch of a condition.
|
|
180
|
+
*/
|
|
119
181
|
conditionallyNullProps: ConditionalNull[];
|
|
182
|
+
/**
|
|
183
|
+
* Names of conditions referenced within this resource\'s properties.
|
|
184
|
+
*/
|
|
120
185
|
conditionRefs: string[];
|
|
186
|
+
/**
|
|
187
|
+
* Fn::ForEach loops in this resource, each with its iteration variable and collection source.
|
|
188
|
+
*/
|
|
121
189
|
forEachExpansions: DiagnosticForEachExpansion[];
|
|
190
|
+
/**
|
|
191
|
+
* Property paths containing ${...} text that is not an Fn::Sub variable and is left as a literal.
|
|
192
|
+
*/
|
|
122
193
|
unsubstitutedVariables: PathVariable[];
|
|
194
|
+
/**
|
|
195
|
+
* References whose target does not resolve to any resource or parameter, each with its path and unresolved target.
|
|
196
|
+
*/
|
|
123
197
|
invalidRefs: PathTarget[];
|
|
124
198
|
}
|
|
125
199
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface DiagnosticTemplate {
|
|
138
|
-
formatVersion: string | undefined;
|
|
139
|
-
description: string | undefined;
|
|
140
|
-
transforms: string[];
|
|
141
|
-
rawTopLevelKeys: string[];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface EngineConfig {
|
|
145
|
-
customRules?: ExternalRuleSource[];
|
|
146
|
-
guardRules?: ExternalRuleSource[];
|
|
200
|
+
/**
|
|
201
|
+
* A resource property path paired with a string value found at it, such as a substitution variable or literal.
|
|
202
|
+
*/
|
|
203
|
+
export interface PathValuePair {
|
|
204
|
+
/**
|
|
205
|
+
* Dot-separated property path within the resource (e.g. \'Properties.BucketName\').
|
|
206
|
+
*/
|
|
207
|
+
path: string;
|
|
208
|
+
value: string;
|
|
147
209
|
}
|
|
148
210
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
211
|
+
/**
|
|
212
|
+
* A set of conditions that are mutually exclusive because they test the same parameter against different values.
|
|
213
|
+
*/
|
|
214
|
+
export interface DiagnosticMutexGroup {
|
|
215
|
+
conditions: string[];
|
|
216
|
+
/**
|
|
217
|
+
* The parameter all conditions in the group test.
|
|
218
|
+
*/
|
|
219
|
+
parameter: string;
|
|
220
|
+
/**
|
|
221
|
+
* The distinct parameter values the conditions compare against, one per condition.
|
|
222
|
+
*/
|
|
223
|
+
values: string[];
|
|
152
224
|
}
|
|
153
225
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
226
|
+
/**
|
|
227
|
+
* A set of rule-matching criteria; a rule matches when it satisfies any one of them.
|
|
228
|
+
*/
|
|
229
|
+
export interface RuleFilterConfig {
|
|
230
|
+
ids?: string[];
|
|
231
|
+
categories?: string[];
|
|
232
|
+
idRanges?: IdRange[];
|
|
233
|
+
/**
|
|
234
|
+
* Regular expressions matched against the rule ID.
|
|
235
|
+
*/
|
|
236
|
+
idPatterns?: string[];
|
|
237
|
+
resourceIds?: ResourceIdFilter[];
|
|
238
|
+
resourceTypes?: ResourceTypeFilter[];
|
|
239
|
+
services?: ServiceFilter[];
|
|
158
240
|
}
|
|
159
241
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
242
|
+
/**
|
|
243
|
+
* A single Conditions entry with its expression and relationships to other conditions.
|
|
244
|
+
*/
|
|
245
|
+
export interface DiagnosticCondition {
|
|
246
|
+
/**
|
|
247
|
+
* The condition expression rendered as a readable string.
|
|
248
|
+
*/
|
|
249
|
+
expression?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Names of other conditions this condition depends on.
|
|
252
|
+
*/
|
|
253
|
+
deps?: string[];
|
|
254
|
+
/**
|
|
255
|
+
* Names of conditions that are mutually exclusive with this one.
|
|
256
|
+
*/
|
|
257
|
+
mutexWith?: string[];
|
|
163
258
|
}
|
|
164
259
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
260
|
+
/**
|
|
261
|
+
* A single assertion within a template rule.
|
|
262
|
+
*/
|
|
263
|
+
export interface DiagnosticRuleAssertion {
|
|
264
|
+
/**
|
|
265
|
+
* The assertion expression that must evaluate to true.
|
|
266
|
+
*/
|
|
267
|
+
assertExpr: JsonValue;
|
|
268
|
+
assertDescription?: string;
|
|
169
269
|
}
|
|
170
270
|
|
|
171
|
-
|
|
271
|
+
/**
|
|
272
|
+
* A single edge in the template\'s reference graph, from a referencing resource to its target.
|
|
273
|
+
*/
|
|
274
|
+
export interface ReferenceEdge {
|
|
275
|
+
/**
|
|
276
|
+
* Logical ID of the resource that makes the reference.
|
|
277
|
+
*/
|
|
172
278
|
source: string;
|
|
279
|
+
/**
|
|
280
|
+
* Property path within the source where the reference occurs.
|
|
281
|
+
*/
|
|
173
282
|
sourcePath: string;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
export interface MapEntry {
|
|
179
|
-
key: string;
|
|
180
|
-
value: ResolvedValue;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export interface OutgoingRef {
|
|
184
|
-
sourcePath: string;
|
|
283
|
+
/**
|
|
284
|
+
* Logical ID of the referenced resource or parameter.
|
|
285
|
+
*/
|
|
185
286
|
target: string;
|
|
287
|
+
/**
|
|
288
|
+
* How the reference is made, such as Ref, GetAtt, Sub, or DependsOn.
|
|
289
|
+
*/
|
|
186
290
|
kind: string;
|
|
291
|
+
/**
|
|
292
|
+
* For a GetAtt or Sub reference, the attribute or variable name being referenced.
|
|
293
|
+
*/
|
|
187
294
|
attr?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Name of the condition under which this reference is active, if it is inside a conditional branch.
|
|
297
|
+
*/
|
|
188
298
|
conditionContext?: string;
|
|
189
299
|
}
|
|
190
300
|
|
|
301
|
+
/**
|
|
302
|
+
* A template Parameter\'s declaration: its type, constraints (allowed values/pattern,
|
|
303
|
+
* length and value bounds), default, and description.
|
|
304
|
+
*/
|
|
191
305
|
export interface ParameterInfo {
|
|
306
|
+
/**
|
|
307
|
+
* The parameter\'s declared CloudFormation type (for example String, Number, or an AWS-specific type); defaults to String when the template omits Type.
|
|
308
|
+
*/
|
|
192
309
|
paramType: string;
|
|
193
|
-
default
|
|
194
|
-
allowedValues
|
|
195
|
-
allowedPattern
|
|
196
|
-
minLength
|
|
197
|
-
maxLength
|
|
198
|
-
minValue
|
|
199
|
-
maxValue
|
|
200
|
-
description
|
|
310
|
+
default?: string;
|
|
311
|
+
allowedValues?: string[];
|
|
312
|
+
allowedPattern?: string;
|
|
313
|
+
minLength?: number;
|
|
314
|
+
maxLength?: number;
|
|
315
|
+
minValue?: number;
|
|
316
|
+
maxValue?: number;
|
|
317
|
+
description?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Whether the parameter is declared with NoEcho, meaning its value is masked in CloudFormation output.
|
|
320
|
+
*/
|
|
201
321
|
noEcho: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Whether the AllowedPattern is a valid, supported regular expression; absent when no AllowedPattern is declared.
|
|
324
|
+
*/
|
|
325
|
+
allowedPatternValid?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Whether the Default value satisfies the AllowedPattern; absent unless both a Default and an AllowedPattern are declared.
|
|
328
|
+
*/
|
|
329
|
+
defaultMatchesAllowedPattern?: boolean;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* A template output after intrinsic resolution, with its references.
|
|
334
|
+
*/
|
|
335
|
+
export interface DiagnosticOutput {
|
|
336
|
+
/**
|
|
337
|
+
* The output value with intrinsics resolved where possible.
|
|
338
|
+
*/
|
|
339
|
+
value: JsonValue;
|
|
340
|
+
description?: string;
|
|
341
|
+
/**
|
|
342
|
+
* Name of the condition gating whether this output is emitted, if any.
|
|
343
|
+
*/
|
|
344
|
+
condition?: string;
|
|
345
|
+
exportName?: JsonValue;
|
|
346
|
+
/**
|
|
347
|
+
* Fn::GetAtt references appearing in the output value.
|
|
348
|
+
*/
|
|
349
|
+
getattRefs: GetAttRef[];
|
|
350
|
+
/**
|
|
351
|
+
* Names of conditions referenced within the output value.
|
|
352
|
+
*/
|
|
353
|
+
conditionRefs: string[];
|
|
202
354
|
}
|
|
203
355
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
356
|
+
/**
|
|
357
|
+
* A template output with its value and metadata after intrinsic functions have been resolved.
|
|
358
|
+
*/
|
|
359
|
+
export interface ResolvedOutput {
|
|
360
|
+
value: ResolvedValue;
|
|
361
|
+
description?: string;
|
|
362
|
+
condition?: string;
|
|
363
|
+
exportName?: ResolvedValue;
|
|
207
364
|
}
|
|
208
365
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
366
|
+
/**
|
|
367
|
+
* A template resource with its metadata and properties after intrinsic functions have been resolved.
|
|
368
|
+
*/
|
|
369
|
+
export interface ResolvedResource {
|
|
370
|
+
logicalId: string;
|
|
371
|
+
resourceType: string;
|
|
372
|
+
condition?: string;
|
|
373
|
+
dependsOn: string[];
|
|
374
|
+
deletionPolicy?: ResolvedValue;
|
|
375
|
+
updateReplacePolicy?: ResolvedValue;
|
|
376
|
+
updatePolicy?: JsonValue;
|
|
377
|
+
creationPolicy?: JsonValue;
|
|
378
|
+
metadata?: JsonValue;
|
|
379
|
+
properties: Record<string, ResolvedValue>;
|
|
380
|
+
/**
|
|
381
|
+
* True when the entire `Properties` block is a non-map intrinsic (e.g.
|
|
382
|
+
* `Properties: !Ref AWS::NoValue`) whose effective property set is only known
|
|
383
|
+
* at deploy time, as distinct from a resource that simply declares no properties.
|
|
384
|
+
*/
|
|
385
|
+
propertiesDynamic: boolean;
|
|
386
|
+
diagnostics: ResourceDiagnostics;
|
|
212
387
|
}
|
|
213
388
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Advanced introspection view of a parsed CloudFormation template: its reference graph,
|
|
391
|
+
* conditions, and resolved resources and outputs.
|
|
392
|
+
*/
|
|
393
|
+
export interface DiagnosticModel {
|
|
394
|
+
template: DiagnosticTemplate;
|
|
395
|
+
parameters: Record<string, JsonValue>;
|
|
396
|
+
conditions: Record<string, DiagnosticCondition>;
|
|
397
|
+
/**
|
|
398
|
+
* Parameter logical IDs referenced by the template\'s condition expressions.
|
|
399
|
+
*/
|
|
400
|
+
conditionParamRefs: string[];
|
|
401
|
+
/**
|
|
402
|
+
* Logical implications between conditions: if the antecedent condition holds, the consequent condition must also hold.
|
|
403
|
+
*/
|
|
404
|
+
conditionImplications: DiagnosticImplication[];
|
|
405
|
+
/**
|
|
406
|
+
* Groups of conditions that are mutually exclusive because they test the same parameter against different values.
|
|
407
|
+
*/
|
|
408
|
+
conditionMutexGroups: DiagnosticMutexGroup[];
|
|
409
|
+
/**
|
|
410
|
+
* Pairs of condition names that can never both be true at the same time.
|
|
411
|
+
*/
|
|
412
|
+
conditionExclusions: string[][];
|
|
413
|
+
/**
|
|
414
|
+
* Maps each resource\'s logical ID to the name of the condition that gates whether it is created.
|
|
415
|
+
*/
|
|
416
|
+
resourceConditionMap: Record<string, string>;
|
|
417
|
+
mappings: JsonValue;
|
|
418
|
+
resources: Record<string, DiagnosticResource>;
|
|
419
|
+
outputs: Record<string, DiagnosticOutput>;
|
|
420
|
+
edges: ReferenceEdge[];
|
|
421
|
+
/**
|
|
422
|
+
* Reference cycles in the template, each listed as the resource logical IDs forming the cycle.
|
|
423
|
+
*/
|
|
424
|
+
cycles: string[][];
|
|
425
|
+
/**
|
|
426
|
+
* Output names whose value is an Fn::Join with an empty delimiter.
|
|
427
|
+
*/
|
|
428
|
+
outputEmptyJoins: string[];
|
|
429
|
+
/**
|
|
430
|
+
* Logical IDs of resources the SAM transform generates implicitly (such as function execution roles and an implicit REST API).
|
|
431
|
+
*/
|
|
432
|
+
samImplicitResources: string[];
|
|
433
|
+
/**
|
|
434
|
+
* Parameter logical IDs referenced from the SAM Globals section.
|
|
435
|
+
*/
|
|
436
|
+
globalsParamRefs: string[];
|
|
437
|
+
/**
|
|
438
|
+
* True when the template appears to be generated by the AWS CDK.
|
|
439
|
+
*/
|
|
440
|
+
isCdk: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Names of conditions referenced by Fn::If expressions in the template.
|
|
443
|
+
*/
|
|
444
|
+
fnIfConditions: string[];
|
|
445
|
+
/**
|
|
446
|
+
* Mapping names referenced by Fn::FindInMap expressions.
|
|
447
|
+
*/
|
|
448
|
+
findInMapNames: string[];
|
|
449
|
+
/**
|
|
450
|
+
* Parameter logical IDs referenced from within other parameters\' own definitions.
|
|
451
|
+
*/
|
|
452
|
+
paramsReferencedInDefinitions: string[];
|
|
453
|
+
/**
|
|
454
|
+
* True when a Fn::FindInMap uses a computed mapping name rather than a literal string.
|
|
455
|
+
*/
|
|
456
|
+
hasDynamicFindinmapName: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* True when the template could not be fully parsed and the model is therefore incomplete.
|
|
459
|
+
*/
|
|
460
|
+
hasParseErrors: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* The template\'s Rules section, each with its optional condition and assertions.
|
|
463
|
+
*/
|
|
464
|
+
parsedRules: DiagnosticRule[];
|
|
465
|
+
/**
|
|
466
|
+
* For resolved resource properties, records where each value came from (such as a parameter default, allowed values, an override, or an intrinsic).
|
|
467
|
+
*/
|
|
468
|
+
resolutionSources: ResolutionSource[];
|
|
217
469
|
}
|
|
218
470
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
471
|
+
/**
|
|
472
|
+
* An Fn::ForEach loop within a resource that expands a property over a collection.
|
|
473
|
+
*/
|
|
474
|
+
export interface ForEachExpansion {
|
|
475
|
+
/**
|
|
476
|
+
* Property path within the resource where the Fn::ForEach appears.
|
|
477
|
+
*/
|
|
478
|
+
propertyPath: string;
|
|
479
|
+
/**
|
|
480
|
+
* Loop variable name bound to each element during expansion.
|
|
481
|
+
*/
|
|
482
|
+
identifier: string;
|
|
483
|
+
/**
|
|
484
|
+
* Human-readable description of the collection being iterated over.
|
|
485
|
+
*/
|
|
486
|
+
collectionSource: string;
|
|
227
487
|
}
|
|
228
488
|
|
|
229
|
-
|
|
230
|
-
|
|
489
|
+
/**
|
|
490
|
+
* An Fn::ForEach loop within a resource.
|
|
491
|
+
*/
|
|
492
|
+
export interface DiagnosticForEachExpansion {
|
|
493
|
+
/**
|
|
494
|
+
* Property path where the Fn::ForEach occurs.
|
|
495
|
+
*/
|
|
496
|
+
path: string;
|
|
497
|
+
/**
|
|
498
|
+
* The loop\'s iteration variable name.
|
|
499
|
+
*/
|
|
500
|
+
identifier: string;
|
|
501
|
+
/**
|
|
502
|
+
* A description of the collection the loop iterates over, such as a reference to a parameter, an inline list, or a dynamic value.
|
|
503
|
+
*/
|
|
504
|
+
collection: string;
|
|
231
505
|
}
|
|
232
506
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
507
|
+
/**
|
|
508
|
+
* An Fn::GetAtt reference to a resource attribute.
|
|
509
|
+
*/
|
|
510
|
+
export interface GetAttRef {
|
|
511
|
+
/**
|
|
512
|
+
* Logical ID of the resource whose attribute is referenced.
|
|
513
|
+
*/
|
|
514
|
+
resource: string;
|
|
515
|
+
attribute: string;
|
|
241
516
|
}
|
|
242
517
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
518
|
+
/**
|
|
519
|
+
* An entry from the template\'s Rules section.
|
|
520
|
+
*/
|
|
521
|
+
export interface DiagnosticRule {
|
|
522
|
+
name: string;
|
|
523
|
+
/**
|
|
524
|
+
* The rule\'s RuleCondition expression, if present, that gates when the assertions apply.
|
|
525
|
+
*/
|
|
526
|
+
condition?: JsonValue;
|
|
527
|
+
assertions: DiagnosticRuleAssertion[];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* An implication between two conditions: whenever the antecedent holds, the consequent also holds.
|
|
532
|
+
*/
|
|
533
|
+
export interface DiagnosticImplication {
|
|
534
|
+
antecedent: string;
|
|
535
|
+
consequent: string;
|
|
250
536
|
}
|
|
251
537
|
|
|
538
|
+
/**
|
|
539
|
+
* Another resource involved in the diagnostic, such as the target of a reference.
|
|
540
|
+
*/
|
|
252
541
|
export interface RelatedResource {
|
|
253
542
|
resource?: ResourceRef;
|
|
543
|
+
/**
|
|
544
|
+
* Source location of the related resource.
|
|
545
|
+
*/
|
|
254
546
|
location?: SourceSpan;
|
|
255
547
|
message: string;
|
|
256
548
|
}
|
|
257
549
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Controls the level of detail in validation output.
|
|
552
|
+
*/
|
|
553
|
+
export type DetailLevel = 'STANDARD' | 'DETAILED';
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Detailed validation result: like the standard report but with per-diagnostic context and enrichment.
|
|
557
|
+
*/
|
|
558
|
+
export interface DetailedReport {
|
|
559
|
+
filePath: string;
|
|
560
|
+
status: ReportStatus;
|
|
561
|
+
engineVersion: string;
|
|
562
|
+
metadata: ReportMetadata;
|
|
563
|
+
performance: PerformanceMetrics;
|
|
564
|
+
diagnostics: DetailedDiagnostic[];
|
|
265
565
|
}
|
|
266
566
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
567
|
+
/**
|
|
568
|
+
* Extra detail about a specific violation, present only in the detailed report.
|
|
569
|
+
*/
|
|
570
|
+
export interface ViolationContext {
|
|
571
|
+
/**
|
|
572
|
+
* The resolved property value that triggered the violation.
|
|
573
|
+
*/
|
|
574
|
+
actualValue?: JsonValue;
|
|
575
|
+
/**
|
|
576
|
+
* The constraint the value was expected to satisfy (such as the required type or allowed pattern).
|
|
577
|
+
*/
|
|
578
|
+
expectedConstraint?: string;
|
|
579
|
+
/**
|
|
580
|
+
* Name of the offending property.
|
|
581
|
+
*/
|
|
582
|
+
property?: string;
|
|
583
|
+
/**
|
|
584
|
+
* Lifecycle marker for the flagged resource type or property, such as \'deprecated\', \'create-only\', or \'write-only\'.
|
|
585
|
+
*/
|
|
586
|
+
lifecycle?: string;
|
|
587
|
+
/**
|
|
588
|
+
* How the offending value was derived, such as a Ref, Fn::GetAtt, Fn::If, or parameter.
|
|
589
|
+
*/
|
|
590
|
+
resolutionSource?: string;
|
|
591
|
+
/**
|
|
592
|
+
* Additional finding-specific values keyed by name.
|
|
593
|
+
*/
|
|
594
|
+
extra?: Record<string, JsonValue>;
|
|
271
595
|
}
|
|
272
596
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
597
|
+
/**
|
|
598
|
+
* How one template item refers to another: a Ref, an Fn::GetAtt attribute lookup,
|
|
599
|
+
* an Fn::Sub variable, or an explicit DependsOn.
|
|
600
|
+
*/
|
|
601
|
+
export type RefKind = 'REF' | { GET_ATT: { attr: string } } | { SUB: { var: string } } | 'DEPENDS_ON';
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Metadata describing a validation rule.
|
|
605
|
+
*/
|
|
606
|
+
export interface RuleInfo {
|
|
607
|
+
id: string;
|
|
608
|
+
severity: Severity;
|
|
609
|
+
category?: string;
|
|
610
|
+
description: string;
|
|
611
|
+
origin: RuleOrigin;
|
|
278
612
|
}
|
|
279
613
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
creationPolicy: JsonValue | undefined;
|
|
289
|
-
metadata: JsonValue | undefined;
|
|
290
|
-
properties: Record<string, ResolvedValue>;
|
|
291
|
-
diagnostics: ResourceDiagnostics;
|
|
614
|
+
/**
|
|
615
|
+
* Numeric range filter for rule IDs sharing a common letter prefix, matching an
|
|
616
|
+
* inclusive span of the trailing numbers.
|
|
617
|
+
*/
|
|
618
|
+
export interface IdRange {
|
|
619
|
+
prefix: string;
|
|
620
|
+
start: number;
|
|
621
|
+
end: number;
|
|
292
622
|
}
|
|
293
623
|
|
|
624
|
+
/**
|
|
625
|
+
* Outcome of a validation run. `Ok` means the engine completed; `Error` means
|
|
626
|
+
* the pipeline could not run (e.g. parse failure).
|
|
627
|
+
*/
|
|
628
|
+
export type ReportStatus = 'OK' | 'ERROR';
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Per-resource observations collected while resolving intrinsics, used to drive lint checks.
|
|
632
|
+
*/
|
|
294
633
|
export interface ResourceDiagnostics {
|
|
634
|
+
/**
|
|
635
|
+
* Mapping names referenced by Fn::FindInMap within this resource.
|
|
636
|
+
*/
|
|
295
637
|
findInMapRefs: string[];
|
|
638
|
+
/**
|
|
639
|
+
* Fn::Sub uses whose template is a single variable that could be a plain Ref; each pairs the property path with the variable name.
|
|
640
|
+
*/
|
|
296
641
|
simpleSubs: PathValuePair[];
|
|
642
|
+
/**
|
|
643
|
+
* Property paths where Fn::Sub wraps a constant string with no variables to substitute.
|
|
644
|
+
*/
|
|
297
645
|
redundantSubs: string[];
|
|
646
|
+
/**
|
|
647
|
+
* Property paths where Fn::Join uses an empty delimiter, concatenating its elements directly.
|
|
648
|
+
*/
|
|
298
649
|
emptyJoins: string[];
|
|
650
|
+
/**
|
|
651
|
+
* Names of conditions referenced by this resource\'s property values.
|
|
652
|
+
*/
|
|
299
653
|
conditionRefs: string[];
|
|
654
|
+
/**
|
|
655
|
+
* Property paths building ARNs with a hardcoded \'aws\' partition instead of AWS::Partition.
|
|
656
|
+
*/
|
|
300
657
|
hardcodedPartitionArns: string[];
|
|
301
658
|
conditionallyNullProps: ConditionalNullEntry[];
|
|
302
659
|
foreachExpansions: ForEachExpansion[];
|
|
660
|
+
/**
|
|
661
|
+
* Occurrences of ${...} placeholders outside an Fn::Sub that will not be substituted; each pairs the property path with the placeholder text.
|
|
662
|
+
*/
|
|
303
663
|
unsubstitutedVariables: PathValuePair[];
|
|
664
|
+
/**
|
|
665
|
+
* References whose target is not a defined resource, parameter, or pseudo parameter; each pairs the property path with the missing target name.
|
|
666
|
+
*/
|
|
304
667
|
invalidRefs: PathValuePair[];
|
|
305
668
|
}
|
|
306
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Records where a resolved resource property value came from.
|
|
672
|
+
*/
|
|
673
|
+
export interface ResolutionSource {
|
|
674
|
+
resourceId: string;
|
|
675
|
+
propertyPath: string;
|
|
676
|
+
/**
|
|
677
|
+
* Origin of the resolved value, such as a parameter default, allowed values, an override, or an intrinsic.
|
|
678
|
+
*/
|
|
679
|
+
source: string;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Selects which validation engine evaluates rules.
|
|
684
|
+
*/
|
|
685
|
+
export type EngineType = 'REGO' | 'CEL';
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Standard validation result: the report plus flattened diagnostics.
|
|
689
|
+
*/
|
|
690
|
+
export interface StandardReport {
|
|
691
|
+
filePath: string;
|
|
692
|
+
status: ReportStatus;
|
|
693
|
+
engineVersion: string;
|
|
694
|
+
metadata: ReportMetadata;
|
|
695
|
+
performance: PerformanceMetrics;
|
|
696
|
+
diagnostics: StandardDiagnostic[];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Suppress a rule for a specific logical resource ID. An absent `rule_id`
|
|
701
|
+
* scopes the filter to every rule on that resource.
|
|
702
|
+
*/
|
|
307
703
|
export interface ResourceIdFilter {
|
|
308
|
-
ruleId
|
|
704
|
+
ruleId?: string;
|
|
309
705
|
resourceId: string;
|
|
310
706
|
}
|
|
311
707
|
|
|
708
|
+
/**
|
|
709
|
+
* Suppress a rule for a specific resource type. An absent `rule_id` scopes the
|
|
710
|
+
* filter to every rule on that type.
|
|
711
|
+
*/
|
|
712
|
+
export interface ResourceTypeFilter {
|
|
713
|
+
ruleId?: string;
|
|
714
|
+
resourceType: string;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Suppress a rule for every resource belonging to a service — the
|
|
719
|
+
* `service-provider::service-name` prefix of the resource type (its first two
|
|
720
|
+
* `::`-delimited segments, for example `AWS::AutoScaling` in
|
|
721
|
+
* `AWS::AutoScaling::LaunchConfiguration`, or `Alexa::ASK` in
|
|
722
|
+
* `Alexa::ASK::Skill`). An absent `rule_id` scopes the filter to every rule on
|
|
723
|
+
* that service.
|
|
724
|
+
*
|
|
725
|
+
* The service string is compared verbatim against that prefix.
|
|
726
|
+
*/
|
|
727
|
+
export interface ServiceFilter {
|
|
728
|
+
ruleId?: string;
|
|
729
|
+
service: string;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* The template resource a diagnostic is attributed to, when it targets one.
|
|
734
|
+
*/
|
|
312
735
|
export interface ResourceRef {
|
|
736
|
+
/**
|
|
737
|
+
* Logical ID of the resource as declared in the template.
|
|
738
|
+
*/
|
|
313
739
|
id?: string;
|
|
314
740
|
resourceType?: string;
|
|
315
741
|
}
|
|
316
742
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Timing breakdown of the validation run, per pipeline phase.
|
|
745
|
+
*/
|
|
746
|
+
export interface PerformanceMetrics {
|
|
747
|
+
/**
|
|
748
|
+
* Time to load the provider schemas.
|
|
749
|
+
*/
|
|
750
|
+
schemaInit: PhaseMetric;
|
|
751
|
+
/**
|
|
752
|
+
* Time to initialize the rule evaluation engine.
|
|
753
|
+
*/
|
|
754
|
+
engineInit: PhaseMetric;
|
|
755
|
+
/**
|
|
756
|
+
* Time to parse the template and build its model.
|
|
757
|
+
*/
|
|
758
|
+
modelBuild: PhaseMetric;
|
|
759
|
+
schemaValidate: PhaseMetric;
|
|
760
|
+
ruleEvaluation: PhaseMetric;
|
|
761
|
+
/**
|
|
762
|
+
* Time spent enriching, filtering, sorting, and finalizing the diagnostics after rule evaluation.
|
|
763
|
+
*/
|
|
764
|
+
diagnosticFinalize: PhaseMetric;
|
|
765
|
+
validateTotal: PhaseMetric;
|
|
320
766
|
}
|
|
321
767
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
resourceIds?: ResourceIdFilter[];
|
|
328
|
-
resourceTypes?: ResourceTypeFilter[];
|
|
768
|
+
/**
|
|
769
|
+
* Timing for a single phase of validation (parsing, schema validation, rule evaluation, etc.).
|
|
770
|
+
*/
|
|
771
|
+
export interface PhaseMetric {
|
|
772
|
+
durationMs: number;
|
|
329
773
|
}
|
|
330
774
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
775
|
+
/**
|
|
776
|
+
* Top-level template metadata.
|
|
777
|
+
*/
|
|
778
|
+
export interface DiagnosticTemplate {
|
|
779
|
+
formatVersion?: string;
|
|
780
|
+
description?: string;
|
|
781
|
+
transforms: string[];
|
|
782
|
+
/**
|
|
783
|
+
* The top-level section names present in the template as written.
|
|
784
|
+
*/
|
|
785
|
+
rawTopLevelKeys: string[];
|
|
337
786
|
}
|
|
338
787
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
788
|
+
/**
|
|
789
|
+
* Validation pipeline phase a diagnostic originates from.
|
|
790
|
+
*/
|
|
791
|
+
export type Phase = 'PARSE' | 'SCHEMA' | 'LINT';
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Values used for AWS pseudo parameters (Ref AWS::Region, AWS::AccountId, ...) when
|
|
795
|
+
* resolving the template; any field left unset falls back to a sensible default.
|
|
796
|
+
*/
|
|
797
|
+
export interface PseudoParameterOverrides {
|
|
798
|
+
accountId?: string;
|
|
799
|
+
notificationArns?: string;
|
|
800
|
+
partition?: string;
|
|
801
|
+
region?: string;
|
|
802
|
+
stackId?: string;
|
|
803
|
+
stackName?: string;
|
|
804
|
+
urlSuffix?: string;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Where a rule\'s logic originates.
|
|
809
|
+
*/
|
|
810
|
+
export type RuleOrigin = 'SCHEMA' | 'CFN_LINT' | 'ENGINE' | 'CUSTOM' | 'GUARD';
|
|
345
811
|
|
|
812
|
+
/**
|
|
813
|
+
*r" A single validation finding with its resource and source location flattened into individual fields.
|
|
814
|
+
*/
|
|
346
815
|
export interface StandardDiagnostic {
|
|
816
|
+
/**
|
|
817
|
+
* Identifier of the rule that produced this finding; its leading letter encodes the severity.
|
|
818
|
+
*/
|
|
347
819
|
ruleId: string;
|
|
348
820
|
severity: Severity;
|
|
349
821
|
message: string;
|
|
822
|
+
/**
|
|
823
|
+
* Where the rule came from, such as a provider schema, the built-in engine, or a user-supplied rule.
|
|
824
|
+
*/
|
|
350
825
|
source: RuleOrigin;
|
|
826
|
+
/**
|
|
827
|
+
* Logical ID of the resource this finding targets, if any.
|
|
828
|
+
*/
|
|
351
829
|
resourceId?: string;
|
|
352
830
|
resourceType?: string;
|
|
831
|
+
/**
|
|
832
|
+
* Path to the offending property within the resource, such as \'Properties.Name\'.
|
|
833
|
+
*/
|
|
353
834
|
propertyPath?: string;
|
|
354
835
|
suggestedFix?: string;
|
|
355
836
|
category?: string;
|
|
837
|
+
/**
|
|
838
|
+
* Line in the source template where the finding begins (1-based).
|
|
839
|
+
*/
|
|
356
840
|
startLine?: number;
|
|
357
841
|
startColumn?: number;
|
|
358
842
|
endLine?: number;
|
|
359
843
|
endColumn?: number;
|
|
360
844
|
relatedResources?: RelatedResource[];
|
|
361
|
-
|
|
845
|
+
/**
|
|
846
|
+
* Condition name to boolean assignment under which this finding applies, when it depends on template conditions.
|
|
847
|
+
*/
|
|
848
|
+
conditionScenario?: Record<string, boolean>;
|
|
362
849
|
}
|
|
363
850
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
851
|
+
/**
|
|
852
|
+
*r" A validation finding with additional context and enrichment beyond the standard finding.
|
|
853
|
+
*/
|
|
854
|
+
export interface DetailedDiagnostic {
|
|
855
|
+
/**
|
|
856
|
+
* Identifier of the rule that produced this finding; its leading letter encodes the severity.
|
|
857
|
+
*/
|
|
858
|
+
ruleId: string;
|
|
859
|
+
severity: Severity;
|
|
860
|
+
message: string;
|
|
861
|
+
/**
|
|
862
|
+
* Where the rule came from, such as a provider schema, the built-in engine, or a user-supplied rule.
|
|
863
|
+
*/
|
|
864
|
+
source: RuleOrigin;
|
|
865
|
+
/**
|
|
866
|
+
* Logical ID of the resource this finding targets, if any.
|
|
867
|
+
*/
|
|
868
|
+
resourceId?: string;
|
|
869
|
+
resourceType?: string;
|
|
870
|
+
/**
|
|
871
|
+
* Path to the offending property within the resource, such as \'Properties.Name\'.
|
|
872
|
+
*/
|
|
873
|
+
propertyPath?: string;
|
|
874
|
+
suggestedFix?: string;
|
|
875
|
+
category?: string;
|
|
876
|
+
/**
|
|
877
|
+
* Line in the source template where the finding begins (1-based).
|
|
878
|
+
*/
|
|
879
|
+
startLine?: number;
|
|
880
|
+
startColumn?: number;
|
|
881
|
+
endLine?: number;
|
|
882
|
+
endColumn?: number;
|
|
883
|
+
relatedResources?: RelatedResource[];
|
|
884
|
+
/**
|
|
885
|
+
* Condition name to boolean assignment under which this finding applies, when it depends on template conditions.
|
|
886
|
+
*/
|
|
887
|
+
conditionScenario?: Record<string, boolean>;
|
|
888
|
+
documentationUrl?: string;
|
|
889
|
+
ruleDescription?: string;
|
|
890
|
+
phase?: Phase;
|
|
891
|
+
/**
|
|
892
|
+
*r" Top-level template section the finding falls under, such as 'Resources' or 'Parameters'.
|
|
893
|
+
*/
|
|
894
|
+
section?: string;
|
|
895
|
+
context?: ViolationContext;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface EngineConfig {
|
|
899
|
+
/**
|
|
900
|
+
* Engine-native custom rules (Rego or CEL depending on engine).
|
|
901
|
+
*/
|
|
902
|
+
customRules?: ExternalRuleSource[];
|
|
903
|
+
/**
|
|
904
|
+
* Guard DSL rules as raw source text, usable regardless of the selected engine.
|
|
905
|
+
*/
|
|
906
|
+
guardRules?: ExternalRuleSource[];
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export interface MapEntry {
|
|
910
|
+
key: string;
|
|
911
|
+
value: ResolvedValue;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export interface ReportMetadata {
|
|
915
|
+
/**
|
|
916
|
+
* Number of rules that were active for this run after any category exclusions.
|
|
917
|
+
*/
|
|
918
|
+
rulesEvaluated?: number;
|
|
919
|
+
resourcesScanned: number;
|
|
920
|
+
/**
|
|
921
|
+
* Tally of reported diagnostics by severity.
|
|
922
|
+
*/
|
|
923
|
+
counts: Summary;
|
|
924
|
+
/**
|
|
925
|
+
* Number of diagnostics removed by filters and the severity threshold.
|
|
926
|
+
*/
|
|
927
|
+
suppressed: number;
|
|
928
|
+
/**
|
|
929
|
+
* Whether strict mode was enabled, promoting warnings to errors.
|
|
930
|
+
*/
|
|
931
|
+
strict: boolean;
|
|
932
|
+
/**
|
|
933
|
+
* Minimum severity included in the report; lower-severity findings are omitted.
|
|
934
|
+
*/
|
|
935
|
+
severityLevel: Severity;
|
|
371
936
|
}
|
|
372
937
|
|
|
373
938
|
export interface Summary {
|
|
@@ -381,20 +946,11 @@ export interface Summary {
|
|
|
381
946
|
export interface ValidateConfig {
|
|
382
947
|
include?: RuleFilterConfig;
|
|
383
948
|
exclude?: RuleFilterConfig;
|
|
384
|
-
severityLevel?: Severity
|
|
385
|
-
parameterOverrides?: Record<string, string
|
|
386
|
-
pseudoParameterOverrides?: PseudoParameterOverrides
|
|
387
|
-
strict?: boolean
|
|
388
|
-
disableBuiltinRules?: boolean
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export interface ViolationContext {
|
|
392
|
-
actualValue?: JsonValue | undefined;
|
|
393
|
-
expectedConstraint?: string;
|
|
394
|
-
property?: string;
|
|
395
|
-
lifecycle?: string;
|
|
396
|
-
resolutionSource?: string;
|
|
397
|
-
extra?: Record<string, JsonValue>;
|
|
949
|
+
severityLevel?: Severity;
|
|
950
|
+
parameterOverrides?: Record<string, string>;
|
|
951
|
+
pseudoParameterOverrides?: PseudoParameterOverrides;
|
|
952
|
+
strict?: boolean;
|
|
953
|
+
disableBuiltinRules?: boolean;
|
|
398
954
|
}
|
|
399
955
|
|
|
400
956
|
export interface WasmSchemaValidationResult {
|
|
@@ -402,28 +958,6 @@ export interface WasmSchemaValidationResult {
|
|
|
402
958
|
metric: PhaseMetric;
|
|
403
959
|
}
|
|
404
960
|
|
|
405
|
-
export type DetailLevel = 'STANDARD' | 'DETAILED';
|
|
406
|
-
|
|
407
|
-
export type EngineType = 'REGO' | 'CEL';
|
|
408
|
-
|
|
409
|
-
export type Phase = 'PARSE' | 'SCHEMA' | 'LINT';
|
|
410
|
-
|
|
411
|
-
export type RefKind = 'REF' | { GET_ATT: { attr: string } } | { SUB: { var: string } } | 'DEPENDS_ON';
|
|
412
|
-
|
|
413
|
-
export type ReportStatus = 'OK' | 'ERROR';
|
|
414
|
-
|
|
415
|
-
export type ResolvedValue =
|
|
416
|
-
| { Concrete: { value: JsonValue } }
|
|
417
|
-
| { List: { items: ResolvedValue[] } }
|
|
418
|
-
| { Map: { entries: MapEntry[] } }
|
|
419
|
-
| { Enum: { variants: ResolvedValue[] } }
|
|
420
|
-
| { Conditional: { condition: string; if_true: ResolvedValue; if_false: ResolvedValue } }
|
|
421
|
-
| { Reference: { target: string; kind: RefKind } }
|
|
422
|
-
| { Dynamic: { reason: string } }
|
|
423
|
-
| { TypedDynamic: { reason: string; param_type: string } };
|
|
424
|
-
|
|
425
|
-
export type RuleOrigin = 'SCHEMA' | 'CFN_LINT' | 'ENGINE' | 'CUSTOM' | 'GUARD';
|
|
426
|
-
|
|
427
961
|
export type Severity = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL';
|
|
428
962
|
|
|
429
963
|
export class WasmCelEngine {
|