-
Notifications
You must be signed in to change notification settings - Fork 35
feat: use environment variables for CLI auth instead of file flags #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -479,6 +479,8 @@ export class Remote { | |
| binaryPath, | ||
| logDir, | ||
| featureSet, | ||
| baseUrlRaw, | ||
| token, | ||
| ); | ||
| } catch (error) { | ||
| this.logger.warn("Failed to configure SSH", error); | ||
|
|
@@ -597,6 +599,8 @@ export class Remote { | |
| binaryPath: string, | ||
| logDir: string, | ||
| featureSet: FeatureSet, | ||
| url: string, | ||
| token: string, | ||
| ) { | ||
| let deploymentSSHConfig = {}; | ||
| try { | ||
|
|
@@ -677,9 +681,7 @@ export class Remote { | |
| ? `${escapeCommandArg(binaryPath)}${globalConfigs} ssh --stdio --usage-app=vscode --disable-autostart --network-info-dir ${escapeCommandArg(this.pathResolver.getNetworkInfoPath())}${await this.formatLogArg(logDir)} --ssh-host-prefix ${hostPrefix} %h` | ||
| : `${escapeCommandArg(binaryPath)}${globalConfigs} vscodessh --network-info-dir ${escapeCommandArg( | ||
| this.pathResolver.getNetworkInfoPath(), | ||
| )}${await this.formatLogArg(logDir)} --session-token-file ${escapeCommandArg(this.pathResolver.getSessionTokenPath(label))} --url-file ${escapeCommandArg( | ||
| this.pathResolver.getUrlPath(label), | ||
| )} %h`; | ||
| )}${await this.formatLogArg(logDir)} %h`; | ||
|
|
||
| const sshValues: SSHValues = { | ||
| Host: hostPrefix + `*`, | ||
|
|
@@ -690,9 +692,9 @@ export class Remote { | |
| LogLevel: "ERROR", | ||
| }; | ||
| if (sshSupportsSetEnv()) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this just fail if the SSH does not support |
||
| // This allows for tracking the number of extension | ||
| // users connected to workspaces! | ||
| sshValues.SetEnv = " CODER_SSH_SESSION_TYPE=vscode"; | ||
| // Pass Coder URL, session token, and session type via environment. | ||
| // The CLI reads CODER_URL and CODER_SESSION_TOKEN from the environment. | ||
| sshValues.SetEnv = ` CODER_URL=${url} CODER_SESSION_TOKEN=${token} CODER_SSH_SESSION_TYPE=vscode`; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we still have the token in plaintext but it's now in |
||
| } | ||
|
|
||
| await sshConfig.update(label, sshValues, sshConfigOverrides); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the session token and URL file from being passed to
vscodesshwhich is the old client that I think is only used by some older servers (< 2.19.0)