Skip to content

Commit cc2510a

Browse files
authored
fix: use fully qualified paths to prevent shell injection (#93)
This just adds additional security as we require these files to be in the system
1 parent 0cd795d commit cc2510a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/terraform-docs.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export function installTerraformDocs(terraformDocsVersion: string): void {
4444
const platform = process.platform;
4545
const goArch = getGoArch(process.arch);
4646

47-
execFileSync('curl', [
47+
execFileSync('/usr/bin/curl', [
4848
'-sSLo',
4949
'./terraform-docs.tar.gz',
5050
`https://terraform-docs.io/dl/${terraformDocsVersion}/terraform-docs-${terraformDocsVersion}-${platform}-${goArch}.tar.gz`,
5151
]);
5252

53-
execFileSync('tar', ['-xzf', 'terraform-docs.tar.gz']);
54-
execFileSync('chmod', ['+x', 'terraform-docs']);
55-
execFileSync('sudo', ['mv', 'terraform-docs', '/usr/local/bin/terraform-docs']); // Alternatively, use custom non elevated path
53+
execFileSync('/usr/bin/tar', ['-xzf', 'terraform-docs.tar.gz']);
54+
execFileSync('/usr/bin/chmod', ['+x', 'terraform-docs']);
55+
execFileSync('/usr/bin/sudo', ['mv', 'terraform-docs', '/usr/local/bin/terraform-docs']); // Alternatively, use custom non elevated path
5656
execFileSync('/usr/local/bin/terraform-docs', ['--version'], { stdio: 'inherit' });
5757
endGroup();
5858
}

0 commit comments

Comments
 (0)