Skip to content

Commit 61870ae

Browse files
fix replaceSecretPlaceholder (#4104)
Disable secret substitution only for cors=allowAll, the last attempt in #4102 was to restrictive. Secret substitution should also work if cors=disabled. --------- Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
1 parent 39578d6 commit 61870ae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

js/server_functions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ function getStartup (req, res) {
2222
* @returns {string} the input with real variable content
2323
*/
2424
function replaceSecretPlaceholder (input) {
25-
if (global.config.cors === "allowWhitelist") {
25+
if (global.config.cors !== "allowAll") {
2626
return input.replaceAll(/\*\*(SECRET_[^*]+)\*\*/g, (match, group) => {
2727
return process.env[group];
2828
});
2929
} else {
30-
Log.error("Replacing secrets works only with CORS and `allowWhitelist`, you need to set this in `config.js`, set `cors: allowWhitelist`");
30+
if (input.includes("**SECRET_")) {
31+
Log.error("Replacing secrets doesn't work with CORS `allowAll`, you need to set `cors` to `disabled` or `allowWhitelist` in `config.js`");
32+
}
3133
return input;
3234
}
3335
}

0 commit comments

Comments
 (0)