octocatalog-diff icon indicating copy to clipboard operation
octocatalog-diff copied to clipboard

fix ENC 'echo' script template to prevent expansion

Open elfchief opened this issue 4 years ago • 1 comments

Overview

This pull request changes functionality (bugfix)

Currently the template script for creating the 'echo' script used for ENC data wraps the data provided by the actual ENC in cat <<-EOF, which causes the enclosed data to be variable-expanded, escape characters (like double backslashes) to be replaced with their concrete representations, etc.

This breaks things horribly if you have (e.g.) JSON data with escaped strings ("C:\\Windows"), which will be processed and output without those escapes ("C:\Windows"), which is invalid, and definitely not what the user intended under any circumstance.

Using the 'quoted' variant of shell heredocs (cat <<-'EOF') stops this expansion/replacement from happening, ensuring that the output from the echo script is identical to the output of the original ENC script.

Checklist

[x] Make sure that all of the tests pass, and fix any that don't. [x] Make sure that there is 100% [n/a] If you have added a new command line option, add corresponding integration test [n/a] If you have added any new gem dependencies, verify MIT or Apache 20 license [n/a] If you have added any new gem dependencies, check in .gem file

elfchief avatar Jul 01 '21 22:07 elfchief

Huh. For whatever reason, the test failing here was not failing when run locally (I'm assuming this was my error in some way, because the test obviously should have failed).

I'll push a fix for the test in the morning.

elfchief avatar Jul 01 '21 23:07 elfchief