@aws/cloudformation-validate 1.6.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 +46 -17
- package/THIRD-PARTY-LICENSES.txt +101 -22
- package/bindings_wasm.d.ts +94 -12
- package/bindings_wasm.js +9 -3
- package/bindings_wasm_bg.wasm +0 -0
- package/bindings_wasm_bg.wasm.d.ts +1 -1
- package/index.d.ts +31 -0
- package/index.js +30 -2
- 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
|
|
@@ -53,39 +53,63 @@ diagnostics for the same template and config.
|
|
|
53
53
|
|
|
54
54
|
### `EngineConfig`
|
|
55
55
|
|
|
56
|
-
Passed to the constructor. All fields optional
|
|
56
|
+
Passed to the constructor. All fields are optional; omitted rule arrays are empty and an omitted
|
|
57
|
+
`schemaValidatorConfig` uses only the bundled schemas.
|
|
57
58
|
|
|
58
59
|
```typescript
|
|
59
60
|
interface EngineConfig {
|
|
60
|
-
customRules?: RuleSource[];
|
|
61
|
-
guardRules?: RuleSource[];
|
|
61
|
+
customRules?: RuleSource[]; // engine-native rules (Rego for RegoEngine, CEL for CelEngine)
|
|
62
|
+
guardRules?: RuleSource[]; // CloudFormation Guard DSL rules - translated internally
|
|
63
|
+
schemaValidatorConfig?: SchemaValidatorConfig; // schema validation and overlay configuration
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface SchemaValidatorConfig {
|
|
67
|
+
additionalSchemas?: SchemaSource[]; // resource provider schemas merged over the bundled schemas
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
type RuleSource = ExternalRuleSource | RuleFile;
|
|
71
|
+
type SchemaSource = AdditionalSchemaSource | SchemaFile;
|
|
65
72
|
|
|
66
73
|
class RuleFile {
|
|
67
74
|
constructor(path: string); // rule file read from disk; the path becomes the rule source name
|
|
68
75
|
}
|
|
69
76
|
|
|
77
|
+
class SchemaFile {
|
|
78
|
+
constructor(path: string, typeName?: string); // schema file; typeName defaults to the value inside the JSON
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
interface ExternalRuleSource {
|
|
71
82
|
name: string; // identifier shown in diagnostics (e.g. file path)
|
|
72
83
|
content: string; // full rule source text
|
|
73
84
|
}
|
|
85
|
+
|
|
86
|
+
interface AdditionalSchemaSource {
|
|
87
|
+
typeName?: string; // omit to use the typeName inside the schema JSON
|
|
88
|
+
schema: string; // complete resource provider schema JSON
|
|
89
|
+
}
|
|
74
90
|
```
|
|
75
91
|
|
|
76
|
-
Pass a `RuleFile` to load a rule from disk
|
|
77
|
-
`ExternalRuleSource` when you already have the rule text in memory.
|
|
92
|
+
Pass a `RuleFile` to load a rule from disk - the same pattern as `TemplateFile` for templates - or an
|
|
93
|
+
`ExternalRuleSource` when you already have the rule text in memory. `SchemaFile` does the same for an additional
|
|
94
|
+
resource provider schema. Its optional constructor `typeName` may be omitted when the schema JSON contains its own
|
|
95
|
+
`typeName`.
|
|
96
|
+
|
|
97
|
+
The generated `AdditionalSchemaSource` record exposes `typeName` as an optional field. Omit it (or leave the
|
|
98
|
+
`SchemaFile` constructor argument unset) for an in-memory schema whose JSON already contains its own `typeName`.
|
|
78
99
|
|
|
79
100
|
```typescript
|
|
80
101
|
const engine = new CelEngine({
|
|
81
102
|
customRules: [new RuleFile("rules/s3_encryption.json")],
|
|
82
103
|
guardRules: [new RuleFile("rules/compliance.guard")],
|
|
104
|
+
schemaValidatorConfig: {
|
|
105
|
+
additionalSchemas: [new SchemaFile("schemas/aws-lambda-function.json")],
|
|
106
|
+
},
|
|
83
107
|
});
|
|
84
108
|
```
|
|
85
109
|
|
|
86
110
|
## ValidateConfig
|
|
87
111
|
|
|
88
|
-
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
|
|
89
113
|
`{}` uses defaults.
|
|
90
114
|
|
|
91
115
|
```typescript
|
|
@@ -112,7 +136,7 @@ interface ValidateConfig {
|
|
|
112
136
|
|
|
113
137
|
### RuleFilterConfig
|
|
114
138
|
|
|
115
|
-
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.
|
|
116
140
|
|
|
117
141
|
```typescript
|
|
118
142
|
interface RuleFilterConfig {
|
|
@@ -134,7 +158,7 @@ interface ResourceTypeFilter { ruleId?: string; resourceType: string; }
|
|
|
134
158
|
interface ServiceFilter { ruleId?: string; service: string; }
|
|
135
159
|
```
|
|
136
160
|
|
|
137
|
-
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
|
|
138
162
|
two `::`-delimited segments (e.g. `AWS::AutoScaling` in `AWS::AutoScaling::LaunchConfiguration`).
|
|
139
163
|
|
|
140
164
|
The `resourceIds` dimension matches only diagnostics attributed to a resource; `logicalIds` additionally matches
|
|
@@ -144,7 +168,7 @@ the same value). An optional `entityType` scopes a `LogicalIdFilter` to entities
|
|
|
144
168
|
|
|
145
169
|
### PseudoParameterOverrides
|
|
146
170
|
|
|
147
|
-
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
|
|
148
172
|
`undefined`, the engine uses built-in defaults (e.g. region defaults to `us-east-1`).
|
|
149
173
|
|
|
150
174
|
```typescript
|
|
@@ -169,7 +193,7 @@ const template = new TemplateFile("path/to/template.yaml");
|
|
|
169
193
|
|
|
170
194
|
## TemplateModel
|
|
171
195
|
|
|
172
|
-
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
|
|
173
197
|
against.
|
|
174
198
|
|
|
175
199
|
```typescript
|
|
@@ -214,7 +238,7 @@ validator.free();
|
|
|
214
238
|
```typescript
|
|
215
239
|
interface StandardReport {
|
|
216
240
|
filePath: string;
|
|
217
|
-
status: "OK" | "ERROR";
|
|
241
|
+
status: "OK" | "ANALYSIS_INCOMPLETE" | "ERROR"; // ERROR is a pipeline failure; ANALYSIS_INCOMPLETE may omit findings
|
|
218
242
|
version: string;
|
|
219
243
|
metadata: ReportMetadata;
|
|
220
244
|
performance: PerformanceMetrics;
|
|
@@ -226,6 +250,11 @@ interface StandardReport {
|
|
|
226
250
|
`ruleDescription`, `phase` (`PARSE` | `SCHEMA` | `LINT`), and `context` (`ViolationContext` with
|
|
227
251
|
`actualValue`, `expectedConstraint`, `resolutionSource`, etc.).
|
|
228
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
|
+
|
|
229
258
|
### StandardDiagnostic
|
|
230
259
|
|
|
231
260
|
```typescript
|
package/THIRD-PARTY-LICENSES.txt
CHANGED
|
@@ -84,7 +84,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
84
84
|
******************************
|
|
85
85
|
|
|
86
86
|
anyhow
|
|
87
|
-
1.0.
|
|
87
|
+
1.0.104 <https://github.com/dtolnay/anyhow>
|
|
88
88
|
Apache License
|
|
89
89
|
Version 2.0, January 2004
|
|
90
90
|
http://www.apache.org/licenses/
|
|
@@ -3445,7 +3445,7 @@ the following restrictions:
|
|
|
3445
3445
|
******************************
|
|
3446
3446
|
|
|
3447
3447
|
futures-core
|
|
3448
|
-
0.3.
|
|
3448
|
+
0.3.33 <https://github.com/rust-lang/futures-rs>
|
|
3449
3449
|
Apache License
|
|
3450
3450
|
Version 2.0, January 2004
|
|
3451
3451
|
http://www.apache.org/licenses/
|
|
@@ -3653,7 +3653,7 @@ limitations under the License.
|
|
|
3653
3653
|
******************************
|
|
3654
3654
|
|
|
3655
3655
|
futures-task
|
|
3656
|
-
0.3.
|
|
3656
|
+
0.3.33 <https://github.com/rust-lang/futures-rs>
|
|
3657
3657
|
Apache License
|
|
3658
3658
|
Version 2.0, January 2004
|
|
3659
3659
|
http://www.apache.org/licenses/
|
|
@@ -3861,7 +3861,7 @@ limitations under the License.
|
|
|
3861
3861
|
******************************
|
|
3862
3862
|
|
|
3863
3863
|
futures-util
|
|
3864
|
-
0.3.
|
|
3864
|
+
0.3.33 <https://github.com/rust-lang/futures-rs>
|
|
3865
3865
|
Apache License
|
|
3866
3866
|
Version 2.0, January 2004
|
|
3867
3867
|
http://www.apache.org/licenses/
|
|
@@ -6789,7 +6789,7 @@ limitations under the License.
|
|
|
6789
6789
|
******************************
|
|
6790
6790
|
|
|
6791
6791
|
memchr
|
|
6792
|
-
2.8.
|
|
6792
|
+
2.8.3 <https://github.com/BurntSushi/memchr>
|
|
6793
6793
|
The MIT License (MIT)
|
|
6794
6794
|
|
|
6795
6795
|
Copyright (c) 2015 Andrew Gallant
|
|
@@ -7361,7 +7361,7 @@ SOFTWARE.
|
|
|
7361
7361
|
******************************
|
|
7362
7362
|
|
|
7363
7363
|
num-bigint
|
|
7364
|
-
0.4.
|
|
7364
|
+
0.4.8 <https://github.com/rust-num/num-bigint>
|
|
7365
7365
|
Apache License
|
|
7366
7366
|
Version 2.0, January 2004
|
|
7367
7367
|
http://www.apache.org/licenses/
|
|
@@ -8968,7 +8968,7 @@ limitations under the License.
|
|
|
8968
8968
|
******************************
|
|
8969
8969
|
|
|
8970
8970
|
proc-macro2
|
|
8971
|
-
1.0.
|
|
8971
|
+
1.0.107 <https://github.com/dtolnay/proc-macro2>
|
|
8972
8972
|
Apache License
|
|
8973
8973
|
Version 2.0, January 2004
|
|
8974
8974
|
http://www.apache.org/licenses/
|
|
@@ -9047,7 +9047,7 @@ limitations under the License.
|
|
|
9047
9047
|
******************************
|
|
9048
9048
|
|
|
9049
9049
|
quote
|
|
9050
|
-
1.0.
|
|
9050
|
+
1.0.47 <https://github.com/dtolnay/quote>
|
|
9051
9051
|
Apache License
|
|
9052
9052
|
Version 2.0, January 2004
|
|
9053
9053
|
http://www.apache.org/licenses/
|
|
@@ -9126,7 +9126,7 @@ limitations under the License.
|
|
|
9126
9126
|
******************************
|
|
9127
9127
|
|
|
9128
9128
|
rand
|
|
9129
|
-
0.9.
|
|
9129
|
+
0.9.5 <https://github.com/rust-random/rand>
|
|
9130
9130
|
Apache License
|
|
9131
9131
|
Version 2.0, January 2004
|
|
9132
9132
|
http://www.apache.org/licenses/
|
|
@@ -9477,7 +9477,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
|
9477
9477
|
******************************
|
|
9478
9478
|
|
|
9479
9479
|
regex
|
|
9480
|
-
1.
|
|
9480
|
+
1.13.1 <https://github.com/rust-lang/regex>
|
|
9481
9481
|
Apache License
|
|
9482
9482
|
Version 2.0, January 2004
|
|
9483
9483
|
http://www.apache.org/licenses/
|
|
@@ -9684,7 +9684,7 @@ limitations under the License.
|
|
|
9684
9684
|
******************************
|
|
9685
9685
|
|
|
9686
9686
|
regex-automata
|
|
9687
|
-
0.4.
|
|
9687
|
+
0.4.16 <https://github.com/rust-lang/regex>
|
|
9688
9688
|
Apache License
|
|
9689
9689
|
Version 2.0, January 2004
|
|
9690
9690
|
http://www.apache.org/licenses/
|
|
@@ -10752,7 +10752,7 @@ limitations under the License.
|
|
|
10752
10752
|
******************************
|
|
10753
10753
|
|
|
10754
10754
|
serde
|
|
10755
|
-
1.0.
|
|
10755
|
+
1.0.229 <https://github.com/serde-rs/serde>
|
|
10756
10756
|
Apache License
|
|
10757
10757
|
Version 2.0, January 2004
|
|
10758
10758
|
http://www.apache.org/licenses/
|
|
@@ -10858,7 +10858,7 @@ SOFTWARE.
|
|
|
10858
10858
|
******************************
|
|
10859
10859
|
|
|
10860
10860
|
serde_core
|
|
10861
|
-
1.0.
|
|
10861
|
+
1.0.229 <https://github.com/serde-rs/serde>
|
|
10862
10862
|
Apache License
|
|
10863
10863
|
Version 2.0, January 2004
|
|
10864
10864
|
http://www.apache.org/licenses/
|
|
@@ -10937,7 +10937,7 @@ limitations under the License.
|
|
|
10937
10937
|
******************************
|
|
10938
10938
|
|
|
10939
10939
|
serde_derive
|
|
10940
|
-
1.0.
|
|
10940
|
+
1.0.229 <https://github.com/serde-rs/serde>
|
|
10941
10941
|
Apache License
|
|
10942
10942
|
Version 2.0, January 2004
|
|
10943
10943
|
http://www.apache.org/licenses/
|
|
@@ -11095,7 +11095,7 @@ limitations under the License.
|
|
|
11095
11095
|
******************************
|
|
11096
11096
|
|
|
11097
11097
|
serde_json
|
|
11098
|
-
1.0.
|
|
11098
|
+
1.0.151 <https://github.com/serde-rs/json>
|
|
11099
11099
|
Apache License
|
|
11100
11100
|
Version 2.0, January 2004
|
|
11101
11101
|
http://www.apache.org/licenses/
|
|
@@ -11491,7 +11491,7 @@ limitations under the License.
|
|
|
11491
11491
|
******************************
|
|
11492
11492
|
|
|
11493
11493
|
spin
|
|
11494
|
-
0.9.
|
|
11494
|
+
0.9.9 <https://github.com/mvdnes/spin-rs.git>
|
|
11495
11495
|
The MIT License (MIT)
|
|
11496
11496
|
|
|
11497
11497
|
Copyright (c) 2014 Mathijs van de Nes
|
|
@@ -11517,7 +11517,86 @@ SOFTWARE.
|
|
|
11517
11517
|
******************************
|
|
11518
11518
|
|
|
11519
11519
|
syn
|
|
11520
|
-
2.0.
|
|
11520
|
+
2.0.119 <https://github.com/dtolnay/syn>
|
|
11521
|
+
Apache License
|
|
11522
|
+
Version 2.0, January 2004
|
|
11523
|
+
http://www.apache.org/licenses/
|
|
11524
|
+
|
|
11525
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11526
|
+
|
|
11527
|
+
1. Definitions.
|
|
11528
|
+
|
|
11529
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
11530
|
+
|
|
11531
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
11532
|
+
|
|
11533
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
11534
|
+
|
|
11535
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
11536
|
+
|
|
11537
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
11538
|
+
|
|
11539
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
11540
|
+
|
|
11541
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
11542
|
+
|
|
11543
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
11544
|
+
|
|
11545
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
11546
|
+
|
|
11547
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
11548
|
+
|
|
11549
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
11550
|
+
|
|
11551
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
11552
|
+
|
|
11553
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
11554
|
+
|
|
11555
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
11556
|
+
|
|
11557
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
11558
|
+
|
|
11559
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
11560
|
+
|
|
11561
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
11562
|
+
|
|
11563
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
11564
|
+
|
|
11565
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
11566
|
+
|
|
11567
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
11568
|
+
|
|
11569
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
11570
|
+
|
|
11571
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
11572
|
+
|
|
11573
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
11574
|
+
|
|
11575
|
+
END OF TERMS AND CONDITIONS
|
|
11576
|
+
|
|
11577
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
11578
|
+
|
|
11579
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
11580
|
+
|
|
11581
|
+
Copyright [yyyy] [name of copyright owner]
|
|
11582
|
+
|
|
11583
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
11584
|
+
you may not use this file except in compliance with the License.
|
|
11585
|
+
You may obtain a copy of the License at
|
|
11586
|
+
|
|
11587
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11588
|
+
|
|
11589
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11590
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11591
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11592
|
+
See the License for the specific language governing permissions and
|
|
11593
|
+
limitations under the License.
|
|
11594
|
+
|
|
11595
|
+
|
|
11596
|
+
******************************
|
|
11597
|
+
|
|
11598
|
+
syn
|
|
11599
|
+
3.0.3 <https://github.com/dtolnay/syn>
|
|
11521
11600
|
Apache License
|
|
11522
11601
|
Version 2.0, January 2004
|
|
11523
11602
|
http://www.apache.org/licenses/
|
|
@@ -11675,7 +11754,7 @@ limitations under the License.
|
|
|
11675
11754
|
******************************
|
|
11676
11755
|
|
|
11677
11756
|
thiserror
|
|
11678
|
-
2.0.
|
|
11757
|
+
2.0.19 <https://github.com/dtolnay/thiserror>
|
|
11679
11758
|
Apache License
|
|
11680
11759
|
Version 2.0, January 2004
|
|
11681
11760
|
http://www.apache.org/licenses/
|
|
@@ -11833,7 +11912,7 @@ limitations under the License.
|
|
|
11833
11912
|
******************************
|
|
11834
11913
|
|
|
11835
11914
|
thiserror-impl
|
|
11836
|
-
2.0.
|
|
11915
|
+
2.0.19 <https://github.com/dtolnay/thiserror>
|
|
11837
11916
|
Apache License
|
|
11838
11917
|
Version 2.0, January 2004
|
|
11839
11918
|
http://www.apache.org/licenses/
|
|
@@ -12276,7 +12355,7 @@ THE SOFTWARE.
|
|
|
12276
12355
|
******************************
|
|
12277
12356
|
|
|
12278
12357
|
uuid
|
|
12279
|
-
1.
|
|
12358
|
+
1.24.0 <https://github.com/uuid-rs/uuid>
|
|
12280
12359
|
Apache License
|
|
12281
12360
|
Version 2.0, January 2004
|
|
12282
12361
|
http://www.apache.org/licenses/
|
|
@@ -13923,7 +14002,7 @@ END OF TERMS AND CONDITIONS
|
|
|
13923
14002
|
******************************
|
|
13924
14003
|
|
|
13925
14004
|
zerocopy
|
|
13926
|
-
0.8.
|
|
14005
|
+
0.8.55 <https://github.com/google/zerocopy>
|
|
13927
14006
|
Apache License
|
|
13928
14007
|
Version 2.0, January 2004
|
|
13929
14008
|
http://www.apache.org/licenses/
|
|
@@ -14131,7 +14210,7 @@ zerocopy
|
|
|
14131
14210
|
******************************
|
|
14132
14211
|
|
|
14133
14212
|
zmij
|
|
14134
|
-
1.0.
|
|
14213
|
+
1.0.23 <https://github.com/dtolnay/zmij>
|
|
14135
14214
|
Permission is hereby granted, free of charge, to any
|
|
14136
14215
|
person obtaining a copy of this software and associated
|
|
14137
14216
|
documentation files (the "Software"), to deal in the
|
package/bindings_wasm.d.ts
CHANGED
|
@@ -270,6 +270,31 @@ export interface DiagnosticCondition {
|
|
|
270
270
|
mutexWith?: string[];
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* A single additional CloudFormation resource provider schema to overlay on top
|
|
275
|
+
* of the bundled schemas.
|
|
276
|
+
*
|
|
277
|
+
* `type_name` identifies the resource type (e.g., `\"AWS::Lambda::Function\"`).
|
|
278
|
+
* When absent (`None`), the `typeName` field inside the schema JSON is used
|
|
279
|
+
* instead. When both are present they must agree.
|
|
280
|
+
*
|
|
281
|
+
* `schema` is the complete resource provider schema as a JSON string, in the
|
|
282
|
+
* standard CloudFormation registry format.
|
|
283
|
+
*/
|
|
284
|
+
export interface AdditionalSchemaSource {
|
|
285
|
+
/**
|
|
286
|
+
* The resource type name (e.g., `\"AWS::Lambda::Function\"`). When absent, the
|
|
287
|
+
* `typeName` field of the schema JSON is used instead. When both are
|
|
288
|
+
* present they must agree.
|
|
289
|
+
*/
|
|
290
|
+
typeName?: string;
|
|
291
|
+
/**
|
|
292
|
+
* The complete resource provider schema as a JSON string, in the standard
|
|
293
|
+
* CloudFormation registry format.
|
|
294
|
+
*/
|
|
295
|
+
schema: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
273
298
|
/**
|
|
274
299
|
* A single assertion within a template rule.
|
|
275
300
|
*/
|
|
@@ -281,6 +306,28 @@ export interface DiagnosticRuleAssertion {
|
|
|
281
306
|
assertDescription?: string;
|
|
282
307
|
}
|
|
283
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
|
+
|
|
284
331
|
/**
|
|
285
332
|
* A single edge in the template\'s reference graph, from a referencing resource to its target.
|
|
286
333
|
*/
|
|
@@ -403,7 +450,7 @@ export interface ResolvedResource {
|
|
|
403
450
|
* A top-level CloudFormation template section, as documented in the template
|
|
404
451
|
* anatomy (<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html>).
|
|
405
452
|
*
|
|
406
|
-
* This is the canonical, single definition of the section names
|
|
453
|
+
* This is the canonical, single definition of the section names - section
|
|
407
454
|
* constants in other crates derive from it.
|
|
408
455
|
*/
|
|
409
456
|
export type TopLevelSection =
|
|
@@ -579,6 +626,19 @@ export interface RelatedResource {
|
|
|
579
626
|
message: string;
|
|
580
627
|
}
|
|
581
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Configuration for constructing a [`SchemaValidator`] with optional overlay
|
|
631
|
+
* schemas. Bindings and the CLI use this to build the validator separately from
|
|
632
|
+
* the rule engine.
|
|
633
|
+
*/
|
|
634
|
+
export interface SchemaValidatorConfig {
|
|
635
|
+
/**
|
|
636
|
+
* Additional CloudFormation resource provider schemas to merge on top of the
|
|
637
|
+
* bundled schemas before schema validation.
|
|
638
|
+
*/
|
|
639
|
+
additionalSchemas?: AdditionalSchemaSource[];
|
|
640
|
+
}
|
|
641
|
+
|
|
582
642
|
/**
|
|
583
643
|
* Controls the level of detail in validation output.
|
|
584
644
|
*/
|
|
@@ -654,10 +714,12 @@ export interface IdRange {
|
|
|
654
714
|
}
|
|
655
715
|
|
|
656
716
|
/**
|
|
657
|
-
* Outcome of a validation run. `Ok` means
|
|
658
|
-
*
|
|
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.
|
|
659
721
|
*/
|
|
660
|
-
export type ReportStatus = 'OK' | 'ERROR';
|
|
722
|
+
export type ReportStatus = 'OK' | 'ANALYSIS_INCOMPLETE' | 'ERROR';
|
|
661
723
|
|
|
662
724
|
/**
|
|
663
725
|
* Per-resource observations collected while resolving intrinsics, used to drive lint checks.
|
|
@@ -750,8 +812,8 @@ export interface ResourceIdFilter {
|
|
|
750
812
|
}
|
|
751
813
|
|
|
752
814
|
/**
|
|
753
|
-
* Suppress a rule for a specific named template entity
|
|
754
|
-
* 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
|
|
755
817
|
* logical ID. An absent `rule_id` scopes the filter to every rule on that
|
|
756
818
|
* entity; an absent `entity_type` scopes it to entities of every type with
|
|
757
819
|
* that logical ID.
|
|
@@ -772,7 +834,7 @@ export interface ResourceTypeFilter {
|
|
|
772
834
|
}
|
|
773
835
|
|
|
774
836
|
/**
|
|
775
|
-
* Suppress a rule for every resource belonging to a service
|
|
837
|
+
* Suppress a rule for every resource belonging to a service - the
|
|
776
838
|
* `service-provider::service-name` prefix of the resource type (its first two
|
|
777
839
|
* `::`-delimited segments, for example `AWS::AutoScaling` in
|
|
778
840
|
* `AWS::AutoScaling::LaunchConfiguration`, or `Alexa::ASK` in
|
|
@@ -787,7 +849,7 @@ export interface ServiceFilter {
|
|
|
787
849
|
}
|
|
788
850
|
|
|
789
851
|
/**
|
|
790
|
-
* The kind of template entity a diagnostic targets
|
|
852
|
+
* The kind of template entity a diagnostic targets - the singular form of the
|
|
791
853
|
* top-level section the entity is declared in. Every documented section has a
|
|
792
854
|
* variant; the ones whose children are addressable by logical ID (resources,
|
|
793
855
|
* parameters, outputs, mappings, conditions, rules, and metadata keys) are
|
|
@@ -918,7 +980,7 @@ export interface StandardDiagnostic {
|
|
|
918
980
|
*/
|
|
919
981
|
source: RuleOrigin;
|
|
920
982
|
/**
|
|
921
|
-
* 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.
|
|
922
984
|
*/
|
|
923
985
|
entity?: Entity;
|
|
924
986
|
/**
|
|
@@ -956,7 +1018,7 @@ export interface DetailedDiagnostic {
|
|
|
956
1018
|
*/
|
|
957
1019
|
source: RuleOrigin;
|
|
958
1020
|
/**
|
|
959
|
-
* 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.
|
|
960
1022
|
*/
|
|
961
1023
|
entity?: Entity;
|
|
962
1024
|
/**
|
|
@@ -992,6 +1054,13 @@ export interface EngineConfig {
|
|
|
992
1054
|
* Guard DSL rules as raw source text, usable regardless of the selected engine.
|
|
993
1055
|
*/
|
|
994
1056
|
guardRules?: ExternalRuleSource[];
|
|
1057
|
+
/**
|
|
1058
|
+
* Optional schema validator configuration. A standalone engine derives its
|
|
1059
|
+
* schema-aware rule metadata from this config. Language APIs also use it to
|
|
1060
|
+
* construct the schema validator bundled with the engine, so both components
|
|
1061
|
+
* observe the same additional schemas.
|
|
1062
|
+
*/
|
|
1063
|
+
schemaValidatorConfig?: SchemaValidatorConfig;
|
|
995
1064
|
}
|
|
996
1065
|
|
|
997
1066
|
export interface MapEntry {
|
|
@@ -1003,7 +1072,15 @@ export interface ReportMetadata {
|
|
|
1003
1072
|
/**
|
|
1004
1073
|
* Number of rules that were active for this run after any category exclusions.
|
|
1005
1074
|
*/
|
|
1006
|
-
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;
|
|
1007
1084
|
resourcesScanned: number;
|
|
1008
1085
|
/**
|
|
1009
1086
|
* Tally of reported diagnostics by severity.
|
|
@@ -1021,6 +1098,11 @@ export interface ReportMetadata {
|
|
|
1021
1098
|
* Minimum severity included in the report; lower-severity findings are omitted.
|
|
1022
1099
|
*/
|
|
1023
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;
|
|
1024
1106
|
}
|
|
1025
1107
|
|
|
1026
1108
|
export interface Summary {
|
|
@@ -1072,7 +1154,7 @@ export class WasmSchemaValidator {
|
|
|
1072
1154
|
free(): void;
|
|
1073
1155
|
[Symbol.dispose](): void;
|
|
1074
1156
|
listRules(): any;
|
|
1075
|
-
constructor();
|
|
1157
|
+
constructor(config: SchemaValidatorConfig);
|
|
1076
1158
|
schemaCount(): number;
|
|
1077
1159
|
validate(model: WasmSemanticModel, region?: string | null): any;
|
|
1078
1160
|
}
|
package/bindings_wasm.js
CHANGED
|
@@ -193,9 +193,15 @@ class WasmSchemaValidator {
|
|
|
193
193
|
}
|
|
194
194
|
return takeFromExternrefTable0(ret[0]);
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
/**
|
|
197
|
+
* @param {SchemaValidatorConfig} config
|
|
198
|
+
*/
|
|
199
|
+
constructor(config) {
|
|
200
|
+
const ret = wasm.wasmschemavalidator_new(config);
|
|
201
|
+
if (ret[2]) {
|
|
202
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
203
|
+
}
|
|
204
|
+
this.__wbg_ptr = ret[0];
|
|
199
205
|
WasmSchemaValidatorFinalization.register(this, this.__wbg_ptr, this);
|
|
200
206
|
return this;
|
|
201
207
|
}
|
package/bindings_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -46,7 +46,7 @@ export const wasmregoengine_validateStandard: (
|
|
|
46
46
|
f: number,
|
|
47
47
|
) => [number, number, number];
|
|
48
48
|
export const wasmschemavalidator_listRules: (a: number) => [number, number, number];
|
|
49
|
-
export const wasmschemavalidator_new: () => number;
|
|
49
|
+
export const wasmschemavalidator_new: (a: any) => [number, number, number];
|
|
50
50
|
export const wasmschemavalidator_schemaCount: (a: number) => number;
|
|
51
51
|
export const wasmschemavalidator_validate: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
52
52
|
export const wasmsemanticmodel_conditions: (a: number) => [number, number, number];
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DetailedReport,
|
|
3
3
|
DiagnosticModel,
|
|
4
|
+
AdditionalSchemaSource,
|
|
4
5
|
ExternalRuleSource,
|
|
5
6
|
ParameterInfo,
|
|
6
7
|
ResolvedOutput,
|
|
@@ -39,6 +40,7 @@ export type {
|
|
|
39
40
|
PseudoParameterOverrides,
|
|
40
41
|
ValidateConfig,
|
|
41
42
|
ExternalRuleSource,
|
|
43
|
+
AdditionalSchemaSource,
|
|
42
44
|
ResolvedValue,
|
|
43
45
|
RefKind,
|
|
44
46
|
ParameterInfo,
|
|
@@ -95,11 +97,39 @@ export declare class RuleFile {
|
|
|
95
97
|
readContent(): string;
|
|
96
98
|
}
|
|
97
99
|
export type RuleSource = ExternalRuleSource | RuleFile;
|
|
100
|
+
/**
|
|
101
|
+
* A CloudFormation resource provider schema loaded from a file, for use as an
|
|
102
|
+
* overlay. `typeName` may be omitted to use the `typeName` inside the file.
|
|
103
|
+
*/
|
|
104
|
+
export declare class SchemaFile {
|
|
105
|
+
readonly path: string;
|
|
106
|
+
readonly typeName?: string | undefined;
|
|
107
|
+
constructor(path: string, typeName?: string | undefined);
|
|
108
|
+
readContent(): string;
|
|
109
|
+
}
|
|
110
|
+
export type SchemaSource = AdditionalSchemaSource | SchemaFile;
|
|
98
111
|
export interface EngineConfig {
|
|
99
112
|
/** Engine-native rules (Rego for RegoEngine, CEL for CelEngine). */
|
|
100
113
|
customRules?: RuleSource[];
|
|
101
114
|
/** CloudFormation Guard DSL rules, usable with either engine. */
|
|
102
115
|
guardRules?: RuleSource[];
|
|
116
|
+
/**
|
|
117
|
+
* Optional schema validator configuration. When present, the engine derives
|
|
118
|
+
* overlay-aware metadata from the configured additional schemas.
|
|
119
|
+
*/
|
|
120
|
+
schemaValidatorConfig?: SchemaValidatorConfig;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Configuration for the schema validator. Additional schemas are merged on top
|
|
124
|
+
* of the bundled CloudFormation provider schemas before schema validation.
|
|
125
|
+
*/
|
|
126
|
+
export interface SchemaValidatorConfig {
|
|
127
|
+
/**
|
|
128
|
+
* Additional CloudFormation resource provider schemas to merge on top of the
|
|
129
|
+
* bundled schemas. Each overlay extends or overrides the bundled schema for
|
|
130
|
+
* its resource type.
|
|
131
|
+
*/
|
|
132
|
+
additionalSchemas?: SchemaSource[];
|
|
103
133
|
}
|
|
104
134
|
export declare class TemplateModel {
|
|
105
135
|
private readonly inner;
|
|
@@ -117,6 +147,7 @@ export declare class TemplateModel {
|
|
|
117
147
|
}
|
|
118
148
|
export declare class SchemaValidator {
|
|
119
149
|
private readonly inner;
|
|
150
|
+
constructor(config?: SchemaValidatorConfig);
|
|
120
151
|
listRules(): RuleInfo[];
|
|
121
152
|
schemaCount(): number;
|
|
122
153
|
validate(template: TemplateFile, region?: string): StandardDiagnostic[];
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.CelEngine =
|
|
|
4
4
|
exports.RegoEngine =
|
|
5
5
|
exports.SchemaValidator =
|
|
6
6
|
exports.TemplateModel =
|
|
7
|
+
exports.SchemaFile =
|
|
7
8
|
exports.RuleFile =
|
|
8
9
|
exports.TemplateFile =
|
|
9
10
|
void 0;
|
|
@@ -28,15 +29,42 @@ class RuleFile {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
exports.RuleFile = RuleFile;
|
|
32
|
+
/**
|
|
33
|
+
* A CloudFormation resource provider schema loaded from a file, for use as an
|
|
34
|
+
* overlay. `typeName` may be omitted to use the `typeName` inside the file.
|
|
35
|
+
*/
|
|
36
|
+
class SchemaFile {
|
|
37
|
+
constructor(path, typeName) {
|
|
38
|
+
this.path = path;
|
|
39
|
+
this.typeName = typeName;
|
|
40
|
+
}
|
|
41
|
+
readContent() {
|
|
42
|
+
return (0, fs_1.readFileSync)(this.path, 'utf8');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SchemaFile = SchemaFile;
|
|
31
46
|
function toExternalRuleSources(sources) {
|
|
32
47
|
return (sources ?? []).map((source) =>
|
|
33
48
|
source instanceof RuleFile ? { name: source.path, content: source.readContent() } : source,
|
|
34
49
|
);
|
|
35
50
|
}
|
|
51
|
+
function toAdditionalSchemas(sources) {
|
|
52
|
+
return (sources ?? []).map((source) =>
|
|
53
|
+
source instanceof SchemaFile ? { typeName: source.typeName, schema: source.readContent() } : source,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
36
56
|
function toWasmEngineConfig(config) {
|
|
37
57
|
return {
|
|
38
58
|
customRules: toExternalRuleSources(config?.customRules),
|
|
39
59
|
guardRules: toExternalRuleSources(config?.guardRules),
|
|
60
|
+
schemaValidatorConfig: config?.schemaValidatorConfig
|
|
61
|
+
? toWasmSchemaValidatorConfig(config.schemaValidatorConfig)
|
|
62
|
+
: undefined,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function toWasmSchemaValidatorConfig(config) {
|
|
66
|
+
return {
|
|
67
|
+
additionalSchemas: toAdditionalSchemas(config?.additionalSchemas),
|
|
40
68
|
};
|
|
41
69
|
}
|
|
42
70
|
class TemplateModel {
|
|
@@ -76,8 +104,8 @@ class TemplateModel {
|
|
|
76
104
|
}
|
|
77
105
|
exports.TemplateModel = TemplateModel;
|
|
78
106
|
class SchemaValidator {
|
|
79
|
-
constructor() {
|
|
80
|
-
this.inner = new bridge.WasmSchemaValidator();
|
|
107
|
+
constructor(config) {
|
|
108
|
+
this.inner = new bridge.WasmSchemaValidator(toWasmSchemaValidatorConfig(config));
|
|
81
109
|
}
|
|
82
110
|
listRules() {
|
|
83
111
|
return this.inner.listRules();
|
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"
|