refactor: no need to print safe args as it's already sanitized

This commit is contained in:
Nicolas Meienberger
2025-12-06 10:06:03 +01:00
parent b8ae10b316
commit 51ed47c30f

View File

@@ -37,8 +37,9 @@ const mount = async (config: BackendConfig, path: string) => {
const password = await cryptoUtils.decrypt(config.password); const password = await cryptoUtils.decrypt(config.password);
const source = `//${config.server}/${config.share}`; const source = `//${config.server}/${config.share}`;
const baseOptions = [ const options = [
`user=${config.username}`, `user=${config.username}`,
`pass=${password}`,
`vers=${config.vers}`, `vers=${config.vers}`,
`port=${config.port}`, `port=${config.port}`,
"uid=1000", "uid=1000",
@@ -46,22 +47,18 @@ const mount = async (config: BackendConfig, path: string) => {
]; ];
if (config.domain) { if (config.domain) {
baseOptions.push(`domain=${config.domain}`); options.push(`domain=${config.domain}`);
} }
if (config.readOnly) { if (config.readOnly) {
baseOptions.push("ro"); options.push("ro");
} }
const baseArgs = ["-t", "cifs", "-o"]; const args = ["-t", "cifs", "-o", options.join(","), source, path];
logger.debug(`Mounting SMB volume ${path}...`); logger.debug(`Mounting SMB volume ${path}...`);
const safeOptions = [...baseOptions, "pass=***"]; logger.info(`Executing mount: mount ${args.join(" ")}`);
const safeArgs = [...baseArgs, safeOptions.join(","), source, path];
logger.info(`Executing mount: mount ${safeArgs.join(" ")}`);
const options = [...baseOptions, `pass=${password}`];
const args = [...baseArgs, options.join(","), source, path];
await executeMount(args); await executeMount(args);
logger.info(`SMB volume at ${path} mounted successfully.`); logger.info(`SMB volume at ${path} mounted successfully.`);