Skip to content

Proposal: First class support for secrets #219

Closed
@eljog

Description

@eljog

What are secrets

Secrets are variables where it's values are sensitive and needs to be handled securely at all times (API keys, passwords etc.). Users can change a secret's value at anytime, and the CLI should support dynamically changing secrets without having to rebuild the container.

Goal

Support Secrets as a first class feature in devcontainers CLI.

This feature should comprise of the ability to securely pass in the secrets in CLI commands, make them available for users to consume similar to remoteEnv and containerEnv, and be processed and handled securely at all times.
This functionality will allow consumers including Codespaces to be able to use secrets more predictably and securely with devcontainers CLI.

Motivation

Today Codespaces pass secret variables as remoteEnv since there are no other mechanisms to pass them explicitly as secrets. The devcontainers CLI do not (and need not) treat remoteEnv as secrets, which recently has resulted in high severity security incidents. Having explicit support for secrets will help avoiding such situations and in improving customer confidence.

Proposal

Following are the three main functional changes to the CLI to support this feature.

  1. Ability to pass secrets to commands
  2. Apply/use secrets similar to remoteEnv
  3. Securely handle secrets

Passing secrets to commands

Secrets are not part of devcontainers specification and we do not expect users to store secrets inside devcontainer.json file.

Secrets should be passed to the following devcontainers CLI commands.

  • up
  • run-user-commands
  • read-configuration

Best way to pass secrets would be through a json/env file, where in the file path is supplied in a command line argument --secrets-file

up, run-user-commands will use the secrets for usecases like lifecycle hooks (similar to remoteEnv). read-configuration will need to apply secrets during variable expansion.

Using secrets in the CLI

Today Codespaces as a consumer is leveraging remoteEnv to pass secrets into the CLI. So it is a basic requirement that secrets should be used and behave the same way as remoteEnv do.

Securely handle secrets

Secrets should be handled securely at all times.

  • Secrets should not be passed as plain text in command line
  • Do not be persist secrets on the container labels or long lived permanent caches
  • Redact secrets to prevent them being written in plain text into logs and console output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalStill under discussion, collecting feedback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions