Skip to content

Commit aa6e2e3

Browse files
Don't concatenate the string arguments.
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 3903d83 commit aa6e2e3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/gcp_auth.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ export class GoogleCloudPlatformAuth implements Authenticator {
6666
if (!cmd) {
6767
throw new Error('Token is expired!');
6868
}
69-
// Wrap cmd in quotes to make it cope with spaces in path
70-
cmd = `"${cmd}"`;
71-
const args = config['cmd-args'];
72-
if (args) {
73-
cmd = cmd + ' ' + args;
74-
}
69+
const cmdPath = config['cmd-path'];
70+
const args = config['cmd-args'] ? config['cmd-args'].split(' ') : [];
7571
// TODO: Cache to file?
7672
// TODO: do this asynchronously
7773
let output: any;
7874
try {
79-
output = proc.execSync(cmd);
75+
output = proc.execFileSync(cmdPath, args);
8076
} catch (err) {
8177
throw new Error('Failed to refresh token: ' + (err as Error).message);
8278
}

0 commit comments

Comments
 (0)