Skip to content

fix(efs): client mount permissions are not granted by default (under feature flag)#35086

Closed
samyxdev wants to merge 14 commits intoaws:mainfrom
samyxdev:fix-efs-defaults
Closed

fix(efs): client mount permissions are not granted by default (under feature flag)#35086
samyxdev wants to merge 14 commits intoaws:mainfrom
samyxdev:fix-efs-defaults

Conversation

@samyxdev
Copy link
Copy Markdown

@samyxdev samyxdev commented Jul 28, 2025

Issue #33669 and #27374

Closes #33669 and #27374 . Inspired by #33671.

Reason for this change

EFS doesn't allow authentificated clients to mount the filesystem by default which makes it unusable when using defaults.

Description of changes

Added the elasticfilesystem:ClientMount permission by default when the client is authentificated, under the feature flag @aws-cdk/aws-efs:defaultAllowClientMount.

Describe any new or updated permissions being added

When the feature flag is enabled, the IAM permissions will now be set as:

new iam.PolicyStatement({
                principals: [new iam.AnyPrincipal()],
                actions: [
                  ClientAction.MOUNT,
                  ClientAction.WRITE,
                  ClientAction.ROOT_ACCESS,
                ],
                conditions: {
                  Bool: {
                    'elasticfilesystem:AccessedViaMountTarget': 'true',
                  },
                },

compared to the previously set:

new iam.PolicyStatement({
                principals: [new iam.AnyPrincipal()],
                actions: [
                  ClientAction.WRITE,
                  ClientAction.ROOT_ACCESS,
                ],
                conditions: {
                  Bool: {
                    'elasticfilesystem:AccessedViaMountTarget': 'true',
                  },
                },
              }));

Description of how you validated changes

Added an integration tests following the example from #33669: Leverages ECS to use a container that mounts the EFS.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team July 28, 2025 11:38
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 labels Jul 28, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 29, 2025
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6a002a5
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@Abogical Abogical self-assigned this Jul 29, 2025
conditions: {
Bool: {
'elasticfilesystem:AccessedViaMountTarget': 'true',
if (FeatureFlags.of(this).isEnabled(cxapi.EFS_DEFAULT_ALLOW_CLIENT_MOUNT)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this warrants adding a new feature flag. I don't think it's a breaking change, especially when the issue states that the defaults were unusable in the first place.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 29, 2025
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

3 similar comments
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@Abogical Abogical added the pr-linter/do-not-close The PR linter will not close this PR while this label is present label Aug 19, 2025
@mergify mergify bot dismissed Abogical’s stale review August 19, 2025 09:56

Pull request has been modified.

@Abogical
Copy link
Copy Markdown
Member

The PR has the effect of allowing anonymous access again to EFS filesystem, which is contradictory to the EFS Console default and what our previous PR (#35086) does. The issue that the PR aims to fix isn't really a bug, but intended behavior as a result of disallowing anonymous access by default.

I'm closing this PR as a result.

Related: #33669 (comment)

@Abogical Abogical closed this Aug 25, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2025
@samyxdev samyxdev deleted the fix-efs-defaults branch September 4, 2025 11:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 pr-linter/do-not-close The PR linter will not close this PR while this label is present

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-efs: EFS does not contain the mount access policy by default

3 participants