Skip to content

feat(mothership): add secrets input in chat#5274

Open
Sg312 wants to merge 3 commits into
stagingfrom
dev
Open

feat(mothership): add secrets input in chat#5274
Sg312 wants to merge 3 commits into
stagingfrom
dev

Conversation

@Sg312

@Sg312 Sg312 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add secrets input in chat

Type of Change

  • New feature

Testing

Manual

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 Jun 29, 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 Jun 30, 2026 1:01am

Request Review

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds inline secret entry support to chat messages. The main changes are:

  • A new secret_input credential tag type.
  • Validation for secret input name and optional scope.
  • A chat-rendered SecretInput widget that saves to personal or workspace environments.
  • Permission gating for secret inputs and credential connect links.

Confidence Score: 4/5

The chat secret save path needs fixes before merging.

  • Chat-entered credentials default to workspace storage when scope is omitted.
  • Personal secret saves can overwrite newer keys because they send a full map from cached state.
  • Credential connect links may disappear for read-only users when the target flow is personal.

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx

Security Review

The new chat secret input can save a manually pasted credential to the shared workspace environment by default. User-provided API keys should stay user-only unless a trusted server path explicitly opts into workspace scope.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx Adds parsing and rendering for chat secret inputs, with new environment-save behavior and permission gates.

Reviews (1): Last reviewed commit: "improvement(secrets): special tags impro..." | Re-trigger Greptile

function SecretInputDisplay({ data }: { data: CredentialTagData }) {
const { workspaceId } = useParams<{ workspaceId: string }>()
const secretName = (data.name ?? '').trim()
const scope: SecretInputScope = data.scope === 'personal' ? 'personal' : 'workspace'

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.

P1 security Chat Secrets Default Shared

When a chat secret_input tag omits scope, this defaults the pasted credential to workspace and saves it through the shared workspace environment path. A user-provided API key entered in chat can therefore become a workspace secret instead of a user-only credential, exposing the key name and making the secret available to workspace-scoped flows.

Rule Used: API keys and other user-provided credentials shoul... (source)

Learned From
simstudioai/sim#2133

Comment on lines +689 to +692
const merged: Record<string, string> = {}
for (const [key, entry] of Object.entries(personalEnv ?? {})) merged[key] = entry.value
merged[secretName] = value
await savePersonal.mutateAsync({ variables: merged })

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.

P1 Personal Saves Drop Races

This personal save path rebuilds the entire environment map from the current personalEnv snapshot before sending it to an endpoint that replaces the stored map. If two chat widgets or tabs save different personal secrets from the same cached snapshot, the later save omits the first new key and removes it from the user's personal environment.

if (data.type === 'link') {
if (!data.provider) return null
// Connecting a credential mutates the workspace — hide it from read-only members.
if (!data.provider || !canEdit) return null

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.

P2 Personal Connect Links Hidden

This hides every link credential tag from read-only workspace members, even though the tag's value is just the OAuth/connect URL rendered from the chat message. If that URL starts a personal credential connection rather than a workspace-level mutation, read-only members lose the only visible action for connecting their own account.

Sg312 added 2 commits June 29, 2026 16:44
t# with '#' will be ignored, and an empty message aborts the commit.
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.

1 participant