From b06e1b73fa80379accc1168970a6584451bdadfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Dallidet?= Date: Wed, 9 Aug 2023 15:06:38 +0200 Subject: [PATCH] Fixes #23246: Rudderc does not escape correctly the double quotes in componentKey in windows techniques --- policies/rudderc/templates/technique.ps1.askama | 2 +- policies/rudderc/tests/cases/general/escaping/technique.ps1 | 2 +- policies/rudderc/tests/cases/general/ntp/technique.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/policies/rudderc/templates/technique.ps1.askama b/policies/rudderc/templates/technique.ps1.askama index 93d2f78d012..79c59b85515 100644 --- a/policies/rudderc/templates/technique.ps1.askama +++ b/policies/rudderc/templates/technique.ps1.askama @@ -27,7 +27,7 @@ function {{ id|dsc_case }} { {% for m in methods %} $reportId=$reportIdBase + "{{ m.id }}" - $componentKey = "{{ m.component_key }}" + $componentKey = "{{ m.component_key|escape_double_quotes }}" $reportParams = @{ ClassPrefix = ([Rudder.Condition]::canonify(("{{ m.class_prefix }}_" + $componentKey))) ComponentKey = $componentKey diff --git a/policies/rudderc/tests/cases/general/escaping/technique.ps1 b/policies/rudderc/tests/cases/general/escaping/technique.ps1 index c52c26e7efc..9a270d9cd03 100644 --- a/policies/rudderc/tests/cases/general/escaping/technique.ps1 +++ b/policies/rudderc/tests/cases/general/escaping/technique.ps1 @@ -22,7 +22,7 @@ $reportId=$reportIdBase + "a86ce2e5-d5b6-45cc-87e8-c11cca71d966" - $componentKey = "${sys.host} . | / ${sys.${host}} ' '' ''' $ $$ " "" \ \\😋aà3" + $componentKey = "${sys.host} . | / ${sys.${host}} ' '' ''' $ $$ `" `"`" \ \\😋aà3" $reportParams = @{ ClassPrefix = ([Rudder.Condition]::canonify(("package_present_" + $componentKey))) ComponentKey = $componentKey diff --git a/policies/rudderc/tests/cases/general/ntp/technique.ps1 b/policies/rudderc/tests/cases/general/ntp/technique.ps1 index 9e53160ca32..a2c13974b21 100644 --- a/policies/rudderc/tests/cases/general/ntp/technique.ps1 +++ b/policies/rudderc/tests/cases/general/ntp/technique.ps1 @@ -54,7 +54,7 @@ } $reportId=$reportIdBase + "cf06e919-02b7-41a7-a03f-4239592f3c12" - $componentKey = "/bin/true "# ${node.inventory[os][fullName]}"" + $componentKey = "/bin/true `"# ${node.inventory[os][fullName]}`"" $reportParams = @{ ClassPrefix = ([Rudder.Condition]::canonify(("package_install_" + $componentKey))) ComponentKey = $componentKey