Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🔐 Proposal: Built-in Secrets Support in Coder#17965

matifali started this conversation inRFCs
Discussion options

💥 Problem

Developers often store sensitive information, such as API keys and tokens, insecurely, using plaintext files or chat communications. This practice leads to poor control, lack of visibility, and no audit trail.

Additionally, as noted in Issue#7087, there is a need for a user-level secrets management system. While third-party solutions like HashiCorp Vault and AWS Secrets Manager offer powerful features, they can be complex due to the management of authentication. A native solution in Coder could simplify this process, balancing security and usability.


✅ Solution

Coder will support built-in secrets with 3 scopes:

  • Account – personal secrets per user
  • Template – shared with all workspaces from a template
  • Organization – shared org-wide across all workspaces

Secrets can be:

  • Set via CLI/API (coder secret set)
  • Injected as environment variables AND/OR accessed at runtime viacoder secret get
  • Audited for reads/updates/deletes

🔧 CLI Examples

# Set a secret from the prompt$ coder secretset MY_API_KEY# Use in script$export OPENAI_KEY=$(coder secret get MY_API_KEY)
# List secrets$ coder secret listNAME              UPDATEDMY_API_KEY        2 days agoVERCEL_TOKEN      10 days ago

🖥️ UI Sneak Peek

Secrets will also be configurable via the web UI (Account, Template, Org):

Account Level Secrets


🔍 Auditing (Premium)

All secret usage (set, get, inject) will be logged with:

  • User, Workspace, Timestamp, Secret Name

Example:

atif accessedSECRET_C indev workspace at 09:00 UTC


💬 Feedback Wanted

  1. Would automatic secret injection help your workflows, or would you prefercoder secret get and script it out?
  2. Do you currently use Codespaces/Gitpod secrets—how’s that experience?
  3. What would your preference be for overwriting secrets when a user, a template, and an organization have a secret with the same name? The current proposal is to follow the preference in order User > Template > Org.

Let us know what you think!

You must be logged in to vote

Replies: 4 comments 16 replies

Comment options

It's not mentioned here, but the addition of a password field type to thecoder_parameter block would also be very useful. In this instance, when a user creates a workspace, they could define a password inline (for example, a VNC password). This would be a seamless method for users to set a password and it could be automatically stored to their personal secret storage.

In our use case, our users don't use thecoder CLI, and having to define a password separately before creating a workspace seems a little "clumsy".

Otherwise, these changes are definitely a move in the right direction.

You must be logged in to vote
6 replies
@michaelbrewer
Comment options

coder_parameter should at least have an option to mask until we have proper secret vaulting.

@matifali
Comment options

matifaliMay 28, 2025
Maintainer Author

@michaelbrewer wouldthis proposal help your use case?

Note: It's only parameters styling and has nothing to do with the Secrets feature.

@michaelbrewer
Comment options

As there is no secrets support in coder. Some templates have parameters used for token, that should not be visible to the container. And not in the insights view

@matifali
Comment options

matifaliMay 29, 2025
Maintainer Author

So, do you expect a parameter of typesecret to set a secret value for the user creating the workspace?

