Skip to content

SSH config cannot use SetEnv without multiple problems #559

@deansheather

Description

@deansheather
  1. The only way to set an env is to use SetEnv=MY_VAR=value. If you use SetEnv MY_VAR=true, the env var gets added to the config incorrectly and SSH fails to load because of bad splitting:

    vscode-coder/src/remote.ts

    Lines 716 to 733 in 2d7dac8

    const userConfig = userConfigSSH.reduce(
    (acc, line) => {
    let i = line.indexOf("=");
    if (i === -1) {
    i = line.indexOf(" ");
    if (i === -1) {
    // This line is malformed. The setting is incorrect, and does not match
    // the pattern regex in the settings schema.
    return acc;
    }
    }
    const key = line.slice(0, i);
    const value = line.slice(i + 1);
    acc[key] = value;
    return acc;
    },
    {} as Record<string, string>,
    );

  2. Setting any SetEnv variables causes the default SetEnv CODER_SSH_SESSION_TYPE=vscode to be removed. This is because we use a map to store the key/value pairs.

  3. You cannot have multiple SetEnv config lines, only one will be processed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions