Skip to content

Commit a11bb41

Browse files
authored
update to version 6.3.3 (#584)
1 parent f9b1e66 commit a11bb41

38 files changed

+631
-107
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [6.3.3] - 2024-12-27
9+
10+
### Fixed
11+
- Overlays not checking for valid S3 buckets
12+
- Failures when updating deployments created in version 6.1.0 and prior [#559](https://github.com/aws-solutions/serverless-image-handler/issues/559)
13+
14+
### Security
15+
16+
- Added allowlist on sharp operations. [Info](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/create-and-use-image-requests.html#restricted-operations)
17+
- Added deny list on custom headers for base64 encoded requests. [Info](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/create-and-use-image-requests.html#include-custom-response-headers)
18+
- Added inference of Content-Type header if S3 Metadata provides an unsupported value
19+
820
## [6.3.2] - 2024-11-22
921

1022
### Fixed
1123
- Upgrade cross-spawn to v7.0.6 for vulnerability [CVE-2024-9506](https://github.com/advisories/GHSA-5j4c-8p2g-v4jx)
1224

25+
1326
## [6.3.1] - 2024-10-02
1427

1528
### Fixed

VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.2
1+
6.3.3

source/constructs/cdk.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"app": "npx ts-node --prefer-ts-exts bin/constructs.ts",
33
"context": {
44
"solutionId": "SO0023",
5-
"solutionVersion": "custom-v6.3.2",
5+
"solutionVersion": "custom-v6.3.3",
66
"solutionName": "serverless-image-handler"
77
}
88
}

source/constructs/lib/common-resources/common-resources-construct.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface AppRegistryApplicationProps {
2727
readonly description: string;
2828
readonly solutionId: string;
2929
readonly applicationName: string;
30+
readonly solutionName: string;
3031
readonly solutionVersion: string;
3132
}
3233

@@ -91,13 +92,13 @@ export class CommonResources extends Construct {
9192
const applicationType = "AWS-Solutions";
9293

9394
const application = new appreg.Application(stack, "AppRegistry", {
94-
applicationName: Fn.join("-", ["AppRegistry", Aws.STACK_NAME, Aws.REGION, Aws.ACCOUNT_ID]),
95-
description: `Service Catalog application to track and manage all your resources for the solution ${props.applicationName}`,
95+
applicationName: props.applicationName,
96+
description: `Service Catalog application to track and manage all your resources for the solution ${props.solutionName}`,
9697
});
9798
application.associateApplicationWithStack(stack);
9899

99100
Tags.of(application).add("Solutions:SolutionID", props.solutionId);
100-
Tags.of(application).add("Solutions:SolutionName", props.applicationName);
101+
Tags.of(application).add("Solutions:SolutionName", props.solutionName);
101102
Tags.of(application).add("Solutions:SolutionVersion", props.solutionVersion);
102103
Tags.of(application).add("Solutions:ApplicationType", applicationType);
103104

@@ -108,7 +109,7 @@ export class CommonResources extends Construct {
108109
applicationType,
109110
version: props.solutionVersion,
110111
solutionID: props.solutionId,
111-
solutionName: props.applicationName,
112+
solutionName: props.solutionName,
112113
},
113114
});
114115
attributeGroup.associateWith(application);

source/constructs/lib/common-resources/custom-resources/custom-resource-construct.ts

+46
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class CustomResourcesConstruct extends Construct {
4949
private readonly customResourceRole: Role;
5050
private readonly customResourceLambda: LambdaFunction;
5151
public readonly uuid: string;
52+
public appRegApplicationName: string;
5253

5354
constructor(scope: Construct, id: string, props: CustomResourcesConstructProps) {
5455
super(scope, id);
@@ -116,6 +117,40 @@ export class CustomResourcesConstruct extends Construct {
116117
}),
117118
],
118119
}),
120+
AppRegistryPolicy: new PolicyDocument({
121+
statements: [
122+
new PolicyStatement({
123+
effect: Effect.ALLOW,
124+
actions: ["cloudformation:DescribeStackResources"],
125+
resources: [
126+
Stack.of(this).formatArn({
127+
partition: Aws.PARTITION,
128+
service: "cloudformation",
129+
region: Aws.REGION,
130+
account: Aws.ACCOUNT_ID,
131+
resource: "stack",
132+
resourceName: `${Aws.STACK_NAME}/*`,
133+
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
134+
}),
135+
],
136+
}),
137+
new PolicyStatement({
138+
effect: Effect.ALLOW,
139+
actions: ["servicecatalog:GetApplication"],
140+
resources: [
141+
Stack.of(this).formatArn({
142+
partition: Aws.PARTITION,
143+
service: "servicecatalog",
144+
region: Aws.REGION,
145+
account: Aws.ACCOUNT_ID,
146+
resource: "applications",
147+
resourceName: `*`,
148+
arnFormat: ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME,
149+
}),
150+
],
151+
}),
152+
],
153+
}),
119154
},
120155
});
121156

@@ -188,6 +223,17 @@ export class CustomResourcesConstruct extends Construct {
188223
SourceBuckets: props.sourceBuckets,
189224
});
190225

226+
const getAppRegApplicationNameResults = this.createCustomResource(
227+
"CustomResourceGetAppRegApplicationName",
228+
this.customResourceLambda,
229+
{
230+
CustomAction: "getAppRegApplicationName",
231+
Region: Aws.REGION,
232+
DefaultName: Fn.join("-", ["AppRegistry", Aws.STACK_NAME, Aws.REGION, Aws.ACCOUNT_ID]),
233+
}
234+
);
235+
this.appRegApplicationName = getAppRegApplicationNameResults.getAttString("ApplicationName");
236+
191237
this.createCustomResource(
192238
"CustomResourceCheckFallbackImage",
193239
this.customResourceLambda,

source/constructs/lib/serverless-image-stack.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ export class ServerlessImageHandlerStack extends Stack {
219219
description: `${props.solutionId} - ${props.solutionName}. Version ${props.solutionVersion}`,
220220
solutionVersion: props.solutionVersion,
221221
solutionId: props.solutionId,
222-
applicationName: props.solutionName,
222+
solutionName: props.solutionName,
223+
applicationName: commonResources.customResources.appRegApplicationName,
223224
});
224225

