Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Nov 17, 2023

Conversation

joshfried-aws
Copy link
Contributor

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

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
8 checks passed
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.

None yet

3 participants