Skip to content

[Bugfix]: Loader can panic when handling nested maps - #415

Merged
joshfried-aws merged 3 commits into
aws-cloudformation:mainfrom
joshfried-aws:loader_bug
Nov 17, 2023
Merged

joshfried-aws merged 3 commits into
aws-cloudformation:mainfrom
joshfried-aws:loader_bug

Conversation

@joshfried-aws

@joshfried-aws joshfried-aws commented Nov 17, 2023 •

Copy link
Copy Markdown
Contributor

Issue #, if available:
N/A

Description of changes:
There's an issue in cfn-guard where some nested maps can cause the loader to crash. This bug has been addressed in this PR and added a test case to verify this issue will not persist.

Currently when we drain our stack for all the items, we assumed they'd all be string types (keys). This means we would only handle the case where the type was of string, and then we created an unreachable block. This is not true in the case of yaml that contains nested JSON/curly brace maps. To fix this we add a check to see if we have a map type, and if that is the case we just skip this iteration.


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

@joshfried-aws joshfried-aws changed the title Loader bug Loader bug for nested maps Nov 17, 2023
@joshfried-aws joshfried-aws changed the title Loader bug for nested maps [Bugfix]: Loader panicking sometimes when encountering nested maps Nov 17, 2023
@joshfried-aws joshfried-aws changed the title [Bugfix]: Loader panicking sometimes when encountering nested maps [Bugfix]: Loader can panic when handling nested maps Nov 17, 2023
@razcloud
razcloud self-requested a review November 17, 2023 04:33
@joshfried-aws
joshfried-aws merged commit 41adec0 into aws-cloudformation:main Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants