@intentius/chant-lexicon-aws 0.124.52 → 0.124.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/credential-chain.d.ts +3 -3
- package/dist/api/credential-chain.d.ts.map +1 -1
- package/dist/api/credential-chain.js +2 -2
- package/dist/api/read-client.d.ts +2 -2
- package/dist/api/read-client.d.ts.map +1 -1
- package/dist/api/read-client.js +2 -2
- package/dist/api/{sigv4.d.ts → signing.d.ts} +14 -34
- package/dist/api/signing.d.ts.map +1 -0
- package/dist/api/signing.js +95 -0
- package/dist/codegen/generate-lexicon.d.ts +2 -0
- package/dist/codegen/generate-lexicon.d.ts.map +1 -1
- package/dist/codegen/generate-lexicon.js +1 -0
- package/dist/components/__tests__/mock-cloud-executor.d.ts +4 -0
- package/dist/components/__tests__/mock-cloud-executor.d.ts.map +1 -1
- package/dist/components/__tests__/mock-cloud-executor.js +18 -1
- package/dist/components/apply.d.ts +46 -2
- package/dist/components/apply.d.ts.map +1 -1
- package/dist/components/apply.js +266 -30
- package/dist/components/cfn-adopt-run.d.ts +37 -0
- package/dist/components/cfn-adopt-run.d.ts.map +1 -0
- package/dist/components/cfn-adopt-run.js +104 -0
- package/dist/components/cfn-adopt.d.ts +99 -0
- package/dist/components/cfn-adopt.d.ts.map +1 -0
- package/dist/components/cfn-adopt.js +278 -0
- package/dist/components/cfn-imports.d.ts +84 -0
- package/dist/components/cfn-imports.d.ts.map +1 -0
- package/dist/components/cfn-imports.js +239 -0
- package/dist/components/cloud-executor.d.ts +38 -2
- package/dist/components/cloud-executor.d.ts.map +1 -1
- package/dist/components/cloud-executor.js +84 -2
- package/dist/health.js +1 -1
- package/dist/importable.d.ts +30 -0
- package/dist/importable.d.ts.map +1 -0
- package/dist/importable.js +72 -0
- package/dist/index-identity.d.ts +19 -0
- package/dist/index-identity.d.ts.map +1 -0
- package/dist/index-identity.js +79 -0
- package/dist/index-import.d.ts +25 -0
- package/dist/index-import.d.ts.map +1 -0
- package/dist/index-import.js +132 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/integrity.json +4 -4
- package/dist/listed-types.d.ts +11 -0
- package/dist/listed-types.d.ts.map +1 -0
- package/dist/listed-types.js +52 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +13206 -1237
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +12 -3
- package/dist/reference-catalog.d.ts.map +1 -1
- package/dist/reference-catalog.js +62 -20
- package/dist/skills/chant-aws-carve-terraform.md +21 -14
- package/dist/spec/fetch.d.ts +5 -0
- package/dist/spec/fetch.d.ts.map +1 -1
- package/dist/spec/parse.d.ts +8 -0
- package/dist/spec/parse.d.ts.map +1 -1
- package/dist/spec/parse.js +3 -0
- package/package.json +2 -2
- package/src/api/credential-chain.ts +3 -3
- package/src/api/read-client.test.ts +2 -2
- package/src/api/read-client.ts +3 -3
- package/src/api/{sigv4.test.ts → signing.test.ts} +84 -96
- package/src/api/signing.ts +130 -0
- package/src/codegen/generate-lexicon.ts +3 -0
- package/src/components/__tests__/mock-cloud-executor.ts +20 -1
- package/src/components/apply.ts +288 -30
- package/src/components/cfn-adopt-run.test.ts +227 -0
- package/src/components/cfn-adopt-run.ts +141 -0
- package/src/components/cfn-adopt.test.ts +284 -0
- package/src/components/cfn-adopt.ts +340 -0
- package/src/components/cfn-exports-in-use.test.ts +146 -0
- package/src/components/cfn-imports-preview.test.ts +178 -0
- package/src/components/cfn-imports-three-stacks.test.ts +107 -0
- package/src/components/cfn-imports.test.ts +213 -0
- package/src/components/cfn-imports.ts +246 -0
- package/src/components/cfn-plan-shape-conformance.test.ts +83 -0
- package/src/components/cloud-executor.ts +127 -5
- package/src/components/demo-composed-stacks-floci.e2e.test.ts +235 -0
- package/src/derived-edges.test.ts +142 -0
- package/src/generated/lexicon-aws.json +13206 -1237
- package/src/health.ts +1 -1
- package/src/importable.test.ts +86 -0
- package/src/importable.ts +83 -0
- package/src/index-identity.test.ts +134 -0
- package/src/index-identity.ts +98 -0
- package/src/index-import.test.ts +257 -0
- package/src/index-import.ts +158 -0
- package/src/index-search.test.ts +87 -0
- package/src/index.ts +1 -1
- package/src/listed-types.test.ts +97 -0
- package/src/listed-types.ts +56 -0
- package/src/plugin.ts +13 -3
- package/src/reference-catalog.ts +63 -20
- package/src/skills/chant-aws-carve-terraform.md +21 -14
- package/src/spec/fetch.ts +5 -0
- package/src/spec/parse.test.ts +15 -0
- package/src/spec/parse.ts +12 -0
- package/src/testdata/indexed/identity.listing.json +65 -0
- package/src/testdata/indexed/import.listing.json +126 -0
- package/src/testdata/indexed/listing.json +69 -0
- package/src/testdata/indexed/topology.listing.json +350 -0
- package/src/testdata/three-cloud/dns.graph.json +336 -0
- package/src/three-cloud-parity.test.ts +49 -0
- package/dist/api/sigv4.d.ts.map +0 -1
- package/dist/api/sigv4.js +0 -185
- package/src/api/sigv4.ts +0 -243
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAqQ,MAAM,0BAA0B,CAAC;AAyCjU;yEACyE;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAiBnD,eAAO,MAAM,SAAS,EAAE,aAslCvB,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -3,6 +3,9 @@ import { createRequire } from "module";
|
|
|
3
3
|
import { awsBehaviourKinds } from "./behaviour-kinds.js";
|
|
4
4
|
import { detectTemplate } from "./detect.js";
|
|
5
5
|
import { awsCapabilityPack } from "./capabilities/pack.js";
|
|
6
|
+
import { awsListedTypes } from "./listed-types.js";
|
|
7
|
+
import { awsIndexIdentity } from "./index-identity.js";
|
|
8
|
+
import { awsIndexImport } from "./index-import.js";
|
|
6
9
|
const require = createRequire(moduleSourceUrl(import.meta.url));
|
|
7
10
|
import { discoverLintRules } from "@intentius/chant/lint/discover";
|
|
8
11
|
import { postSynthChecks as postSynthCheckList } from "./lint/post-synth/index.js";
|
|
@@ -82,6 +85,12 @@ export const awsPlugin = {
|
|
|
82
85
|
// Live edge reconstruction for `chant graph --live` (#778).
|
|
83
86
|
referenceCatalog: awsReferenceCatalog,
|
|
84
87
|
capabilityPack: awsCapabilityPack,
|
|
88
|
+
// Cloud inventory type names to kinds, for an indexed resource (#4521).
|
|
89
|
+
listedTypes: awsListedTypes,
|
|
90
|
+
// Declared entities to indexed resources by primaryIdentifier (#4523).
|
|
91
|
+
indexIdentity: awsIndexIdentity,
|
|
92
|
+
// Indexed resources as CloudFormation import IR, for `chant import --index` (#4524).
|
|
93
|
+
indexImport: awsIndexImport,
|
|
85
94
|
lintRules() {
|
|
86
95
|
const rulesDir = join(dirname(fileURLToPath(import.meta.url)), "lint", "rules");
|
|
87
96
|
return discoverLintRules(rulesDir, import.meta.url);
|
|
@@ -546,7 +555,7 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
|
|
|
546
555
|
{
|
|
547
556
|
file: "chant-aws-carve-terraform.md",
|
|
548
557
|
name: "chant-aws-carve-terraform",
|
|
549
|
-
description: "Demo
|
|
558
|
+
description: "Demo moving one Terraform resource to native CloudFormation, fully offline (advise, emit, audit, bridge, apply); Terraform keeps the rest",
|
|
550
559
|
triggers: [
|
|
551
560
|
{ type: "context", value: "terraform" },
|
|
552
561
|
{ type: "context", value: "carve" },
|
|
@@ -570,12 +579,12 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
|
|
|
570
579
|
{
|
|
571
580
|
title: "Run the offline demo",
|
|
572
581
|
description: "Demo the full advise → emit → bridge → apply loop with no cloud",
|
|
573
|
-
input: "Show me how chant
|
|
582
|
+
input: "Show me how chant moves one resource from Terraform to CloudFormation",
|
|
574
583
|
output: "cd examples/terraform-carve-out && ./demo.sh",
|
|
575
584
|
},
|
|
576
585
|
{
|
|
577
586
|
title: "Adopt a resource from state",
|
|
578
|
-
description: "Emit
|
|
587
|
+
description: "Emit chant source for the AWS lexicon from a Terraform-managed resource, offline",
|
|
579
588
|
input: "Adopt aws_s3_bucket.assets into chant",
|
|
580
589
|
output: "chant carve emit --from ./terraform --select aws_s3_bucket.assets --state ./terraform/terraform.tfstate",
|
|
581
590
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-catalog.d.ts","sourceRoot":"","sources":["../src/reference-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"reference-catalog.d.ts","sourceRoot":"","sources":["../src/reference-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBA2IjC,CAAC"}
|
|
@@ -26,6 +26,22 @@ export const awsReferenceCatalog = {
|
|
|
26
26
|
{ kind: "AWS::ECS::Service", ids: ["ServiceArn"] },
|
|
27
27
|
{ kind: "AWS::ECS::TaskDefinition", ids: ["TaskDefinitionArn"] },
|
|
28
28
|
{ kind: "AWS::RDS::DBInstance", ids: ["DBInstanceArn", "Endpoint.Address"] },
|
|
29
|
+
// Targets of the CloudFormation-shape rules an index needs (#4522, the
|
|
30
|
+
// missing rules counted on INTENTIUS/behold#1023). Over an index each
|
|
31
|
+
// node is also matched by its Cloud Control identifier and its cloud ids,
|
|
32
|
+
// so a role's ARN joins even though the deep hooks prune `Arn`.
|
|
33
|
+
{ kind: "AWS::RDS::DBSubnetGroup", ids: ["DBSubnetGroupName"] },
|
|
34
|
+
{ kind: "AWS::IAM::Role", ids: ["Arn", "RoleName"] },
|
|
35
|
+
{ kind: "AWS::EC2::EIP", ids: ["AllocationId", "PublicIp"] },
|
|
36
|
+
{ kind: "AWS::Logs::LogGroup", ids: ["LogGroupName", "Arn"] },
|
|
37
|
+
{ kind: "AWS::Route53::HostedZone", ids: ["Id"] },
|
|
38
|
+
{ kind: "AWS::EKS::Cluster", ids: ["Name", "Arn"] },
|
|
39
|
+
{ kind: "AWS::CloudFormation::Stack", ids: ["StackId"] },
|
|
40
|
+
// #4535: a record set is named by its record name, which is what a CNAME
|
|
41
|
+
// in the same zone points at; a bucket by its name, which is what a
|
|
42
|
+
// workload's env var carries (behold#166, ../../k8s/src/reference-catalog.ts).
|
|
43
|
+
{ kind: "AWS::Route53::RecordSet", ids: ["Name"] },
|
|
44
|
+
{ kind: "AWS::S3::Bucket", ids: ["BucketName"] },
|
|
29
45
|
],
|
|
30
46
|
refs: [
|
|
31
47
|
// ── containment (→ boundary boxes, #779) ──
|
|
@@ -82,25 +98,51 @@ export const awsReferenceCatalog = {
|
|
|
82
98
|
// intrinsics to bare logical ids (= node ids), so these match by node id; the
|
|
83
99
|
// property names are the CFN template shape (SecurityGroupIds, Cluster, …),
|
|
84
100
|
// which differs from the describe/SDK shape above. No targetKind needed —
|
|
85
|
-
// logical ids are unique.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{ from: "AWS::EC2::
|
|
89
|
-
{ from: "AWS::EC2::
|
|
90
|
-
{ from: "AWS::EC2::
|
|
91
|
-
{ from: "AWS::EC2::
|
|
92
|
-
{ from: "AWS::EC2::
|
|
93
|
-
{ from: "AWS::EC2::
|
|
94
|
-
{ from: "AWS::EC2::Route", path: "
|
|
95
|
-
{ from: "AWS::
|
|
96
|
-
{ from: "AWS::
|
|
97
|
-
{ from: "AWS::ElasticLoadBalancingV2::
|
|
98
|
-
{ from: "AWS::ElasticLoadBalancingV2::
|
|
99
|
-
{ from: "AWS::ElasticLoadBalancingV2::
|
|
100
|
-
{ from: "AWS::
|
|
101
|
-
{ from: "AWS::
|
|
102
|
-
{ from: "AWS::ECS::Service", path: "
|
|
103
|
-
{ from: "AWS::
|
|
104
|
-
{ from: "AWS::
|
|
101
|
+
// logical ids are unique. Over an index (#4522) the same paths hold physical
|
|
102
|
+
// values, some of them names, so each carries the `indexedTargetKind` it
|
|
103
|
+
// takes there (ruled on INTENTIUS/behold#1023 Q4).
|
|
104
|
+
{ from: "AWS::EC2::Subnet", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
|
|
105
|
+
{ from: "AWS::EC2::SecurityGroup", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
|
|
106
|
+
{ from: "AWS::EC2::RouteTable", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
|
|
107
|
+
{ from: "AWS::EC2::Instance", path: "SubnetId", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
|
|
108
|
+
{ from: "AWS::EC2::Instance", path: "SecurityGroupIds[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
|
|
109
|
+
{ from: "AWS::EC2::NatGateway", path: "SubnetId", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
|
|
110
|
+
{ from: "AWS::EC2::Route", path: "RouteTableId", indexedTargetKind: "AWS::EC2::RouteTable", relation: "reference", label: "in" },
|
|
111
|
+
{ from: "AWS::EC2::Route", path: "GatewayId", indexedTargetKind: "AWS::EC2::InternetGateway", relation: "reference", label: "via" },
|
|
112
|
+
{ from: "AWS::EC2::Route", path: "NatGatewayId", indexedTargetKind: "AWS::EC2::NatGateway", relation: "reference", label: "via" },
|
|
113
|
+
{ from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "Subnets[]", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
|
|
114
|
+
{ from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "SecurityGroups[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
|
|
115
|
+
{ from: "AWS::ElasticLoadBalancingV2::TargetGroup", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
|
|
116
|
+
{ from: "AWS::ElasticLoadBalancingV2::Listener", path: "LoadBalancerArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::LoadBalancer", relation: "reference", label: "on" },
|
|
117
|
+
{ from: "AWS::ElasticLoadBalancingV2::Listener", path: "DefaultActions[].TargetGroupArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::TargetGroup", relation: "reference", label: "forwards to" },
|
|
118
|
+
{ from: "AWS::ECS::Service", path: "Cluster", indexedTargetKind: "AWS::ECS::Cluster", relation: "reference", label: "in cluster" },
|
|
119
|
+
{ from: "AWS::ECS::Service", path: "TaskDefinition", indexedTargetKind: "AWS::ECS::TaskDefinition", relation: "reference", label: "runs" },
|
|
120
|
+
{ from: "AWS::ECS::Service", path: "LoadBalancers[].TargetGroupArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::TargetGroup", relation: "reference", label: "registered in" },
|
|
121
|
+
{ from: "AWS::RDS::DBInstance", path: "DBSubnetGroupName", indexedTargetKind: "AWS::RDS::DBSubnetGroup", relation: "reference", label: "subnets" },
|
|
122
|
+
{ from: "AWS::RDS::DBInstance", path: "VPCSecurityGroups[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
|
|
123
|
+
// ── CloudFormation property shape, as Cloud Control returns it (#4522) ──
|
|
124
|
+
// The rules INTENTIUS/behold#1023's count found missing for an index of
|
|
125
|
+
// example-three-cloud. Targeted, so they hold over physical values and over
|
|
126
|
+
// logical ids alike.
|
|
127
|
+
{ from: "AWS::EC2::VPCGatewayAttachment", path: "VpcId", targetKind: "AWS::EC2::VPC", relation: "reference", label: "attaches to" },
|
|
128
|
+
{ from: "AWS::EC2::VPCGatewayAttachment", path: "InternetGatewayId", targetKind: "AWS::EC2::InternetGateway", relation: "reference", label: "attaches" },
|
|
129
|
+
{ from: "AWS::EC2::NatGateway", path: "AllocationId", targetKind: "AWS::EC2::EIP", relation: "reference", label: "address" },
|
|
130
|
+
{ from: "AWS::ECS::TaskDefinition", path: "ExecutionRoleArn", targetKind: "AWS::IAM::Role", relation: "reference", label: "execution role" },
|
|
131
|
+
{ from: "AWS::ECS::TaskDefinition", path: "TaskRoleArn", targetKind: "AWS::IAM::Role", relation: "reference", label: "task role" },
|
|
132
|
+
{ from: "AWS::ECS::TaskDefinition", path: "ContainerDefinitions[].LogConfiguration.Options.awslogs-group", targetKind: "AWS::Logs::LogGroup", relation: "reference", label: "logs to" },
|
|
133
|
+
{ from: "AWS::EC2::SecurityGroup", path: "SecurityGroupIngress[].SourceSecurityGroupId", targetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "allows" },
|
|
134
|
+
{ from: "AWS::Route53::RecordSet", path: "HostedZoneId", targetKind: "AWS::Route53::HostedZone", relation: "containment", label: "in zone" },
|
|
135
|
+
// A CNAME to another record of the estate (#4535: example-three-cloud's
|
|
136
|
+
// latency record for gcp points at gcp.three-cloud.example.). Optional,
|
|
137
|
+
// since most record values are addresses or hostnames outside it.
|
|
138
|
+
{ from: "AWS::Route53::RecordSet", path: "ResourceRecords[]", targetKind: "AWS::Route53::RecordSet", relation: "reference", label: "aliases", optional: true },
|
|
139
|
+
],
|
|
140
|
+
// Tags that name a cloud id in their key or value (behold#1023 Q5). Used
|
|
141
|
+
// over indexed nodes only. No rule matches equal tag values in general.
|
|
142
|
+
tagRefs: [
|
|
143
|
+
{ key: "aws:cloudformation:stack-id", read: "value", targetKind: "AWS::CloudFormation::Stack", label: "in stack" },
|
|
144
|
+
{ key: "aws:eks:cluster-name", read: "value", targetKind: "AWS::EKS::Cluster", label: "cluster" },
|
|
145
|
+
{ key: "eks:cluster-name", read: "value", targetKind: "AWS::EKS::Cluster", label: "cluster" },
|
|
146
|
+
{ key: "kubernetes.io/cluster/", read: "key-suffix", targetKind: "AWS::EKS::Cluster", label: "cluster" },
|
|
105
147
|
],
|
|
106
148
|
};
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
---
|
|
2
2
|
skill: chant-aws-carve-terraform
|
|
3
|
-
description: Demo
|
|
3
|
+
description: Demo moving one Terraform resource to native CloudFormation, fully offline (advise, emit, audit, bridge, apply); Terraform keeps the rest
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Move one Terraform resource to CloudFormation (demo)
|
|
8
8
|
|
|
9
|
-
Use this skill to
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
estate
|
|
13
|
-
graduation.
|
|
9
|
+
Use this skill to demonstrate chant's carve flow, which moves one resource
|
|
10
|
+
from a Terraform estate to chant source for the AWS lexicon. The whole demo
|
|
11
|
+
runs **offline**, with no cloud account, Terraform binary or state backend. It
|
|
12
|
+
moves an S3 bucket from a small Terraform estate to chant source, patches the
|
|
13
|
+
resources that stay in Terraform, and plans the graduation.
|
|
14
14
|
|
|
15
15
|
## When to use
|
|
16
16
|
|
|
17
|
-
- Someone asks
|
|
17
|
+
- Someone asks how chant can manage one resource from a Terraform root as
|
|
18
|
+
native CloudFormation.
|
|
19
|
+
- Someone on Terraform or OpenTofu asks how to get chant's ownership markers
|
|
20
|
+
on their resources. Point them at choudoufu instead
|
|
21
|
+
(`terraform.binary: "choudoufu"`, see
|
|
22
|
+
https://intentius.io/chant/lexicons/terraform/ops/#choudoufu). Their roots
|
|
23
|
+
stay in OpenTofu.
|
|
18
24
|
- You want to show the advise → emit → audit → bridge → apply loop end to end.
|
|
19
25
|
- You are evaluating whether a Terraform estate is worth carving.
|
|
20
26
|
|
|
@@ -40,12 +46,12 @@ Walk the person through the output. That is the whole demo.
|
|
|
40
46
|
|
|
41
47
|
From `examples/terraform-carve-out`, with `TF=./terraform`:
|
|
42
48
|
|
|
43
|
-
1. **Advise
|
|
49
|
+
1. **Advise: rank the resources.**
|
|
44
50
|
```bash
|
|
45
51
|
chant carve advise --from ./terraform
|
|
46
52
|
```
|
|
47
53
|
Point out the three bands: clean leaves (carve now), carvable with edits,
|
|
48
|
-
and leave
|
|
54
|
+
and stays in Terraform (`leave in Terraform` in the JSON). `aws_s3_bucket.assets` is a clean leaf held back one
|
|
49
55
|
notch by the Lambda that reads it; `random_pet` has no native mapping.
|
|
50
56
|
|
|
51
57
|
2. **Emit — adopt the bucket into chant source, offline, from state.**
|
|
@@ -68,9 +74,9 @@ From `examples/terraform-carve-out`, with `TF=./terraform`:
|
|
|
68
74
|
chant build ./carveout/src --lexicon aws
|
|
69
75
|
```
|
|
70
76
|
The first build fails, deliberately: the post-synth audit refuses the
|
|
71
|
-
adopted bucket because
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
adopted bucket because it has no public-access block or TLS-only policy.
|
|
78
|
+
This is a feature of carving: chant tells the person which settings the
|
|
79
|
+
adopted resource is missing. Show the fix (add
|
|
74
80
|
`PublicAccessBlockConfiguration` and a companion `S3BucketPolicy` with an
|
|
75
81
|
`aws:SecureTransport = false` Deny — the tutorial page has the exact code),
|
|
76
82
|
then re-run the build and show the valid CloudFormation template.
|
|
@@ -96,7 +102,8 @@ From `examples/terraform-carve-out`, with `TF=./terraform`:
|
|
|
96
102
|
|
|
97
103
|
- Nothing is destroyed or applied; every step before graduation is reversible
|
|
98
104
|
with `terraform import`.
|
|
99
|
-
- You carve one resource at a time.
|
|
105
|
+
- You carve one resource at a time. Everything else stays in Terraform, where
|
|
106
|
+
it already works.
|
|
100
107
|
- `advise` and `bridge` work against **any** Terraform tree — offer to point
|
|
101
108
|
them at the person's own estate.
|
|
102
109
|
|
package/dist/spec/fetch.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface CFNSchema {
|
|
|
22
22
|
cloudFormationSystemTags?: boolean;
|
|
23
23
|
tagProperty?: string;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* The resource provider's handlers (`create`, `read`, `update`, `delete`,
|
|
27
|
+
* `list`), each with its IAM permissions. A legacy type has none (#4536).
|
|
28
|
+
*/
|
|
29
|
+
handlers?: Record<string, unknown>;
|
|
25
30
|
additionalProperties?: boolean;
|
|
26
31
|
}
|
|
27
32
|
/**
|
package/dist/spec/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/spec/fetch.ts"],"names":[],"mappings":"AAOA,OAAO,EAA+C,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAKlF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,+BAA+B,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH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;AAuBD;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
|
package/dist/spec/parse.d.ts
CHANGED
|
@@ -47,6 +47,14 @@ export interface ParsedResource {
|
|
|
47
47
|
conditionalCreateOnly: string[];
|
|
48
48
|
replacementStrategy?: "delete_then_create" | "create_then_delete";
|
|
49
49
|
tagging?: ResourceTagging;
|
|
50
|
+
/**
|
|
51
|
+
* The schema's `handlers` section as its operation names, sorted
|
|
52
|
+
* (`["create", "delete", "list", "read", "update"]`). The permissions each
|
|
53
|
+
* handler lists are left out. Absent when the schema has no handlers, as a
|
|
54
|
+
* legacy type does. CloudFormation can import a type with `create` and
|
|
55
|
+
* `read` (../importable.ts, #4536).
|
|
56
|
+
*/
|
|
57
|
+
handlers?: string[];
|
|
50
58
|
}
|
|
51
59
|
/** How a type's tags are written: a `[{Key, Value}]` list or a key-to-value map. */
|
|
52
60
|
export type TagShape = "list" | "map";
|
package/dist/spec/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/spec/parse.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoC,MAAM,SAAS,CAAC;AAC3E,OAAO,EAGL,kBAAkB,IAAI,sBAAsB,EAE5C,KAAK,mBAAmB,EAIzB,MAAM,sCAAsC,CAAC;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAkBhF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;I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c,CAAC;IACzB,aAAa,EAAE,kBAAkB,EAAE,CAAC;IACpC,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAwJvE;AAID;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAe7F;AAuDD,eAAO,MAAM,kBAAkB,+BAAyB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGvD;AAuDD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAYzE"}
|
package/dist/spec/parse.js
CHANGED
|
@@ -125,6 +125,8 @@ export function parseCFNSchema(data) {
|
|
|
125
125
|
...tagPlacement(schema),
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
+
// --- Handlers (#4536): which operations the resource provider implements ---
|
|
129
|
+
const handlers = schema.handlers && typeof schema.handlers === "object" ? Object.keys(schema.handlers).sort() : [];
|
|
128
130
|
// --- Replacement strategy ---
|
|
129
131
|
let replacementStrategy;
|
|
130
132
|
if (schema.replacementStrategy === "delete_then_create" || schema.replacementStrategy === "create_then_delete") {
|
|
@@ -146,6 +148,7 @@ export function parseCFNSchema(data) {
|
|
|
146
148
|
conditionalCreateOnly: stripPointerPaths(schema.conditionalCreateOnlyProperties ?? [], schema),
|
|
147
149
|
...(replacementStrategy && { replacementStrategy }),
|
|
148
150
|
...(tagging && { tagging }),
|
|
151
|
+
...(handlers.length > 0 && { handlers }),
|
|
149
152
|
},
|
|
150
153
|
propertyTypes: boundedPropertyTypes,
|
|
151
154
|
enums,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-aws",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.55",
|
|
4
4
|
"description": "AWS CloudFormation lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"typescript": "^5.9.3"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@intentius/chant": "^0.124.
|
|
86
|
+
"@intentius/chant": "^0.124.55"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The AWS credential chain, as the AWS CLI walks it, for `chant lifecycle
|
|
3
3
|
* whoami` (#3954).
|
|
4
4
|
*
|
|
5
|
-
* `resolveCredentials` (./
|
|
5
|
+
* `resolveCredentials` (./signing.ts) reads the three environment variables and
|
|
6
6
|
* nothing else. That is right for the read transport's synchronous signing
|
|
7
7
|
* seam, and it made whoami wrong for anyone whose shell holds a profile rather
|
|
8
8
|
* than keys: `AWS_PROFILE=dev` with an SSO session came back as "no identity
|
|
@@ -55,7 +55,7 @@ import { readFileSync } from "node:fs";
|
|
|
55
55
|
import { homedir } from "node:os";
|
|
56
56
|
import { join } from "node:path";
|
|
57
57
|
import { AwsReadError, assumeRole, type AwsReadClientOptions } from "./read-client";
|
|
58
|
-
import type { AwsCredentials } from "./
|
|
58
|
+
import type { AwsCredentials } from "./signing";
|
|
59
59
|
|
|
60
60
|
/** One HTTP exchange for the SSO portal and OIDC calls. Injected by tests. */
|
|
61
61
|
export type CredentialChainHttp = (
|
|
@@ -613,7 +613,7 @@ async function walkForTransport(options: CredentialChainOptions, now: () => Date
|
|
|
613
613
|
* What the native read transport signs with when the caller injected nothing:
|
|
614
614
|
* the same chain whoami walks, so `lifecycle diff --live` signs as the
|
|
615
615
|
* principal whoami reports. The signing seam (`AwsCredentialResolver` in
|
|
616
|
-
* ./
|
|
616
|
+
* ./signing.ts) is synchronous and the chain is not, so the transport awaits
|
|
617
617
|
* this once before a request and passes the literal credentials in.
|
|
618
618
|
*
|
|
619
619
|
* Environment keys answer directly, as in the chain. Otherwise the walk is
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
xmlError,
|
|
22
22
|
type AwsReadHttp,
|
|
23
23
|
} from "./read-client";
|
|
24
|
-
import { EMPTY_PAYLOAD_SHA256 } from "./
|
|
24
|
+
import { EMPTY_PAYLOAD_SHA256 } from "./signing";
|
|
25
25
|
|
|
26
26
|
const respond = (text: string, status = 200): ReturnType<AwsReadHttp> => Promise.resolve({ status, text });
|
|
27
27
|
|
|
@@ -246,7 +246,7 @@ describe("the region an endpoint override cannot carry in its host", () => {
|
|
|
246
246
|
});
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
|
-
* The signing decision, as the client makes it. `./
|
|
249
|
+
* The signing decision, as the client makes it. `./signing.test.ts` proves the
|
|
250
250
|
* signature is correct against AWS's own vectors; these prove the client only
|
|
251
251
|
* produces one when it should.
|
|
252
252
|
*/
|
package/src/api/read-client.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* ## Signing
|
|
21
21
|
*
|
|
22
22
|
* Requests are signed with SigV4 (#1686) when credentials resolve — see
|
|
23
|
-
* `./
|
|
23
|
+
* `./signing.ts`, which signs through core's signer (#4583) so that cedar's AVP client can
|
|
24
24
|
* adopt the same one rather than growing a second. With none injected, they
|
|
25
25
|
* resolve through the AWS CLI's chain (`./credential-chain.ts`, the one
|
|
26
26
|
* `chant lifecycle whoami` walks) once per process, by
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
*/
|
|
47
47
|
import { homedir } from "node:os";
|
|
48
48
|
import { transportCredentials } from "./credential-chain";
|
|
49
|
-
import { resolveCredentials, signRequest, type AwsCredentialSource } from "./
|
|
49
|
+
import { resolveCredentials, signRequest, type AwsCredentialSource } from "./signing";
|
|
50
50
|
|
|
51
|
-
export type { AwsCredentials, AwsCredentialResolver, AwsCredentialSource } from "./
|
|
51
|
+
export type { AwsCredentials, AwsCredentialResolver, AwsCredentialSource } from "./signing";
|
|
52
52
|
|
|
53
53
|
const DEFAULT_REGION = "us-east-1";
|
|
54
54
|
const CFN_API_VERSION = "2010-05-15";
|
|
@@ -1,75 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The aws lexicon's signing surface (#1686) over core's SigV4 signer (#4583).
|
|
3
3
|
*
|
|
4
|
-
* A signing implementation that is only tested against itself proves nothing
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* breaks canonicalization, those three stop matching.
|
|
4
|
+
* A signing implementation that is only tested against itself proves nothing,
|
|
5
|
+
* so the first block checks core's signer against `get-vanilla` from AWS's
|
|
6
|
+
* `aws-sig-v4-test-suite`. The Cloud Control vector further down was recorded
|
|
7
|
+
* from this lexicon's own signer before #4583 replaced it with core's: if the
|
|
8
|
+
* header set the lexicon signs drifts, that signature stops matching.
|
|
10
9
|
*
|
|
11
10
|
* Nothing here touches the network; there is nothing to touch. Signing is a
|
|
12
11
|
* pure function of the request and the clock.
|
|
13
12
|
*/
|
|
14
13
|
import { describe, test, expect } from "vitest";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
EMPTY_PAYLOAD_SHA256,
|
|
18
|
-
amzDate,
|
|
19
|
-
canonicalHeaders,
|
|
20
|
-
canonicalRequest,
|
|
21
|
-
resolveCredentials,
|
|
22
|
-
sha256Hex,
|
|
23
|
-
signRequest,
|
|
24
|
-
signingKey,
|
|
25
|
-
stringToSign,
|
|
26
|
-
} from "./sigv4";
|
|
14
|
+
import { sha256Hex, signV4 } from "@intentius/chant/cloud-lister/sigv4";
|
|
15
|
+
import { EMPTY_PAYLOAD_SHA256, UNSIGNED_HEADERS, resolveCredentials, signRequest } from "./signing";
|
|
27
16
|
|
|
28
17
|
/** The example secret AWS uses throughout its Signature Version 4 documentation. */
|
|
29
18
|
const SECRET = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY";
|
|
30
19
|
const ACCESS_KEY = "AKIDEXAMPLE";
|
|
31
20
|
|
|
32
|
-
describe("the published
|
|
33
|
-
test("
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expect(canonical).toBe(
|
|
50
|
-
[
|
|
51
|
-
"GET",
|
|
52
|
-
"/",
|
|
53
|
-
"",
|
|
54
|
-
"host:example.amazonaws.com",
|
|
55
|
-
"x-amz-date:20150830T123600Z",
|
|
56
|
-
"",
|
|
57
|
-
"host;x-amz-date",
|
|
58
|
-
EMPTY_PAYLOAD_SHA256,
|
|
59
|
-
].join("\n"),
|
|
60
|
-
);
|
|
61
|
-
expect(signed).toBe("host;x-amz-date");
|
|
62
|
-
|
|
63
|
-
const scope = "20150830/us-east-1/service/aws4_request";
|
|
64
|
-
const sts = stringToSign("20150830T123600Z", scope, canonical);
|
|
65
|
-
expect(sts).toBe(
|
|
66
|
-
"AWS4-HMAC-SHA256\n20150830T123600Z\n" +
|
|
67
|
-
`${scope}\nbb579772317eb040ac9ed261061d46c1f17a8133879d6129b6e1c25292927e63`,
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const key = signingKey(SECRET, "20150830", "us-east-1", "service");
|
|
71
|
-
expect(createHmac("sha256", key).update(sts, "utf8").digest("hex")).toBe(
|
|
72
|
-
"5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
|
|
21
|
+
describe("the published vector", () => {
|
|
22
|
+
test("get-vanilla signs exactly as the test suite says", () => {
|
|
23
|
+
const headers = signV4({
|
|
24
|
+
method: "GET",
|
|
25
|
+
url: "https://example.amazonaws.com/",
|
|
26
|
+
headers: {},
|
|
27
|
+
body: "",
|
|
28
|
+
region: "us-east-1",
|
|
29
|
+
service: "service",
|
|
30
|
+
credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET },
|
|
31
|
+
now: new Date("2015-08-30T12:36:00Z"),
|
|
32
|
+
});
|
|
33
|
+
expect(headers.authorization).toBe(
|
|
34
|
+
"AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, " +
|
|
35
|
+
"SignedHeaders=host;x-amz-date, " +
|
|
36
|
+
"Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
|
|
73
37
|
);
|
|
74
38
|
});
|
|
75
39
|
|
|
@@ -78,40 +42,78 @@ describe("the published vectors", () => {
|
|
|
78
42
|
});
|
|
79
43
|
});
|
|
80
44
|
|
|
81
|
-
describe("
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
45
|
+
describe("the Cloud Control vector (#4583)", () => {
|
|
46
|
+
// Recorded from lexicons/aws/src/api/sigv4.ts, the lexicon's own signer,
|
|
47
|
+
// with these inputs, before it was removed in favour of core's.
|
|
48
|
+
const request = {
|
|
49
|
+
method: "POST",
|
|
50
|
+
url: "https://cloudcontrolapi.us-east-1.amazonaws.com/",
|
|
51
|
+
headers: {
|
|
52
|
+
"content-type": "application/x-amz-json-1.0",
|
|
53
|
+
"x-amz-target": "CloudApiService.GetResource",
|
|
54
|
+
"user-agent": "chant/0.124.34",
|
|
55
|
+
"x-amzn-trace-id": "Root=1-5759e988-bd862e3fe1be46a994272793",
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify({ TypeName: "AWS::S3::Bucket", Identifier: "chant-example-bucket" }),
|
|
58
|
+
service: "cloudcontrolapi",
|
|
59
|
+
region: "us-east-1",
|
|
60
|
+
now: new Date("2015-08-30T12:36:00Z"),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
test("a GetResource read signs to the recorded signature, user-agent and trace id unsigned", () => {
|
|
64
|
+
const headers = signRequest({ ...request, credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET } });
|
|
65
|
+
expect(headers).toEqual({
|
|
66
|
+
"content-type": "application/x-amz-json-1.0",
|
|
67
|
+
"x-amz-target": "CloudApiService.GetResource",
|
|
68
|
+
"user-agent": "chant/0.124.34",
|
|
69
|
+
"x-amzn-trace-id": "Root=1-5759e988-bd862e3fe1be46a994272793",
|
|
70
|
+
"x-amz-date": "20150830T123600Z",
|
|
71
|
+
"x-amz-content-sha256": "0748e7c18ab9933c78b1a34cd08c91183112acfa9918aea20ba2f1a6d33ef3d0",
|
|
72
|
+
authorization:
|
|
73
|
+
"AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/cloudcontrolapi/aws4_request, " +
|
|
74
|
+
"SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, " +
|
|
75
|
+
"Signature=f8f2bbebcf51eed1126eca37ab3e614b540f0d769eb64ec2a0c5ee811b168f51",
|
|
95
76
|
});
|
|
96
77
|
});
|
|
97
78
|
|
|
98
|
-
test("
|
|
99
|
-
|
|
79
|
+
test("with a session token, the token is sent, signed, and the signature is the recorded one", () => {
|
|
80
|
+
const headers = signRequest({
|
|
81
|
+
...request,
|
|
82
|
+
credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET, sessionToken: "FwoGZXIvYXdzEXAMPLE" },
|
|
83
|
+
});
|
|
84
|
+
expect(headers["x-amz-security-token"]).toBe("FwoGZXIvYXdzEXAMPLE");
|
|
85
|
+
expect(headers.authorization).toBe(
|
|
86
|
+
"AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/cloudcontrolapi/aws4_request, " +
|
|
87
|
+
"SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-target, " +
|
|
88
|
+
"Signature=99fef393d5ff5ad524823b03476535fa00631828cc22dae15f8f3cfe9d18ab69",
|
|
89
|
+
);
|
|
100
90
|
});
|
|
91
|
+
});
|
|
101
92
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
describe("header set", () => {
|
|
94
|
+
test("the unsigned headers are sent but left out of the signature", () => {
|
|
95
|
+
const caller = {
|
|
105
96
|
"user-agent": "chant",
|
|
106
97
|
"x-amzn-trace-id": "Root=1-x",
|
|
107
98
|
connection: "keep-alive",
|
|
108
99
|
expect: "100-continue",
|
|
109
|
-
|
|
100
|
+
};
|
|
101
|
+
const headers = signRequest({
|
|
102
|
+
method: "POST",
|
|
103
|
+
url: "https://cloudformation.us-east-1.amazonaws.com/",
|
|
104
|
+
headers: { ...caller, authorization: "stale" },
|
|
105
|
+
body: "",
|
|
106
|
+
service: "cloudformation",
|
|
107
|
+
region: "us-east-1",
|
|
108
|
+
credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET },
|
|
109
|
+
now: new Date("2015-08-30T12:36:00Z"),
|
|
110
110
|
});
|
|
111
|
-
expect(
|
|
111
|
+
for (const [name, value] of Object.entries(caller)) expect(headers[name]).toBe(value);
|
|
112
|
+
expect(headers.authorization).toContain("SignedHeaders=host;x-amz-content-sha256;x-amz-date,");
|
|
113
|
+
expect([...UNSIGNED_HEADERS].sort()).toEqual(["authorization", "connection", "expect", "user-agent", "x-amzn-trace-id"]);
|
|
112
114
|
});
|
|
113
115
|
|
|
114
|
-
test("a bodyless request hashes to the empty-payload constant
|
|
116
|
+
test("a bodyless request hashes to the empty-payload constant", () => {
|
|
115
117
|
const headers = signRequest({
|
|
116
118
|
method: "POST",
|
|
117
119
|
url: "https://cloudformation.us-east-1.amazonaws.com/",
|
|
@@ -124,20 +126,6 @@ describe("header canonicalization", () => {
|
|
|
124
126
|
});
|
|
125
127
|
expect(headers["x-amz-content-sha256"]).toBe(EMPTY_PAYLOAD_SHA256);
|
|
126
128
|
});
|
|
127
|
-
|
|
128
|
-
test("the query string sorts by name then value, RFC 3986 encoded", () => {
|
|
129
|
-
const { canonical } = canonicalRequest(
|
|
130
|
-
"GET",
|
|
131
|
-
new URL("https://example.amazonaws.com/?b=2&a=z&a=a&c=hi%20there*"),
|
|
132
|
-
{ host: "example.amazonaws.com" },
|
|
133
|
-
EMPTY_PAYLOAD_SHA256,
|
|
134
|
-
);
|
|
135
|
-
expect(canonical.split("\n")[2]).toBe("a=a&a=z&b=2&c=hi%20there%2A");
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test("amzDate is ISO-8601 basic, which is what X-Amz-Date wants", () => {
|
|
139
|
-
expect(amzDate(new Date("2015-08-30T12:36:00.123Z"))).toBe("20150830T123600Z");
|
|
140
|
-
});
|
|
141
129
|
});
|
|
142
130
|
|
|
143
131
|
describe("signRequest", () => {
|