Repository navigation
Conversation
This was referenced Nov 1, 2026
kddejong
approved these changes
Nov 3, 2026
kddejong
approved these changes
Nov 3, 2026
AwsPrincipalArn in the IAM policy schema and TrustAwsPrincipalArn in the trust policy schema allowed only aws, aws-cn and aws-us-gov, so a principal such as arn:aws-eusc:iam::123456789012:root was reported by E3530 in trust policies and by E3512 and E3513 in resource policies. Use the aws* partition group the AwsArn definition in the IAM policy schema already uses. Signed-off-by: Brenden Hogan <hoganbr@amazon.com>
kddejong
force-pushed
the
fix/iam-principal-arn-partitions
branch
from
November 3, 2026 19:28
6c4ba00 to
6a91e86
Compare
kddejong
approved these changes
Nov 3, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4976 +/- ##
=======================================
Coverage 94.74% 94.74%
=======================================
Files 441 441
Lines 16142 16142
Branches 3140 3140
=======================================
Hits 15293 15293
Misses 469 469
Partials 380 380
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:
|
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.
Issue #, if available: Fixes #4975
Description of changes:
The principal ARN patterns allow only the
aws,aws-cnandaws-us-govpartitions:AwsPrincipalArnindata/schemas/other/iam/policy.json, andTrustAwsPrincipalArnindata/schemas/other/iam/policy_trust.json.AwsArninpolicy.jsonaccepts anyaws*partition. A principal from any other partition is rejected:reports E3530 on
main. The same principal reports E3512 in anAWS::S3::BucketPolicyand E3513 in anAWS::ECR::RepositoryRepositoryPolicyText.The principal patterns in both definitions (
iam::<account>:...,sts::<account>:assumed-role|root|federated-user,iam::cloudfront:user/) now use theaws[A-Za-z\-]*?partition group fromAwsArn. They leave outAwsArn's*alternative, which is not a valid principal partition. Only the partition group changes; the rest of each pattern, including the trust schema's exclusion ofgroupARNs, is unchanged.Reach.
TrustAwsPrincipalArnis used only by the trust policy schema'sPrincipal(E3530).AwsPrincipalArnis used only by thePrincipaldefinition inpolicy.json. A statement'sPrincipalandNotPrincipalboth reference that definition, and so do the resource (E3512) and ECR repository (E3513) policy schemas.Principal, so it is unaffected.The patterns only accept more values, so the change can only remove findings.
Verification.
test_valid_trust_policy_every_partition(E3530) checks root, role, andstsassumed-role, root and federated-user principals in every partition.test_principal_every_partition(E3512) checks a bucket policy withaws-euscroot, role and assumed-role principals. Both fail onmain.test_invalid_trust_policy_non_aws_partitionchecks thatarn:azure:iam::123456789012:rootis still rejected.cfn-lint --format parseable --regions <region> -t "test/fixtures/templates/good/**/*.yaml" "test/fixtures/templates/good/**/*.json"): same output asmain, apart from the pattern text quoted in an E3530 message thatgood/functions/sub_needed_custom_excludes.yamlalready gets onmain.pytest testandpre-commit run --all-filespass.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.