Skip to content

Delete E3511 once the IAM role ARN formats land in enhanced-schemas #4941

Closed

Description

@kddejong

Delete E3511 once the IAM role ARN formats land in enhanced-schemas

Problem

E3511 (src/cfnlint/rules/resources/iam/RoleArnPattern.py) duplicates the AWS::IAM::Role.Arn format rule E1156 (src/cfnlint/rules/formats/IamRoleArn.py). It carries a hardcoded list of six property paths and its own inline regex.

On the two properties whose base schema already declares format: AWS::IAM::Role.Arn, a bad value is reported twice:

E1156  'bogusname' is not a 'AWS::IAM::Role.Arn' with pattern '^arn:aws[a-zA-Z-]*:iam::\d{12}:role/.+$'
E3511  'bogusname' does not match '^arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/[a-zA-Z_0-9+=,.@\-_/]+$'

Two rule IDs and two different regexes for one problem. Reproduced on main at 658d6f160.

What the base schemas say for E3511's six paths, and what each property actually accepts (measured in us-east-1, 2026-10-26 — see the enhanced-schemas issue for the verbatim errors):

Property Base schema today Accepts
Backup::BackupSelection BackupSelection/IamRoleArn format: AWS::IAM::Role.Arn ARN
ECS::TaskDefinition ExecutionRoleArn format: AWS::IAM::Role.Arn ARN
EC2::SpotFleet SpotFleetRequestConfigData/IamFleetRole {'type': 'string'} ARN only
S3::Bucket ReplicationConfiguration/Role {'type': 'string'} ARN only
Batch::ComputeEnvironment ServiceRole {'type': 'string'} ARN or name
Batch::ComputeEnvironment ComputeResources/SpotIamFleetRole {'type': 'string'} ARN or name

So E3511 is redundant on two paths, correct-but-duplicable on two, and actively wrong on two — it rejects the bare-name and path-prefixed-name forms that Batch accepts. That last pair is the subject of #4838 and PR #4926.

E3511 produces two false positives on the Batch paths

Both measured against the pattern and confirmed by full lint on main:

'AWSBatchServiceRole'                FIRES   <- bare name, deploys (#4838)
'/service-role/AWSBatchServiceRole'  FIRES   <- path-prefixed name, documented form
'/foo/bar'                           FIRES   <- the API model's own example

The path-prefixed form is not in #4838 and has not been reported separately. AWS Batch's API model requires it when the role has a path other than /.

For contrast, a service-role ARN is an ordinary role ARN with a path and already passes both patterns:

'arn:aws:iam::<account>:role/service-role/AWSBatchServiceRole'   passes E3511 and E1156

The two regexes disagree

  • E3511: ^arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/[a-zA-Z_0-9+=,.@\-_/]+$ — partition optional, path charset restricted
  • E1156: ^arn:aws[a-zA-Z-]*:iam::\d{12}:role/.+$ — partition required, path unrestricted

They cannot both be right. E1156 looks closer: arn: with no partition is not a valid ARN, and IAM role paths do contain /. Worth settling as part of this.

Blocked on

An enhanced-schemas change, filed separately there:

  • plain format: AWS::IAM::Role.Arn for EC2::SpotFleet IamFleetRole and S3::Bucket ReplicationConfiguration/Role
  • anyOf: [{format: AWS::IAM::Role.Arn}, {pattern: <name or /path/name>}] for the two Batch properties, following the existing precedent in the format generator for AWS::DevOpsAgent::Service

Order matters. Those must ship and reach cfn-lint through a schema sync before E3511 is deleted, or the four properties lose their check in the interval. Because both repositories are ours, this can be verified before release by building the schema set locally and pointing cfn-lint at it with XDG_CACHE_HOME — see .kiro/context/verification.md. The built version.json date must beat the bundled one.

When unblocked

  1. Delete src/cfnlint/rules/resources/iam/RoleArnPattern.py and its test.
  2. Remove the E3511 row from docs/rules.md (generated — use cfn-lint --update-documentation).
  3. Note the removal in the changelog: anyone with ignore_checks: [E3511] will start seeing E1156 instead, so a suppression needs updating rather than silently widening.
  4. Confirm by full lint, against the locally built schema set, that:
    • all four ARN-only properties still report a bad value, under E1156
    • both Batch properties are silent for a bare name, a path-prefixed name, and a valid ARN
    • both Batch properties still report a malformed ARN
    • the good/ fixture sweep is unchanged

Related

PR #4926 fixes the Batch ServiceRole false positive by adding a path-based exemption inside E3511, keyed on the property name ServiceRole. It happens to fix the path-prefixed-name case too, since its guard is not arn.startswith("arn:"). But nine resource types have a top-level ServiceRole, so the exemption would silently apply to any of them added to E3511 later. If this issue is taken, #4926 becomes unnecessary and should be closed in its favour rather than revised.

Activity

  1. added a commit that references this issue on Oct 27, 2026
    6e5000d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions