Skip to content

feat(secrets): harden the secret form - #2939

Merged
camielvs merged 2 commits into
cvs/team-run-methodsfrom
cvs/secret-form-hardening
Oct 31, 2026
Merged

camielvs merged 2 commits into
cvs/team-run-methodsfrom
cvs/secret-form-hardening

Conversation

@camielvs

@camielvs camielvs commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Six fixes to the add and replace secret form. They apply to Settings → Secrets today, and to the team secrets screens later in this stack.

  • The value field sets autocomplete="new-password", so browsers stop offering a saved login password for it.
  • A name containing /, or a name that is . or .., is refused. The name is a path segment in the replace and delete requests, and the URL parser collapses dot segments, so such a secret could be created but never changed or removed.
  • The name and description stop at 255 characters, the size of their backend columns, and say so when the limit is reached. Longer values failed with a bare "Failed to add secret" or were cut off.
  • Deleting asks first, with a "Delete" button. A deleted secret makes every run that uses it fail at launch. Once secrets are shared with a team, that's everyone's runs.
  • Description and expiry fields. The backend writes either one only when a value is sent, so neither can be cleared once set. Replacing a secret keeps its description and expiry unless new ones are given, and the form says so. The Settings list shows a secret's description under its name.
  • The expiry is sent as the last whole second of the chosen day, in UTC. A database that stores datetimes to the second rounds 23:59:59.999 up to midnight, which moved a Dec 25 expiry to Dec 26.

The E2E removeSecret helper now confirms the delete dialog, found by its title.

Related Issue and Pull requests

Type of Change

  • Improvement

Line Breakdown

Category Added Removed
Production code 261 30
Tests 342 0
Config / CI / tooling 9 0
Total 612 30

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

None yet.

Test Instructions

pnpm vitest run src/components/shared/SecretsManagement

In Settings → Secrets:

  1. Add a secret with a description and an expiry date. The description shows under its name.
  2. Try a name containing /, then the name ... The form refuses both.
  3. Paste 300 characters into the name. The field stops at 255 and says so.
  4. Reopen it to replace it. The expiry shown is the day you chose.
  5. Replace the secret without filling in the description or expiry. Both are kept, and the form's hints say so.
  6. Delete the secret. A confirmation names the secret before anything is removed, and its button reads Delete.

Additional Comments

  • ExpiryDatePicker is added to react-compiler.config.js.
  • Tests get one ResizeObserver stub in vitest-setup.js instead of a copy per suite.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: cvs/secret-form-hardening/e0fb413

@camielvs
camielvs force-pushed the cvs/secret-form-hardening branch from d795094 to 103937d Compare October 29, 2026 23:33
Comment thread tests/e2e/helpers.ts Resolved
@camielvs
camielvs force-pushed the cvs/secret-form-hardening branch from 103937d to 1b26414 Compare October 30, 2026 18:51
@camielvs
camielvs force-pushed the cvs/secret-form-hardening branch from 1b26414 to ae35ec4 Compare October 30, 2026 20:35
@camielvs
camielvs marked this pull request as ready for review October 30, 2026 21:24
@camielvs
camielvs requested a review from a team as a code owner October 30, 2026 21:24
@camielvs
camielvs force-pushed the cvs/secret-form-hardening branch from ae35ec4 to 5920f14 Compare October 30, 2026 21:46
Five fixes to the add and replace form, carried over from the
superseded workspace-secrets draft (#2886). They apply to Settings →
Secrets today and to the team secrets screens that follow.

- The value field sets `autocomplete="new-password"`, so browsers stop
  offering a saved login password for it.
- A name containing `/`, or a name that is `.` or `..`, is refused. The
  name is a path segment in the replace and delete requests, and the URL
  parser collapses dot segments, so such a secret could be created but
  never changed or removed.
- Name and description stop at 255 characters, the size of their
  backend columns, and say so when the limit is reached. Longer values
  failed with a bare "Failed to add secret" or were cut off.
- Deleting asks first, with a "Delete" button. A deleted secret makes
  every run that uses it fail at launch, and once secrets are shared
  with a team that is everyone's runs.
- Description and expiry fields, using the expiry picker from #2886.
  The backend only writes either when a value is sent, so neither can
  be cleared once set: replacing keeps the current description and
  expiry unless a new one is given, and the form says so. Expiry is not
  enforced by the backend, so the form calls it a reminder. The
  Settings list shows a secret's description under its name.

The E2E `removeSecret` helper now confirms the delete dialog, found by
its title. The React Compiler covers the new `ExpiryDatePicker`. Tests
get one `ResizeObserver` stub in `vitest-setup.js` instead of a copy per
suite.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An expiry chosen as Dec 25 came back as Dec 26. The form sent the end of
the day as 23:59:59.999 UTC, and a database that stores datetimes to the
second rounds that up to midnight. The form now sends the day's last
whole second.

The hint under a new secret's expiry is gone. Replacing a secret that
already has one still says which date it keeps.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@camielvs
camielvs force-pushed the cvs/secret-form-hardening branch from 5920f14 to e0fb413 Compare October 31, 2026 00:12
@camielvs
camielvs merged commit 83bbb41 into master Oct 31, 2026
18 checks passed
@camielvs
camielvs deleted the cvs/secret-form-hardening branch October 31, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants