From 02b5ae42f1669e71c21ff4aef0eadebf942f422e Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 22 May 2025 19:32:42 +0000 Subject: [PATCH] fix(windows-rdp): properly escape username and password in patch file (#xxx) - Updated the `patch_file_contents` to use `jsonencode` for `CODER_USERNAME` and `CODER_PASSWORD` to preserve special characters. --- registry/coder/modules/windows-rdp/main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/registry/coder/modules/windows-rdp/main.tf b/registry/coder/modules/windows-rdp/main.tf index 10ece09c..8818356e 100644 --- a/registry/coder/modules/windows-rdp/main.tf +++ b/registry/coder/modules/windows-rdp/main.tf @@ -52,8 +52,9 @@ resource "coder_script" "windows-rdp" { # doesn't allow recursive calls to the templatefile function. Have to feed # results of the JS template replace into the powershell template patch_file_contents = templatefile("${path.module}/devolutions-patch.js", { - CODER_USERNAME = var.admin_username - CODER_PASSWORD = var.admin_password + # Properly escape the username and password to preserve special characters + CODER_USERNAME = jsonencode(var.admin_username) + CODER_PASSWORD = jsonencode(var.admin_password) }) })