aws-cloudformation / cloudformation-guard

Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules. Take this survey to provide feedback about cfn-guard: https://amazonmr.au1.qualtrics.com/jfe/form/SV_bpyzpfoYGGuuUl0
Apache License 2.0
1.3k stars 180 forks source link

fix(cfn-guard): canonicalize creates invalid json [DO NOT MERGE / REVIEW RUNNING AGAINST CI] #540

Closed dannyvassallo closed 3 months ago

dannyvassallo commented 4 months ago

Issue #, if available: 536

The issue appears to be with paths. I encountered something similar in the TS lib but massaged the data in there as I assumed it was an issue with those changes and not guard itself.

Description of changes:

Use an OSString instead of a canonicalized PathBuf converted to a string. It generated invalid characters for JSON and SARIF.

https://github.com/rust-lang/rust/issues/81045#issuecomment-761076607

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

joshfried-aws commented 4 months ago

Should we update the massaging in the TS lib once we change this?