Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add bulk secret import upload to Add secret dialog (PLAT-240) - #26725

Merged
dylanhuff-at-coder merged 10 commits into
mainfrom
dylan/plat-240-secrets-import-frontend
Jul 28, 2026
Merged

feat: add bulk secret import upload to Add secret dialog (PLAT-240)#26725
dylanhuff-at-coder merged 10 commits into
mainfrom
dylan/plat-240-secrets-import-frontend

Conversation

@dylanhuff-at-coder

@dylanhuff-at-coder dylanhuff-at-coder commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Adds a file dropzone to the create branch of the Add secret dialog (final PR in the PLAT-240 stack, after #26723 and #26724). The browser reads the file, derives the format from the extension (.env/.json/.yaml/.yml), and imports via POST /secrets/batch; per-entry backend errors surface in an alert and the success toast flags secrets imported without an env name. Storybook play stories and vitests cover the flow.

Also documents the upload flow in docs/user-guides/user-secrets.md.

Closes https://linear.app/codercom/issue/PLAT-240

Reviewed and updated by Coder Agents on behalf of @dylanhuff-at-coder.

@linear-code

linear-code Bot commented Jun 25, 2026

Copy link
Copy Markdown

PLAT-240

dylanhuff-at-coder commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@dylanhuff-at-coder dylanhuff-at-coder changed the title feat(site): add bulk secret import upload to Add secret dialog (PLAT-240) feat: add bulk secret import upload to Add secret dialog (PLAT-240) Jul 23, 2026
@dylanhuff-at-coder dylanhuff-at-coder removed the stale This issue is like stale bread. label Jul 23, 2026
Base automatically changed from dylan/plat-240-secrets-import-endpoint to main July 23, 2026 21:55
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as ready for review July 27, 2026 15:07
@dylanhuff-at-coder
dylanhuff-at-coder requested a review from a team as a code owner July 27, 2026 15:07
@coderagents

coderagents Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

This push is another merge from main (d64fd0c053), with no new PR-authored
commits. The branch now carries the enable/disable feature (#27537) but is still
behind coder secret import (#27534), which lands overlapping content in the
same page.

Updates Needed

  • docs/user-guides/user-secrets.md - New: main added ### Import multiple secrets from a file (documenting coder secret import) in feat: add coder secret import for bulk secret files #27534, which is not yet on this branch. Once the branch picks it up, the page has two sections covering file import with conflicting detail: main's says the import "never overwrites existing secrets", while this PR's says a conflict cancels the import, and only main's mentions the CLI while only this PR's mentions the dashboard. Consolidate into one section covering the dashboard, coder secret import, and the API, and drop "To import secrets programmatically, use the Secrets API" as the only programmatic path.
  • docs/user-guides/user-secrets.md - After feat: add enable/disable support for user secrets #27537, ParseSecretsFile sets Enabled = false for keys that can't be env-injected, because user_secrets_enabled_requires_target forbids an enabled secret with no target. This PR's section still says such keys "are imported without an environment variable target" and are "not injected into workspaces until you add a valid environment variable or file target", omitting the disabled state and the required enable step. Main's CLI import text has the same gap, so fix it once in the consolidated section.
  • docs/user-guides/user-secrets.md - The section shows only plain KEY=VALUE, but codersdk.parseEnvSecrets implements a narrow dotenv subset with user-visible consequences. Document at least:
    • export prefixes and full-line # comments are accepted.
    • $VAR and ${VAR} are not expanded, so the literal text is stored.
    • Inline comments are not stripped: PASS=abc#123 stores abc#123.
    • Multiline values are unsupported in .env. Use JSON or YAML for PEM keys or certs.
    • Duplicate keys are rejected (the error cites the line number) rather than last-wins.

    ⚠️ Was addressed in 1fa501ecaa, which the 28258da21c force-push removed.

  • docs/user-guides/user-secrets.md - "contain no more than 50 keys" reads as a per-file cap. 50 is the total-secrets-per-user cap (MaxUserSecretsPerUserCount), so a 50-key file fails whenever the user already owns any secrets.

    ⚠️ Was addressed in 1fa501ecaa, which the 28258da21c force-push removed.

  • docs/user-guides/user-secrets.md - "Manage secrets from the dashboard" lists add, update, delete, and the enable/disable toggle, but not import. Add import so the dashboard-only flow is discoverable from the section that describes the page.

    ⚠️ Was addressed in 1fa501ecaa, which the 28258da21c force-push removed.

  • docs/user-guides/user-secrets.md - Record the 255-character secret name cap in the ## Limits table (no longer needed: MaxUserSecretNameLength came from b35020f9fa, which the 28258da21c force-push removed, so the cap exists neither on this branch nor on main)

Verification Notes

  • The d64fd0c053 merge parent is 1a6a8be96c, which predates feat: add coder secret import for bulk secret files #27534, so this PR does not delete docs/reference/cli/secret_import.md, its manifest entry, or the coder secret import CLI code. The branch is simply behind main there.
  • The remaining claims still check out: 1 MiB (MaxSecretsFileBytes), the 50-secret cap (MaxUserSecretsPerUserCount), string-only JSON/YAML values, atomic import, and the docs/reference/api/secrets.md#import-user-secrets-from-a-file anchor.
  • markdownlint-cli2, markdown-table-formatter --check, and an emdash/endash scan are clean on the page.

Automated review via Coder Agents

@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the dylan/plat-240-secrets-import-frontend branch from 44e6aae to 28258da Compare July 27, 2026 22:40
isUploading={isImporting}
file={importFile}
onUpload={handleImportFile}
onUnsupportedFile={handleImportFile}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels kind of weird to overload this handler to support both valid and invalid filetypes. very much a nit but perhaps separating this out into two handlers would read better?

@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the dylan/plat-240-secrets-import-frontend branch from 82f6740 to d64fd0c Compare July 28, 2026 22:20
@dylanhuff-at-coder
dylanhuff-at-coder merged commit efbf802 into main Jul 28, 2026
30 of 31 checks passed
@dylanhuff-at-coder
dylanhuff-at-coder deleted the dylan/plat-240-secrets-import-frontend branch July 28, 2026 22:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants