Sanitize output when writing to redsocks.conf

Properties with values including quotes (`"`) would not get sanitized
and written verbatim on the config file, causing redsocks to fail.

Closes: #2072
This commit is contained in:
Felipe Lalanne 2022-12-07 18:36:25 +00:00
parent 0605e996c9
commit 77cd15f131

View File

@ -117,7 +117,8 @@ function generateRedsocksConfEntries(conf: ProxyConfig): string {
let v = conf[field];
if (v != null) {
if (isAuthField(field)) {
v = `"${v}"`;
// Escape any quotes in the field value
v = `"${v.toString().replace(/"/g, '\\"')}"`;
}
val += `\t${field} = ${v};\n`;
}