Skip to content

Commit 290a499

Browse files
committed
fix: enable node-fips compatible body checksums for S3 (#31883)
Internal reference: D166315367 In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module. However by default the S3 client is using an MD5 checksum for content integrity checking. This causes any S3 upload operation to fail with a cryptography error. We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing. SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior of the AWS SDKv3 and is a safe choice for all users. For non-FIPS users, we have verified functionality via cli-integ-tests. For FIPS users, we have manually verified `cdk deploy` is now working in a FIPS enabled environment. We have also verified the configuration with the affected customer. - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 75cf2e0 commit 290a499

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

packages/@aws-cdk/integ-runner/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@
7474
"@aws-cdk/cloud-assembly-schema": "^38.0.0",
7575
"@aws-cdk/cloudformation-diff": "0.0.0",
7676
"@aws-cdk/cx-api": "0.0.0",
77-
"cdk-assets": "^2.154.0",
77+
"cdk-assets": "^2.155.17",
7878
"@aws-cdk/aws-service-spec": "^0.1.29",
79-
8079
"@aws-cdk/cdk-cli-wrapper": "0.0.0",
8180
"aws-cdk": "0.0.0",
8281
"chalk": "^4",

packages/aws-cdk/lib/api/aws-auth/sdk.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ export class SDK implements ISDK {
174174
}
175175

176176
public s3(): AWS.S3 {
177-
return this.wrapServiceErrorHandling(new AWS.S3(this.config));
177+
return this.wrapServiceErrorHandling(new AWS.S3({
178+
// In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module.
179+
// However by default the S3 client is using an MD5 checksum for content integrity checking.
180+
// While this usage is technically allowed in FIPS (MD5 is only prohibited for cryptographic use),
181+
// in practice it is just easier to use an allowed checksum mechanism.
182+
// We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing.
183+
// SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior
184+
// of the AWS SDKv3 and is a safe choice for all users.
185+
s3DisableBodySigning: false,
186+
computeChecksums: false,
187+
...this.config,
188+
}));
178189
}
179190

180191
public route53(): AWS.Route53 {

packages/aws-cdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"archiver": "^5.3.2",
105105
"aws-sdk": "^2.1691.0",
106106
"camelcase": "^6.3.0",
107-
"cdk-assets": "^2.155.0",
107+
"cdk-assets": "^2.155.17",
108108
"cdk-from-cfn": "^0.162.0",
109109
"chalk": "^4",
110110
"chokidar": "^3.6.0",

yarn.lock

+9-29
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,10 @@
6767
jsonschema "^1.4.1"
6868
semver "^7.6.3"
6969

70-
"@aws-cdk/cx-api@^2.158.0":
71-
version "2.159.0"
72-
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.159.0.tgz#567c0ae0d7a6fc2f7cb9bda7e6cb23fac8d99094"
73-
integrity sha512-HVkHCKQjVi3PCSOF22zLztZMEL+cJcyVvFctS3vXPetgl77L+e/onaGt1AUwRcNY44tvbqJm3oIVQt2HqM3q7w==
74-
dependencies:
75-
semver "^7.6.3"
76-
77-
"@aws-cdk/cx-api@^2.160.0":
78-
version "2.160.0"
79-
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.160.0.tgz#08d4599690a39768bb944c411f1141166e313b59"
80-
integrity sha512-ujXT/UoUDquCwxJ14jkRzIFeMabMyLATWP32Jv0WJjWpxrGJCa+Lua+CByOyikC1QeSVxq8pZcrx0jjYyG0qzw==
70+
"@aws-cdk/cx-api@^2.163.1":
71+
version "2.163.1"
72+
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.163.1.tgz#ef55da9f471c963d877b23d3201ca4560d656b2e"
73+
integrity sha512-0bVL/pX0UcliCdXVcgtLVL3W5EHAp4RgW7JN3prz1dIOmLZzZ30DW0qWSc0D0EVE3rVG6RVgfIiuFBFK6WFZ+w==
8174
dependencies:
8275
semver "^7.6.3"
8376

@@ -6794,26 +6787,13 @@ [email protected], case@^1.6.3:
67946787
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
67956788
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
67966789

6797-
cdk-assets@^2.154.0:
6798-
version "2.154.0"
6799-
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.154.0.tgz#675d239c0156ca05c4a2809b30858c843f984ead"
6800-
integrity sha512-8M3zLHCx8nj5Fv5ubEps53jh22NN9G7ZLuq1AJwPdXZP7+nb4q5tdl2Ah2ZPMM/dob9u3KTwNeN34oLKHfDzbw==
6801-
dependencies:
6802-
"@aws-cdk/cloud-assembly-schema" "^38.0.0"
6803-
"@aws-cdk/cx-api" "^2.158.0"
6804-
archiver "^5.3.2"
6805-
aws-sdk "^2.1691.0"
6806-
glob "^7.2.3"
6807-
mime "^2.6.0"
6808-
yargs "^16.2.0"
6809-
6810-
cdk-assets@^2.155.0:
6811-
version "2.155.0"
6812-
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.0.tgz#2e4f347f850c8850bcb2834807b457f41e62f1cf"
6813-
integrity sha512-wEztkIxJnQrIh93x6Qxu4MbRLROhl7NeWgasNZdCoOd6ykXsDSuL8JMi0wettbwGArnhhXMcll1m4+X4VQgzcA==
6790+
cdk-assets@^2.155.17:
6791+
version "2.155.17"
6792+
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.17.tgz#d6c285d0279aec8226b45577a151e6dd32a12fa5"
6793+
integrity sha512-+hJlYYlsPHhPCeMC/V3pMyrjz5K8p9SQdC50qMg6a8/w/3w0WY1ZixyKGtpJfFB11C3Ubb04l2miieaAH00CIA==
68146794
dependencies:
68156795
"@aws-cdk/cloud-assembly-schema" "^38.0.1"
6816-
"@aws-cdk/cx-api" "^2.160.0"
6796+
"@aws-cdk/cx-api" "^2.163.1"
68176797
archiver "^5.3.2"
68186798
aws-sdk "^2.1691.0"
68196799
glob "^7.2.3"

0 commit comments

Comments
 (0)