summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-08-31 08:36:58 -0400
committerMichael Meeks <michael.meeks@collabora.com>2021-09-07 10:23:15 +0100
commit8f4316b45b1aad7a041e8b02d92e5ef10d63b2b3 (patch)
tree87e83dc8893066b2e061accc9096ea2e26efd975
parentleaflet: makeWsUrl (diff)
downloadonline-8f4316b45b1aad7a041e8b02d92e5ef10d63b2b3.tar.gz
online-8f4316b45b1aad7a041e8b02d92e5ef10d63b2b3.zip
wsd: configuration setting to control embedded-url hexifying
Change-Id: I7ed65af7341aa7dec3c9ad8d5cd503c34c355571 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
-rw-r--r--loolwsd.xml.in1
-rw-r--r--wsd/FileServer.cpp5
-rw-r--r--wsd/LOOLWSD.cpp1
3 files changed, 6 insertions, 1 deletions
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 693d9ef635..fa7ce1eae2 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -15,6 +15,7 @@
<server_name desc="External hostname:port of the server running loolwsd. If empty, it's derived from the request (please set it if this doesn't work). Must be specified when behind a reverse-proxy or when the hostname is not reachable directly." type="string" default=""></server_name>
<file_server_root_path desc="Path to the directory that should be considered root for the file server. This should be the directory containing loleaflet." type="path" relative="true" default="loleaflet/../"></file_server_root_path>
+ <hexify_embedded_urls desc="Enable to protect encoded URLs from getting decoded by intermediate hops. Particularly useful on Azure deployments" type="bool" default="false"></hexify_embedded_urls>
<memproportion desc="The maximum percentage of system memory consumed by all of the @APP_NAME@, after which we start cleaning up idle documents" type="double" default="80.0"></memproportion>
<num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 93624ba6e1..595bb50cec 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -722,7 +722,6 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN_TTL%"), std::to_string(tokenTtl));
Poco::replaceInPlace(preprocess, std::string("%ACCESS_HEADER%"), escapedAccessHeader);
Poco::replaceInPlace(preprocess, std::string("%HOST%"), cnxDetails.getWebSocketUrl());
- Poco::replaceInPlace(preprocess, std::string("%HEXIFY_URL%"), std::string("false"));
Poco::replaceInPlace(preprocess, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
Poco::replaceInPlace(preprocess, std::string("%SERVICE_ROOT%"), responseRoot);
Poco::replaceInPlace(preprocess, std::string("%UI_DEFAULTS%"), uiDefaultsToJSON(uiDefaults, userInterfaceMode));
@@ -733,6 +732,10 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
protocolDebug = "true";
Poco::replaceInPlace(preprocess, std::string("%PROTOCOL_DEBUG%"), protocolDebug);
+ static const std::string hexifyEmbeddedUrls =
+ LOOLWSD::getConfigValue<bool>("hexify_embedded_urls", false) ? "true" : "false";
+ Poco::replaceInPlace(preprocess, std::string("%HEXIFY_URL%"), hexifyEmbeddedUrls);
+
static const std::string linkCSS("<link rel=\"stylesheet\" href=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.css\">");
static const std::string scriptJS("<script src=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index c41a7248dc..fe5c10b76a 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -945,6 +945,7 @@ void LOOLWSD::initialize(Application& self)
{ "admin_console.enable_pam", "false" },
{ "child_root_path", "jails" },
{ "file_server_root_path", "loleaflet/.." },
+ { "hexify_embedded_urls", "false" },
{ "lo_jail_subpath", "lo" },
{ "logging.protocol", "false" },
{ "logging.anonymize.filenames", "false" }, // Deprecated.