@aws/cloudformation-validate 1.7.0-beta → 1.8.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/NOTICE +8 -0
- package/README.md +19 -14
- package/bindings_wasm.d.ts +48 -11
- package/bindings_wasm_bg.wasm +0 -0
- package/package.json +5 -2
package/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
AWS CloudFormation Validate
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at
|
|
5
|
+
Amazon Web Services (https://aws.amazon.com/).
|
|
6
|
+
|
|
7
|
+
This software includes components licensed under various open source licenses.
|
|
8
|
+
You can find a full list of third-party licenses in the THIRD-PARTY-LICENSES.txt file included with this distribution.
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# CloudFormation Validate for Node.js
|
|
2
2
|
|
|
3
3
|
Validate AWS CloudFormation templates from JavaScript or TypeScript and catch schema violations, security risks, and
|
|
4
|
-
best-practice findings before deployment
|
|
4
|
+
best-practice findings before deployment - in your editor, build, or CI.
|
|
5
5
|
|
|
6
|
-
- **Offline**
|
|
7
|
-
- **Fast**
|
|
6
|
+
- **Offline** - all rules and resource schemas are bundled.
|
|
7
|
+
- **Fast** - sub-second validation per template.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ npm install @aws/cloudformation-validate
|
|
|
16
16
|
|
|
17
17
|
## Quick start
|
|
18
18
|
|
|
19
|
-
Engines, models, and validators hold off-heap memory
|
|
19
|
+
Engines, models, and validators hold off-heap memory - call `.free()` when done with each object:
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
import { RegoEngine, TemplateFile } from "@aws/cloudformation-validate";
|
|
@@ -32,13 +32,13 @@ try {
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Each diagnostic identifies the rule, severity, affected resource and property, and source location
|
|
35
|
+
Each diagnostic identifies the rule, severity, affected resource and property, and source location - see
|
|
36
36
|
[StandardDiagnostic](#standarddiagnostic). A complete, runnable project is in
|
|
37
37
|
[examples](https://github.com/aws-cloudformation/cloudformation-validate/tree/main/src/bindings-wasm/examples).
|
|
38
38
|
|
|
39
39
|
## Engine
|
|
40
40
|
|
|
41
|
-
`RegoEngine` and `CelEngine` both implement the `Engine` interface and are interchangeable
|
|
41
|
+
`RegoEngine` and `CelEngine` both implement the `Engine` interface and are interchangeable - they produce identical
|
|
42
42
|
diagnostics for the same template and config.
|
|
43
43
|
|
|
44
44
|
### `Engine` interface
|
|
@@ -59,7 +59,7 @@ Passed to the constructor. All fields are optional; omitted rule arrays are empt
|
|
|
59
59
|
```typescript
|
|
60
60
|
interface EngineConfig {
|
|
61
61
|
customRules?: RuleSource[]; // engine-native rules (Rego for RegoEngine, CEL for CelEngine)
|
|
62
|
-
guardRules?: RuleSource[]; // CloudFormation Guard DSL rules
|
|
62
|
+
guardRules?: RuleSource[]; // CloudFormation Guard DSL rules - translated internally
|
|
63
63
|
schemaValidatorConfig?: SchemaValidatorConfig; // schema validation and overlay configuration
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -89,7 +89,7 @@ interface AdditionalSchemaSource {
|
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
Pass a `RuleFile` to load a rule from disk
|
|
92
|
+
Pass a `RuleFile` to load a rule from disk - the same pattern as `TemplateFile` for templates - or an
|
|
93
93
|
`ExternalRuleSource` when you already have the rule text in memory. `SchemaFile` does the same for an additional
|
|
94
94
|
resource provider schema. Its optional constructor `typeName` may be omitted when the schema JSON contains its own
|
|
95
95
|
`typeName`.
|
|
@@ -109,7 +109,7 @@ const engine = new CelEngine({
|
|
|
109
109
|
|
|
110
110
|
## ValidateConfig
|
|
111
111
|
|
|
112
|
-
Controls filtering, severity, parameter overrides, and behavior. All fields optional
|
|
112
|
+
Controls filtering, severity, parameter overrides, and behavior. All fields optional - omitting the config or passing
|
|
113
113
|
`{}` uses defaults.
|
|
114
114
|
|
|
115
115
|
```typescript
|
|
@@ -136,7 +136,7 @@ interface ValidateConfig {
|
|
|
136
136
|
|
|
137
137
|
### RuleFilterConfig
|
|
138
138
|
|
|
139
|
-
Both `include` and `exclude` use this structure. All fields are additive
|
|
139
|
+
Both `include` and `exclude` use this structure. All fields are additive - a rule matches if it hits any criterion.
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
142
142
|
interface RuleFilterConfig {
|
|
@@ -158,7 +158,7 @@ interface ResourceTypeFilter { ruleId?: string; resourceType: string; }
|
|
|
158
158
|
interface ServiceFilter { ruleId?: string; service: string; }
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
The `service` is matched verbatim against the `service-provider::service-name` prefix of the resource type
|
|
161
|
+
The `service` is matched verbatim against the `service-provider::service-name` prefix of the resource type - its first
|
|
162
162
|
two `::`-delimited segments (e.g. `AWS::AutoScaling` in `AWS::AutoScaling::LaunchConfiguration`).
|
|
163
163
|
|
|
164
164
|
The `resourceIds` dimension matches only diagnostics attributed to a resource; `logicalIds` additionally matches
|
|
@@ -168,7 +168,7 @@ the same value). An optional `entityType` scopes a `LogicalIdFilter` to entities
|
|
|
168
168
|
|
|
169
169
|
### PseudoParameterOverrides
|
|
170
170
|
|
|
171
|
-
Override CloudFormation pseudo-parameters used during intrinsic function resolution. All fields optional
|
|
171
|
+
Override CloudFormation pseudo-parameters used during intrinsic function resolution. All fields optional - when
|
|
172
172
|
`undefined`, the engine uses built-in defaults (e.g. region defaults to `us-east-1`).
|
|
173
173
|
|
|
174
174
|
```typescript
|
|
@@ -193,7 +193,7 @@ const template = new TemplateFile("path/to/template.yaml");
|
|
|
193
193
|
|
|
194
194
|
## TemplateModel
|
|
195
195
|
|
|
196
|
-
Parses a template into the resolved `SemanticModel` for direct inspection
|
|
196
|
+
Parses a template into the resolved `SemanticModel` for direct inspection - the same model the engines evaluate rules
|
|
197
197
|
against.
|
|
198
198
|
|
|
199
199
|
```typescript
|
|
@@ -238,7 +238,7 @@ validator.free();
|
|
|
238
238
|
```typescript
|
|
239
239
|
interface StandardReport {
|
|
240
240
|
filePath: string;
|
|
241
|
-
status: "OK" | "ERROR";
|
|
241
|
+
status: "OK" | "ANALYSIS_INCOMPLETE" | "ERROR"; // ERROR is a pipeline failure; ANALYSIS_INCOMPLETE may omit findings
|
|
242
242
|
version: string;
|
|
243
243
|
metadata: ReportMetadata;
|
|
244
244
|
performance: PerformanceMetrics;
|
|
@@ -250,6 +250,11 @@ interface StandardReport {
|
|
|
250
250
|
`ruleDescription`, `phase` (`PARSE` | `SCHEMA` | `LINT`), and `context` (`ViolationContext` with
|
|
251
251
|
`actualValue`, `expectedConstraint`, `resolutionSource`, etc.).
|
|
252
252
|
|
|
253
|
+
Each optional budget-exhaustion record retains a stable machine-readable kind and also includes a
|
|
254
|
+
human-readable description sentence, the numeric limit, and whether that specific exhaustion makes analysis
|
|
255
|
+
incomplete. `requiredPropertyCombinations` is context-only, so its `analysisIncomplete` value is `false` and the
|
|
256
|
+
report can remain `"OK"`.
|
|
257
|
+
|
|
253
258
|
### StandardDiagnostic
|
|
254
259
|
|
|
255
260
|
```typescript
|
package/bindings_wasm.d.ts
CHANGED
|
@@ -306,6 +306,28 @@ export interface DiagnosticRuleAssertion {
|
|
|
306
306
|
assertDescription?: string;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
/**
|
|
310
|
+
* A single budget-exhaustion record in report metadata.
|
|
311
|
+
*/
|
|
312
|
+
export interface BudgetExhaustionRecord {
|
|
313
|
+
/**
|
|
314
|
+
* Stable lower camelCase budget kind identifier.
|
|
315
|
+
*/
|
|
316
|
+
kind: string;
|
|
317
|
+
/**
|
|
318
|
+
* Human-readable explanation of the exhausted budget.
|
|
319
|
+
*/
|
|
320
|
+
description?: string;
|
|
321
|
+
/**
|
|
322
|
+
* The numeric limit that was exhausted.
|
|
323
|
+
*/
|
|
324
|
+
limit: number;
|
|
325
|
+
/**
|
|
326
|
+
* Whether exhausting this budget makes the overall analysis incomplete.
|
|
327
|
+
*/
|
|
328
|
+
analysisIncomplete: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
309
331
|
/**
|
|
310
332
|
* A single edge in the template\'s reference graph, from a referencing resource to its target.
|
|
311
333
|
*/
|
|
@@ -428,7 +450,7 @@ export interface ResolvedResource {
|
|
|
428
450
|
* A top-level CloudFormation template section, as documented in the template
|
|
429
451
|
* anatomy (<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html>).
|
|
430
452
|
*
|
|
431
|
-
* This is the canonical, single definition of the section names
|
|
453
|
+
* This is the canonical, single definition of the section names - section
|
|
432
454
|
* constants in other crates derive from it.
|
|
433
455
|
*/
|
|
434
456
|
export type TopLevelSection =
|
|
@@ -692,10 +714,12 @@ export interface IdRange {
|
|
|
692
714
|
}
|
|
693
715
|
|
|
694
716
|
/**
|
|
695
|
-
* Outcome of a validation run. `Ok` means
|
|
696
|
-
*
|
|
717
|
+
* Outcome of a validation run. `Ok` means validation completed without
|
|
718
|
+
* correctness-affecting curtailment. `AnalysisIncomplete` means a deterministic
|
|
719
|
+
* budget curtailed analysis in a way that could omit findings. `Error` means
|
|
720
|
+
* the validation pipeline could not run, such as when parsing fails.
|
|
697
721
|
*/
|
|
698
|
-
export type ReportStatus = 'OK' | 'ERROR';
|
|
722
|
+
export type ReportStatus = 'OK' | 'ANALYSIS_INCOMPLETE' | 'ERROR';
|
|
699
723
|
|
|
700
724
|
/**
|
|
701
725
|
* Per-resource observations collected while resolving intrinsics, used to drive lint checks.
|
|
@@ -788,8 +812,8 @@ export interface ResourceIdFilter {
|
|
|
788
812
|
}
|
|
789
813
|
|
|
790
814
|
/**
|
|
791
|
-
* Suppress a rule for a specific named template entity
|
|
792
|
-
* parameter, output, mapping, condition, or template rule
|
|
815
|
+
* Suppress a rule for a specific named template entity - a resource,
|
|
816
|
+
* parameter, output, mapping, condition, or template rule - identified by its
|
|
793
817
|
* logical ID. An absent `rule_id` scopes the filter to every rule on that
|
|
794
818
|
* entity; an absent `entity_type` scopes it to entities of every type with
|
|
795
819
|
* that logical ID.
|
|
@@ -810,7 +834,7 @@ export interface ResourceTypeFilter {
|
|
|
810
834
|
}
|
|
811
835
|
|
|
812
836
|
/**
|
|
813
|
-
* Suppress a rule for every resource belonging to a service
|
|
837
|
+
* Suppress a rule for every resource belonging to a service - the
|
|
814
838
|
* `service-provider::service-name` prefix of the resource type (its first two
|
|
815
839
|
* `::`-delimited segments, for example `AWS::AutoScaling` in
|
|
816
840
|
* `AWS::AutoScaling::LaunchConfiguration`, or `Alexa::ASK` in
|
|
@@ -825,7 +849,7 @@ export interface ServiceFilter {
|
|
|
825
849
|
}
|
|
826
850
|
|
|
827
851
|
/**
|
|
828
|
-
* The kind of template entity a diagnostic targets
|
|
852
|
+
* The kind of template entity a diagnostic targets - the singular form of the
|
|
829
853
|
* top-level section the entity is declared in. Every documented section has a
|
|
830
854
|
* variant; the ones whose children are addressable by logical ID (resources,
|
|
831
855
|
* parameters, outputs, mappings, conditions, rules, and metadata keys) are
|
|
@@ -956,7 +980,7 @@ export interface StandardDiagnostic {
|
|
|
956
980
|
*/
|
|
957
981
|
source: RuleOrigin;
|
|
958
982
|
/**
|
|
959
|
-
* The named template entity this finding targets
|
|
983
|
+
* The named template entity this finding targets - a resource, parameter, output, mapping, condition, or template rule - if any.
|
|
960
984
|
*/
|
|
961
985
|
entity?: Entity;
|
|
962
986
|
/**
|
|
@@ -994,7 +1018,7 @@ export interface DetailedDiagnostic {
|
|
|
994
1018
|
*/
|
|
995
1019
|
source: RuleOrigin;
|
|
996
1020
|
/**
|
|
997
|
-
* The named template entity this finding targets
|
|
1021
|
+
* The named template entity this finding targets - a resource, parameter, output, mapping, condition, or template rule - if any.
|
|
998
1022
|
*/
|
|
999
1023
|
entity?: Entity;
|
|
1000
1024
|
/**
|
|
@@ -1048,7 +1072,15 @@ export interface ReportMetadata {
|
|
|
1048
1072
|
/**
|
|
1049
1073
|
* Number of rules that were active for this run after any category exclusions.
|
|
1050
1074
|
*/
|
|
1051
|
-
rulesEvaluated
|
|
1075
|
+
rulesEvaluated: number;
|
|
1076
|
+
/**
|
|
1077
|
+
* Source-qualified cfn-lint version used to sync bundled derived data.
|
|
1078
|
+
*/
|
|
1079
|
+
cfnLintVersion: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* Source-qualified enhanced resource-schema version used for the bundled provider schemas.
|
|
1082
|
+
*/
|
|
1083
|
+
resourceSchemaVersion: string;
|
|
1052
1084
|
resourcesScanned: number;
|
|
1053
1085
|
/**
|
|
1054
1086
|
* Tally of reported diagnostics by severity.
|
|
@@ -1066,6 +1098,11 @@ export interface ReportMetadata {
|
|
|
1066
1098
|
* Minimum severity included in the report; lower-severity findings are omitted.
|
|
1067
1099
|
*/
|
|
1068
1100
|
severityLevel: Severity;
|
|
1101
|
+
/**
|
|
1102
|
+
* Records of deterministic validation budgets exhausted during this run.
|
|
1103
|
+
* Absent when no budget was exhausted.
|
|
1104
|
+
*/
|
|
1105
|
+
budgetExhaustions?: BudgetExhaustionRecord[] | undefined;
|
|
1069
1106
|
}
|
|
1070
1107
|
|
|
1071
1108
|
export interface Summary {
|
package/bindings_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/cloudformation-validate",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "AWS CloudFormation
|
|
3
|
+
"version": "1.8.0-beta",
|
|
4
|
+
"description": "Fast, offline, embeddable validation for AWS CloudFormation templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
7
7
|
"amazon",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"name": "Amazon Web Services",
|
|
18
18
|
"url": "https://aws.amazon.com"
|
|
19
19
|
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/aws-cloudformation/cloudformation-validate/issues"
|
|
22
|
+
},
|
|
20
23
|
"license": "Apache-2.0",
|
|
21
24
|
"engines": {
|
|
22
25
|
"node": ">=20.0.0"
|