Skip to content

Commit 8e33d30

Browse files
address comment
1 parent 98b5a31 commit 8e33d30

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/utils/install.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,6 @@ async function installLocalWindows(temporaryDirname: string) {
522522
await move(`${temporaryDirname}/localstack`, LOCAL_CLI_INSTALLATION_DIRNAME);
523523
await exec(`setx PATH "%PATH%;${LOCAL_CLI_INSTALLATION_DIRNAME}"`);
524524

525-
// Update PATH for the current VSCode process so LocalStack is immediately available
526-
// (setx only updates for new processes, including future VSCode instances)
527-
process.env.PATH = `${process.env.PATH};${LOCAL_CLI_INSTALLATION_DIRNAME}`;
528-
529525
window.showInformationMessage("LocalStack CLI installed for current user.");
530526
}
531527

src/utils/prompts.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ async function tryPkexec(
7979
async function spawnWithSudoPassword(
8080
options: SpawnElevatedLinuxOptions,
8181
): Promise<{ cancelled: boolean }> {
82+
// Security note: This approach is less secure than pkexec because:
83+
// - Password flows through VS Code → Node.js → child process stdin (more attack surface)
84+
// - Password briefly exists in application memory (vulnerable to memory dumps)
85+
// - Potential attack vector: A malicious VS Code extension could theoretically intercept
86+
// the password by hooking into Node.js I/O streams or reading process memory
87+
// (though VS Code's extension sandbox provides some isolation)
88+
//
89+
// However, this is acceptable because:
90+
// - We only use this when pkexec is unavailable (systems without desktop environment)
91+
// - Password is masked in input, never logged, and passed via stdin only
92+
// - Password is not stored/cached and is disposed immediately
93+
// - This is a one-time installation operation, not continuous privileged access
94+
//
95+
// Alternative: complete installation failure on systems without polkit agents
8296
const password = await vscode.window.showInputBox({
8397
prompt: "Enter your sudo password",
8498
password: true,
@@ -108,6 +122,11 @@ async function spawnWithSudoPassword(
108122
});
109123

110124
// Write password to stdin and close it
125+
// Note: We use stdin rather than command-line arguments because:
126+
// - Command-line args are visible in process listings (eg ps aux)
127+
// - stdin prevents the password from appearing in logs or shell history
128+
// - stdin data is not visible to other users on the system
129+
// However, the password still exists briefly in our process memory and the pipe buffer
111130
child.stdin.write(`${password}\n`);
112131
child.stdin.end();
113132

0 commit comments

Comments
 (0)