Skip to content

Commit 48d3ed7

Browse files
committed
🔧 fix(matrix-synapse): refactor MAS argument handling to use escapeShellArgs
1 parent 9e6d2a7 commit 48d3ed7

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

‎vms/matrix-synapse.nix‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,20 @@
183183
script =
184184
let
185185
authCfg = config.sys.services.matrix-synapse.authDelegation;
186-
masArgs = lib.optionalString authCfg.enable ''
187-
--rawfile client_secret ${config.sops.secrets."matrix-authentication-service/client_secret".path} \
188-
--rawfile admin_token ${config.sops.secrets."matrix-authentication-service/synapse_secret".path} \
189-
--arg issuer "${authCfg.issuer}" \
190-
--arg client_id "${authCfg.clientId}" \
191-
--arg client_auth_method "${authCfg.clientAuthMethod}" \
192-
${lib.optionalString (
193-
authCfg.accountManagementUrl != null
194-
) ''--arg account_url "${authCfg.accountManagementUrl}" \''}
195-
'';
186+
masArgs = lib.escapeShellArgs (
187+
lib.optionals authCfg.enable (
188+
[
189+
"--rawfile" "client_secret" config.sops.secrets."matrix-authentication-service/client_secret".path
190+
"--rawfile" "admin_token" config.sops.secrets."matrix-authentication-service/synapse_secret".path
191+
"--arg" "issuer" authCfg.issuer
192+
"--arg" "client_id" authCfg.clientId
193+
"--arg" "client_auth_method" authCfg.clientAuthMethod
194+
]
195+
++ lib.optionals (authCfg.accountManagementUrl != null) [
196+
"--arg" "account_url" authCfg.accountManagementUrl
197+
]
198+
)
199+
);
196200
masJqExpr = lib.optionalString authCfg.enable ''
197201
* {
198202
experimental_features: {
@@ -219,7 +223,7 @@
219223
--rawfile smtp ${config.sops.secrets."protonmail/smtp_token".path} \
220224
--arg notif_from "Matrix <matrix@${VARS.domains.public}>" \
221225
--arg smtp_user "matrix@${VARS.domains.public}" \
222-
${masArgs}
226+
${masArgs} \
223227
'{
224228
registration_shared_secret: ($secret | rtrimstr("\n")),
225229
email: {

0 commit comments

Comments
 (0)