Skip to content

Commit

Permalink
Make sure resource types are strings before assuming (#3025)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong committed Apr 25, 2024
1 parent 8bd4f6f commit 545d6cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cfnlint/rules/resources/PrimaryIdentifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def _validate_resource_type_uniqueness(self, cfn, resource_type, ids):
def match(self, cfn):
tS = set()
for _, resource_properties in cfn.get_resources().items():
tS.add(resource_properties.get("Type"))
t = resource_properties.get("Type")
if isinstance(t, str):
tS.add(t)

matches = []
for t in tS:
Expand Down
2 changes: 1 addition & 1 deletion src/cfnlint/rules/resources/properties/Properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def cfnresourceproperties(self, validator: Validator, _, instance: Any, schema):
)

t = instance.get("Type")
if not t:
if not validator.is_type(t, "string"):
return

if t.startswith("Custom::"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ Resources:
- IsUsEast1
- us-east-1
- !Ref 'AWS::NoValue'
BadType:
Type: !Ref AWS::Region

0 comments on commit 545d6cd

Please sign in to comment.