225226
this.templateOptions.metadata = {

source/constructs/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/constructs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "constructs",
3-
"version": "6.3.2",
3+
"version": "6.3.3",
44
"description": "Serverless Image Handler Constructs",
55
"license": "Apache-2.0",
66
"author": {

source/constructs/test/__snapshots__/constructs.test.ts.snap

+102-19
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
8181
"Config": {
8282
"AnonymousUsage": "Yes",
8383
"SolutionId": "S0ABC",
84-
"Version": "v6.3.2",
84+
"Version": "v6.3.3",
8585
},
8686
},
8787
},
@@ -387,28 +387,17 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
387387
"Properties": {
388388
"Description": "Service Catalog application to track and manage all your resources for the solution sih",
389389
"Name": {
390-
"Fn::Join": [
391-
"-",
392-
[
393-
"AppRegistry",
394-
{
395-
"Ref": "AWS::StackName",
396-
},
397-
{
398-
"Ref": "AWS::Region",
399-
},
400-
{
401-
"Ref": "AWS::AccountId",
402-
},
403-
],
390+
"Fn::GetAtt": [
391+
"CommonResourcesCustomResourcesCustomResourceGetAppRegApplicationName62472E55",
392+
"ApplicationName",
404393
],
405394
},
406395
"Tags": {
407396
"SolutionId": "S0ABC",
408397
"Solutions:ApplicationType": "AWS-Solutions",
409398
"Solutions:SolutionID": "S0ABC",
410399
"Solutions:SolutionName": "sih",
411-
"Solutions:SolutionVersion": "v6.3.2",
400+
"Solutions:SolutionVersion": "v6.3.3",
412401
},
413402
},
414403
"Type": "AWS::ServiceCatalogAppRegistry::Application",
@@ -1277,7 +1266,7 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
12771266
},
12781267
"S3Key": "Omitted to remove snapshot dependency on hash",
12791268
},
1280-
"Description": "sih (v6.3.2): Performs image edits and manipulations",
1269+
"Description": "sih (v6.3.3): Performs image edits and manipulations",
12811270
"Environment": {
12821271
"Variables": {
12831272
"AUTO_WEBP": {
@@ -1977,7 +1966,7 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
19771966
},
19781967
"S3Key": "Omitted to remove snapshot dependency on hash",
19791968
},
1980-
"Description": "sih (v6.3.2): Custom resource",
1969+
"Description": "sih (v6.3.3): Custom resource",
19811970
"Environment": {
19821971
"Variables": {
19831972
"RETRY_SECONDS": "5",
@@ -2004,6 +1993,40 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
20041993
},
20051994
"Type": "AWS::Lambda::Function",
20061995
},
1996+
"CommonResourcesCustomResourcesCustomResourceGetAppRegApplicationName62472E55": {
1997+
"DeletionPolicy": "Delete",
1998+
"Properties": {
1999+
"CustomAction": "getAppRegApplicationName",
2000+
"DefaultName": {
2001+
"Fn::Join": [
2002+
"-",
2003+
[
2004+
"AppRegistry",
2005+
{
2006+
"Ref": "AWS::StackName",
2007+
},
2008+
{
2009+
"Ref": "AWS::Region",
2010+
},
2011+
{
2012+
"Ref": "AWS::AccountId",
2013+
},
2014+
],
2015+
],
2016+
},
2017+
"Region": {
2018+
"Ref": "AWS::Region",
2019+
},
2020+
"ServiceToken": {
2021+
"Fn::GetAtt": [
2022+
"CommonResourcesCustomResourcesCustomResourceFunction0D924235",
2023+
"Arn",
2024+
],
2025+
},
2026+
},
2027+
"Type": "AWS::CloudFormation::CustomResource",
2028+
"UpdateReplacePolicy": "Delete",
2029+
},
20072030
"CommonResourcesCustomResourcesCustomResourceRole8958A1ED": {
20082031
"Metadata": {
20092032
"cfn_nag": {
@@ -2160,6 +2183,66 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
21602183
},
21612184
"PolicyName": "EC2Policy",
21622185
},
2186+
{
2187+
"PolicyDocument": {
2188+
"Statement": [
2189+
{
2190+
"Action": "cloudformation:DescribeStackResources",
2191+
"Effect": "Allow",
2192+
"Resource": {
2193+
"Fn::Join": [
2194+
"",
2195+
[
2196+
"arn:",
2197+
{
2198+
"Ref": "AWS::Partition",
2199+
},
2200+
":cloudformation:",
2201+
{
2202+
"Ref": "AWS::Region",
2203+
},
2204+
":",
2205+
{
2206+
"Ref": "AWS::AccountId",
2207+
},
2208+
":stack/",
2209+
{
2210+
"Ref": "AWS::StackName",
2211+
},
2212+
"/*",
2213+
],
2214+
],
2215+
},
2216+
},
2217+
{
2218+
"Action": "servicecatalog:GetApplication",
2219+
"Effect": "Allow",
2220+
"Resource": {
2221+
"Fn::Join": [
2222+
"",
2223+
[
2224+
"arn:",
2225+
{
2226+
"Ref": "AWS::Partition",
2227+
},
2228+
":servicecatalog:",
2229+
{
2230+
"Ref": "AWS::Region",
2231+
},
2232+
":",
2233+
{
2234+
"Ref": "AWS::AccountId",
2235+
},
2236+
":/applications/*",
2237+
],
2238+
],
2239+
},
2240+
},
2241+
],
2242+
"Version": "2012-10-17",
2243+
},
2244+
"PolicyName": "AppRegistryPolicy",
2245+
},
21632246
],
21642247
"Tags": [
21652248
{
@@ -2583,7 +2666,7 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
25832666
"applicationType": "AWS-Solutions",
25842667
"solutionID": "S0ABC",
25852668
"solutionName": "sih",
2586-
"version": "v6.3.2",
2669+
"version": "v6.3.3",
25872670
},
25882671
"Description": "Attribute group for solution information",
25892672
"Name": {

source/constructs/test/constructs.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ test("Serverless Image Handler Stack Snapshot", () => {
1111
context: {
1212
solutionId: "SO0023",
1313
solutionName: "serverless-image-handler",
14-
solutionVersion: "v6.3.2",
14+
solutionVersion: "v6.3.3",
1515
},
1616
});
1717

1818
const stack = new ServerlessImageHandlerStack(app, "TestStack", {
1919
solutionId: "S0ABC",
2020
solutionName: "sih",
21-
solutionVersion: "v6.3.2",
21+
solutionVersion: "v6.3.3",
2222
});
2323

2424
const template = Template.fromStack(stack);

0 commit comments

Comments
 (0)