From 345c8a7310f91296f5a9ffdf6ff94cd1c1b3b4ad Mon Sep 17 00:00:00 2001 From: ash Date: Sat, 7 Sep 2024 14:39:07 +0100 Subject: [PATCH] =?UTF-8?q?nixos/dokuwiki:=20don=E2=80=99t=20use=20`lib.es?= =?UTF-8?q?capeShellArg`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHP strings don't obey shell quoting rules. See #333744. --- nixos/modules/services/web-apps/dokuwiki.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/web-apps/dokuwiki.nix b/nixos/modules/services/web-apps/dokuwiki.nix index c5ea809c8d59..328a9a74a921 100644 --- a/nixos/modules/services/web-apps/dokuwiki.nix +++ b/nixos/modules/services/web-apps/dokuwiki.nix @@ -43,12 +43,12 @@ let mkPhpValue = v: let isHasAttr = s: isAttrs v && hasAttr s v; in - if isString v then escapeShellArg v + if isString v then "'${escape [ "'" "\\" ] v}'" # NOTE: If any value contains a , (comma) this will not get escaped - else if isList v && any lib.strings.isCoercibleToString v then escapeShellArg (concatMapStringsSep "," toString v) + else if isList v && any lib.strings.isCoercibleToString v then "'${escape [ "'" "\\" ] (concatMapStringsSep "," toString v)}'" else if isInt v then toString v else if isBool v then toString (if v then 1 else 0) - else if isHasAttr "_file" then "trim(file_get_contents(${lib.escapeShellArg v._file}))" + else if isHasAttr "_file" then "trim(file_get_contents('${escape [ "'" "\\" ] v._file}'))" else if isHasAttr "_raw" then v._raw else abort "The dokuwiki localConf value ${lib.generators.toPretty {} v} can not be encoded." ; @@ -59,7 +59,7 @@ let [" = ${mkPhpValue v};"] else mkPhpAttrVals v; - in map (e: "[${escapeShellArg k}]${e}") (flatten values); + in map (e: "['${escape [ "'" "\\" ] k}']${e}") (flatten values); dokuwikiLocalConfig = hostName: cfg: let conf_gen = c: map (v: "$conf${v}") (mkPhpAttrVals c);