aws / aws/aws-cdk

(ecs-patterns): ApplicationLoadBalancedTaskImageOptions: Add readonly root filesystem flag

Open
#23,935 5 comments 10 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs-patterns effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

I am currently getting AWS Security Hub notifications that some ECS tasks in an ALB deployed via CDK **do not** have root read-only access to the ECS task, as defined below.

https://docs.aws.amazon.com/config/latest/developerguide/ecs-containers-readonly-access.html

These tasks are created with this CDK construct (ApplicationLoadBalancedTaskImageOptions):

https://github.com/aws/aws-cdk/blob/cea1039e3664fdfa89c6f00cdaeb1a0185a12678/packages/%40aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts#L259

However there does not seem to be a clear way to enable root read-only file systems in this construct.

The direct `ecs-lib` does seem to implement this feature:

https://github.com/aws/aws-cdk/blob/cea1039e3664fdfa89c6f00cdaeb1a0185a12678/packages/%40aws-cdk/aws-ecs/lib/container-definition.ts#L294

Is it possible to implement this on the `ALB task image options` class referenced above?

### Use Case

Enables remediation of security hub issue ECS.5

https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards-fsbp-controls.html#fsbp-ecs-5

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.47.0

### Environment details (OS name and version, etc.)

MacOS 13.1

Contributor guide

Open the contributing guide

Research direction

Start in packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts at the ApplicationLoadBalancedTaskImageOptions reference, then compare how readonly root filesystems are handled in packages/@aws-cdk/aws-ecs/lib/container-definition.ts. Trace how task image options reach the ECS container definition; done means the ALB task image options expose this setting and generated ECS tasks use a read-only root filesystem for the ECS.5 remediation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.