Skip to content

fix(chat): show deployment passwords to admins - #6177

Merged
j15z merged 5 commits into
stagingfrom
fix/show-deploy-passwords-to-admins
Aug 2, 2026
Merged

fix(chat): show deployment passwords to admins#6177
j15z merged 5 commits into
stagingfrom
fix/show-deploy-passwords-to-admins

Conversation

@j15z

@j15z j15z commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • allow workspace admins to reveal saved chat deployment passwords
  • confirm password changes and audit password reveals
  • add API and UI coverage for password reveal behavior

Type of Change

  • Bug fix

Testing

  • 16 targeted tests passed
  • full ship audit suite passed
  • lint completed with an existing Biome internal warning in an unrelated terminal component

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 2, 2026 3:06am

Request Review

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Adds an admin-only secret-reveal API and broadens password validation across HTTP, UI, and orchestration; changes are guarded and audited but touch auth and credential handling.

Overview
Workspace admins can reveal saved chat deployment passwords from the deploy modal. Show triggers an audited GET /api/chat/manage/[id]/password that decrypts after checkChatAccess; responses use Cache-Control: private, no-store, and chat.password_viewed is recorded.

GeneratedPasswordInput now supports optional fetchCurrentPassword: masked placeholder until reveal, re-fetch on each show (plaintext dropped on hide), and useRevealChatPassword as a mutation with gcTime: 0 so secrets aren’t cached.

Password handling is tightened end-to-end: shared chatDeploymentPasswordSchema (1024-char cap aligned with login, rejects whitespace-only), UI validation, performChatDeploy guards for copilot paths, and a PATCH fix so encrypted passwords aren’t stored when auth type isn’t password. Password change confirmation only runs when replacing an existing stored password, not on first-time password setup.

Reviewed by Cursor Bugbot for commit e011ed5. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR allows workspace administrators to reveal saved chat deployment passwords while auditing each disclosure and preventing response caching.

  • Adds an authenticated password-reveal API, client mutation, and masked reveal/copy UI.
  • Adds confirmation before replacing stored passwords.
  • Aligns password validation across API and orchestration deployment paths.
  • Adds targeted API, component, contract, and orchestration coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported submission-state issue is invalid because the unconditional finally block clears the flag before confirmation or dismissal.

Important Files Changed

Filename Overview
apps/sim/app/api/chat/manage/[id]/password/route.ts Adds an admin-authorized, audited, non-cacheable endpoint that decrypts and returns a saved deployment password.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx Integrates password reveal and replacement confirmation while correctly resetting submission state through the existing finally block.
apps/sim/components/ui/generated-password-input.tsx Adds on-demand password retrieval, plaintext disposal on hide, loading feedback, and clipboard support.
apps/sim/lib/api/contracts/chats.ts Adds the reveal route contract and shared password validation limits for save and login paths.
apps/sim/lib/workflows/orchestration/chat-deploy.ts Validates non-HTTP deployment passwords and prevents password-protected chats from being saved without a password.

Reviews (4): Last reviewed commit: "fix(chat): correct password-change confi..." | Re-trigger Greptile

@j15z

j15z commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@j15z

j15z commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8f97b0a. Configure here.

@j15z
j15z force-pushed the fix/show-deploy-passwords-to-admins branch from 8f97b0a to aaccfcf Compare August 2, 2026 02:42
Follow-ups from a security review of the password reveal endpoint. The
permission model itself was correct — the reveal is gated on workspace
admin via the canonical resolver, so derived org-admin access is honored.
These address secret handling and validation around it.

- Cap set-path passwords at the same 1024 chars the chat login accepts.
  Neither the input nor the schema bounded length, so a longer password
  saved fine and then failed the login POST on length before auth ran,
  locking every visitor out permanently.
- Discard the revealed password when the field is hidden. It previously
  stayed in state and in the input's DOM value with Copy still armed, so
  the field read as hidden while still handing out the plaintext.
- Evict the decrypted password from the mutation cache on unmount, and
  correct the TSDoc claiming it was never retained — it sat in the
  MutationCache for the default five minutes after the modal closed.
- Validate the password inside performChatDeploy, the writer both callers
  must use. The copilot deploy_chat tool bypasses the route contract and
  could still store a whitespace-only or over-long password, or create a
  password-protected chat with no password at all.
- Stop echoing raw decryption errors from the reveal endpoint.
- Only persist a new password when the chat ends up password-protected;
  PATCH { authType: 'email', password } used to re-arm the secret that the
  auth-type branch had just cleared.

Also replaces the hand-rolled copy state with useCopyToClipboard, which
fixes an unawaited clipboard write that surfaced as an unhandled rejection
and a "Copied" confirmation shown even when the write failed.

Co-Authored-By: Claude <noreply@anthropic.com>
… error

Addresses both open Bugbot findings.

- shouldConfirmPasswordChange keyed on "a chat exists" rather than "a password
  exists", so switching a public chat to password protection for the first time
  asked the admin to confirm changing a password that was never set. It now
  takes the existing-password signal the component already computes.
- A failed reveal left "Failed to load the current password" on screen while the
  admin typed or generated a replacement, because the mutation only drops its
  error on the next attempt. Editing or regenerating now resets it.

Co-Authored-By: Claude <noreply@anthropic.com>
@j15z
j15z merged commit 1377256 into staging Aug 2, 2026
18 checks passed
@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator

@cursor review

@icecrasher321
icecrasher321 deleted the fix/show-deploy-passwords-to-admins branch August 2, 2026 03:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e011ed5. Configure here.

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