The current proposal has secrets scoped to three levels: Account, Template, and Organization. I have a few questions.

  1. Where do you expect the secret value entered through the parameter during the workspace creation form to be stored? The most natural fit is to place it in Account Secrets, since it's a personal secret, but
  2. Account Secrets are shared among all user-owned workspaces, allowing the value to be reused in subsequent workspace creations. Would you expect that?
  3. I am still aligning with the proposal above (🔐 Proposal: Built-in Secrets Support in Coder #17965 (comment)), where a Template admin can enforce users to set specific secrets.
@matifali
Comment options

matifaliMay 29, 2025
Maintainer Author

Some templates have parameters used for token, that should not be visible to the container.

Does this mean you only want access to them in buildtime (terraform) and not in runtime(container)?

Comment options

Nice.
Is there any plans for also supporting fordevcontainer secrets as a derived of this rfc ?

// devcontainer.json// [...]"secrets": {"JF_TOKEN": {"description":"Jfrog artifactory token used by the post-start script.","documentationUrl":"..."  },"FOO_API_SECRET": {"description":"The required api key to target service foo...""documentationUrl":"..."  }}
You must be logged in to vote
6 replies
@ggjulio
Comment options

Nice!
It's been added to the spec because of codespaces. However it's not codespaces specific.
It's not documented in the official doc but it is still in the spec.

sources:

usage cli

The devcontainer cli takes an option called --secrets-file which just takes a json file of key value pair:

  --secrets-file                    Path to a json file containing secret environment variables as key-value pairs.  [string]

During workspace provision, based on the secret section indevcontainer.json, a coder command
would fetch the specified secrets from coder's DB or external vault and return a json string for the devcontainer cli to use:

// file /path/to/secrets.json{"NAME_OF_SECRET_1":"secret-value1","NAME_OF_SECRET_2":"secret-value2"}

Then simply adding --secrets-file to the up cmd would be enough to inject secrets into the devcontainer:

devcontainer  up [...] \    --secrets-file /path/to/secrets.json

Well it would be a nice UX to validate secrets exists before workspace provision,
but at least it would make devcontainer template truly generic, and avoid templates duplication.

@matifali
Comment options

matifaliMay 22, 2025
Maintainer Author

@bartekgatzcoder@DanielleMaywood for visibility. Regardless of the method we use to inject secrets, let's include support for the devcontainer spec.

cc:@f0ssel

@matifali
Comment options

matifaliMay 26, 2025
Maintainer Author

@ggjulio, what if we injected all account-level secrets into all running dev containers that the user has? This would allow us to implement them so that users would only need to define them in their Account Settings instead of in the dev container.

@ggjulio
Comment options

@matifali depending on which repo we're working on, a user may not want to inject all their secrets in any devcontainer repositories.
Particulary if it's some sensible infra credentials.

But you're right it's seems a good temporary solution for having generic devcontainer templates.

@matifali
Comment options

matifaliMay 26, 2025
Maintainer Author

We can consider opting into what secrets to inject into which workspaces as a future enhancement, but initially, if you have a secret set, it will be injected into your workspaces.

Comment options

Storing of secrets should be permitted by administrator on each scope

You must be logged in to vote
2 replies
@mthemis-provenir
Comment options

Related, but administrators shouldnot be able to retrieve the values of user entered secrets.

@matifali
Comment options

matifaliMay 22, 2025
Maintainer Author

An organization admin can set organization secrets.
A template admin can set template secrets.

I understand that there could be a case where an admin would like to set secrets for headless users (who can not log in). But an admin having access to the token of such a user should be able to set secrets for that user usingCODER_SESSION_TOKEN="headless user token" coder secret set MY_SECRET

Comment options

In our use-case we use Coder as a "Terraform backend" to manage user's OpenStack infrastructure via API. Since the infra can exist longer than the validity of a token, we send OpenStack credentials as Coder parameters to build the infrastructure. As mentioned by mthemis-provenir, having password-type parameter would be definitely very useful. Having the option to set a secret in the user scope might be even better for our use case.

My question is how would this work in the template? Are we going to have coder_secret as data source and this would be injected to the provider for example? Could this secret take a wholekubeconfig file and enable kubernetes management via Coder too?

You must be logged in to vote
2 replies
@matifali
Comment options

matifaliMay 26, 2025
Maintainer Author

Hi, the current plan is to only handle runtime secrets(available inside the workspace) and no build-time secrets. (No access to secrets in Terraform).

Supporting build-time secrets is out of scope for this work. If necessary, you can use an alternative secret provider to fetch and use secrets during the workspace builds.
We have a few examples withHashicorp Vault.

@phorcys420
Comment options

In our use-case we use Coder as a "Terraform backend" to manage user's OpenStack infrastructure via API. Since the infra can exist longer than the validity of a token, we send OpenStack credentials as Coder parameters to build the infrastructure. As mentioned by mthemis-provenir, having password-type parameter would be definitely very useful. Having the option to set a secret in the user scope might be even better for our use case.

As Atif mentioned this is currently out of scope for our secrets implementation.
Though, you should be able to use Coder's External Auth to authenticate to the provider OpenShift/K8S provider via OIDC and fix this refreshing issue.

We had a similar issue regarding OpenStack in the Discord (not solved yet) but it can be helpful:https://discord.com/channels/747933592273027093/1348645684760547348

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
RFCs
Labels
None yet
7 participants
@matifali@michaelbrewer@ggjulio@andrejcermak@phorcys420@MrPeacockNLB@mthemis-provenir

[8]ページ先頭

©2009-2025 Movatter.jp