Fixed load_samples to wrap variables in quotes to prevent YAML parsing errors #5858
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.
Description Of Changes
Unfortunately the variable expansion logic in the
FIDES__DATABASE__LOAD_SAMPLES
handling can result in loading a character like&
, which YAML parsing then tries to interpret as an anchor, and then it fails to load the sample data.Fides' startup routine is resilient to that failure, it just continues starting up but aborts loading the rest of the sample data, which is a subtle footgun and caught us in a test environment recently!
This addresses this by wrapping all the variables we load from the template connections in quotes, and adds some tests to exercise that.
Code Changes
Steps to Confirm
FIDES__DATABASE__LOAD_SAMPLES=1
and insert ENV variables likeFIDES_DEPLOY__CONNECTORS__POSTGRES__HOST=&123
and confirm that YAML errors do not occurPre-Merge Checklist
CHANGELOG.md
updatedmain
downgrade()
migration is correct and works