Repository navigation
refactor: remove E3511 in favour of the E1156 role ARN format - #4942
Merged
Merged
Conversation
E3511 carried a hardcoded list of six property paths and its own inline regex, duplicating the AWS::IAM::Role.Arn format rule E1156. On the four paths that are ARN-only it reported every bad value twice, under two rule IDs with two disagreeing patterns. On the two AWS::Batch::ComputeEnvironment paths it was actively wrong: ServiceRole and ComputeResources/SpotIamFleetRole accept a role name or a path-prefixed role name as well as an ARN, and E3511 rejected both. All six properties now carry their constraint in the resource schemas -- format: AWS::IAM::Role.Arn on the four ARN-only paths, and anyOf: [Role.Arn, Role.Name] on the two Batch paths -- so E1156 and E1165 cover them without the false positives. Users suppressing E3511 via ignore_checks will see E1156 (and E1165 on the Batch paths) instead, so an existing suppression needs updating rather than silently widening. Fixes aws-cloudformation#4941
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4942 +/- ##
==========================================
- Coverage 94.68% 94.68% -0.01%
==========================================
Files 442 441 -1
Lines 16077 16058 -19
Branches 3116 3114 -2
==========================================
- Hits 15223 15204 -19
Misses 470 470
Partials 384 384
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kddejong
marked this pull request as ready for review
October 27, 2026 17:24
This was referenced Oct 27, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Merge gate — do not merge until
cfn-lint --update-specsshows all four properties carrying their formats.Merging before that leaves
EC2::SpotFleetIamFleetRoleandS3::BucketReplicationConfiguration/Rolewith no role check at all.Status: the gate is already satisfied. The enhanced-schemas rebuild triggered by
aws-cloudformation/resource-provider-enhanced-schemas#74 republished
schemas-cfn-lint.zipat2026-10-27T16:56:40Z(releaseschema_date2026-10-27T16:56:37Z). Re-confirm before merging:Expected:
format: AWS::IAM::Role.Arnon the first two,anyOf: [Role.Arn, Role.Name]on the two Batch paths.Fixes #4941
Problem
E3511(RoleArnPattern) carried a hardcoded list of six property paths and its own inline regex, duplicating theAWS::IAM::Role.Arnformat ruleE1156.On the four ARN-only paths it reported every bad value twice, under two rule IDs whose patterns disagree:
E3511made the partition optional (arn::iam::...is not a valid ARN) and restricted the path charset;E1156requires a partition and leaves the path unrestricted.On the two
AWS::Batch::ComputeEnvironmentpaths it was actively wrong.ServiceRoleandComputeResources/SpotIamFleetRoleaccept a role name or a path-prefixed role name as well as an ARN, andE3511rejected all of those:Evidence for the constraint
The constraint now lives in the resource schemas, added in aws-cloudformation/resource-provider-enhanced-schemas#74 (merged 2026-10-27):
Backup::BackupSelectionBackupSelection/IamRoleArnformat: AWS::IAM::Role.ArnECS::TaskDefinitionExecutionRoleArnformat: AWS::IAM::Role.ArnEC2::SpotFleetSpotFleetRequestConfigData/IamFleetRoleformat: AWS::IAM::Role.ArnS3::BucketReplicationConfiguration/Roleformat: AWS::IAM::Role.ArnBatch::ComputeEnvironmentServiceRoleanyOf: [Role.Arn, Role.Name]Batch::ComputeEnvironmentComputeResources/SpotIamFleetRoleanyOf: [Role.Arn, Role.Name]The per-property accept/reject behaviour was measured in us-east-1 on 2026-10-26; the verbatim service errors are recorded on the enhanced-schemas issue. The
AWS::IAM::Role.Nameformat used by the two Batch paths landed asE1165in #4936.So every path
E3511covered is now covered byE1156, and the two Batch paths additionally byE1165— without the false positives.Changelog note
Anyone suppressing this rule with
ignore_checks: [E3511]will start seeingE1156(andE1165on the two Batch paths) instead. An existing suppression needs updating, not silently widening — a staleE3511entry becomes a no-op.Verification
Verified against both the published schemas and a locally built schema set (enhanced-schemas
upstream/mainwith #74, assembled into a fresh directory and selected viaXDG_CACHE_HOME). Both produce identical results, so there is no interval where a property loses its check.The 19 test failures are pre-existing and environmental (missing
pydot,junit-xml,jschema-to-python, andcfn-lintnot onPATHfor the integration tests). Confirmed identical on a pristinemainworktree: the failure sets diff clean, and the pass count moves3212 -> 3208, exactly the four parametrized cases in the deleted test file.The four ARN-only properties still report, now under
E1156Valid templates confirmed silent
Both Batch properties, each of these five forms (10 cases), all silent — three of them were
E3511false positives before this change:AWSBatchServiceRole(bare name)E3511/foo/bar(API model's example)E3511/service-role/AWSBatchServiceRoleE3511arn:aws:iam::123456789012:role/AWSBatchServiceRolearn:aws:iam::123456789012:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatchUnresolvable values stay silent on all six properties —
!Ref,!GetAtt,!Sub, and!Ifover a mix of the two.The
good/fixture sweep is byte-identical before and after against the same schema cache (168 findings both).E3511never fired on the good fixtures, so nothing there changes.Both Batch properties still report bad values
Both
anyOfbranches fail, so both formats are reported — expected, and123456789012is AWS's documentation placeholder account.Related
#4926 fixes only the
BatchServiceRolefalse positive, with a path-based exemption insideE3511keyed on the property name. This change removes the rule entirely, so #4926 becomes unnecessary — leaving it open for a maintainer to decide rather than closing it here.pytest -m datawas not run: nothing undersrc/cfnlint/data/is touched.