Skip to content

feat(secrets): let workspace secrets opt out of redaction - #7045

Merged
icecrasher321 merged 4 commits into
stagingfrom
feat/secret-unredacted-flag
Aug 24, 2026
Merged

feat(secrets): let workspace secrets opt out of redaction#7045
icecrasher321 merged 4 commits into
stagingfrom
feat/secret-unredacted-flag

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • adds an unredacted flag on workspace secrets (secret details page → Visibility, saved through the page's Save/Discard flow) that shows the value in plaintext across surfaces instead of {{NAME}}: run logs, Chat/model-visible content, sandbox output, and exported-file provenance
  • exemption derives through the resolved-secret registry catalog at three decision points (match building, provenance envelopes, input-leaf projections); collisions fail toward redaction — any non-exempt owner of the same plaintext keeps it redacted, including across tool-call forks (forks inherit the parent's protected-plaintext set) — and forced-anonymous crossings into other workspaces never drop entries; a permanently incomplete registry certifies no sandbox exemptions
  • write-time-only semantics in both directions: flipping the flag affects future runs/artifacts only; existing logs and provenance-locked files keep the state they were written with
  • the v2 secrets list carries value for visible rows — the only read response that ever includes one — so external agents can read declared-visible values directly instead of scraping logs; personal-scope writes of the flag are rejected at every layer
  • authority matches description (credential admins); the copilot set_environment_variables path is pinned so Sim can never flip the flag itself; flips are audited on both surfaces with the new value
  • docs: new Visibility section on the Secrets page covering what the toggle does, where the value becomes visible, and the future-runs-only semantics
  • schema: additive credential.unredacted column (default false) + regenerated OpenAPI and CLI API artifacts

Type of Change

  • New feature

Testing

  • 50+ new tests: registry exemption semantics (stamping, collisions, fork inheritance, forced-anonymous crossings, import exact-match, incompleteness certification), trace-span projection via the display-envelope path, env snapshot plumbing, write-path guards + audit metadata, contract round-trips, v2 list value carriage, sandbox file exports, mount materializer, and the copilot legacy-path pin; full apps/sim suite green (31k tests)
  • turbo type-check, lint, check:audits (33 audits), check:api-validation:strict, check:migrations origin/staging, check:openapi all pass

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 24, 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 24, 2026 8:34pm

Request Review

@cursor

cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Opt-in plaintext secret exposure in logs, shared links, Chat, and the v2 list API; collision and incompleteness guards reduce accidental leakage but misconfiguration can still disclose sensitive values broadly.

Overview
Adds an unredacted flag on workspace secrets so teams can show non-sensitive values in plaintext instead of {{NAME}} in run logs, Chat, model-visible content, and attachable sandbox files.

Configuration & API: Secret details get a Visibility toggle (same save flow as description). The flag is stored on credential, exposed on workspace credential and v2 secret metadata, settable via credential update and PUT v2 secrets. GET /api/v2/secrets is the only read that may include value, and only for rows with unredacted: true. Personal secrets always stay redacted; Copilot’s set_environment_variables path cannot set the flag.

Runtime: Environment snapshots carry workspaceUnredactedKeys into the resolved-secret trace registry, which skips redaction/provenance for exempt names when collision-free (shared plaintext with a protected secret still masks). Function execution passes certified unredactedSecretNames so exports aren’t provenance-locked when only exempt material is present. Toggles apply to future runs only; audits record explicit unredacted changes and invalidate env cache on flip.

Docs add a Visibility section describing scope and risk.

Reviewed by Cursor Bugbot for commit f6711ea. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds an opt-in plaintext visibility setting for workspace secrets and carries that setting through persistence, execution redaction, provenance, APIs, generated clients, UI, and documentation.

  • Adds the credential.unredacted schema field and workspace-only mutation controls.
  • Propagates certified exemptions through secret resolution, logs, model-visible content, sandbox exports, and provenance handling.
  • Exposes values for visible workspace secrets through the v2 list API while retaining metadata-only responses for protected and personal secrets.
  • Adds the visibility toggle to secret details with Save/Discard behavior and documents its disclosure scope and future-run semantics.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/executor/utils/resolved-secret-trace-registry.ts Adds catalog-derived exemptions while retaining collision, incompleteness, fork, and cross-workspace protections.
apps/sim/app/api/function/execute/route.ts Applies certified exemption names when classifying sandbox exports and preserves resolved-name usage reporting.
apps/sim/lib/secrets/application/use-cases.ts Extends secret operations with workspace-only visibility semantics and authorization enforcement.
apps/sim/app/api/v2/secrets/route.ts Includes stored values only for list rows marked visible, with own-property-safe value lookup.
apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/secret-detail.tsx Adds the documented Label and Switch boolean-toggle pattern for workspace-secret visibility.
packages/db/migrations/0304_slippery_carmella_unuscione.sql Adds the visibility column with a false default for existing and newly created credentials.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Admin[Credential admin] --> Toggle[Enable workspace-secret visibility]
  Toggle --> DB[(credential.unredacted)]
  DB --> Resolve[Resolve execution environment]
  Resolve --> Registry[Resolved-secret registry]
  Registry --> Logs[Run logs and Chat]
  Registry --> Sandbox[Sandbox output and exported files]
  DB --> API[v2 secrets list]
  API --> Visible{Secret marked visible?}
  Visible -->|Yes| Value[Return metadata and value]
  Visible -->|No| Metadata[Return metadata only]
Loading

Reviews (3): Last reviewed commit: "fix(secrets): read visible values by own..." | Re-trigger Greptile

Comment thread apps/sim/executor/utils/resolved-secret-trace-registry.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/api/v2/secrets/route.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

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 f6711ea. Configure here.

@icecrasher321
icecrasher321 merged commit 0a5b380 into staging Aug 24, 2026
30 checks passed
@icecrasher321
icecrasher321 deleted the feat/secret-unredacted-flag branch August 24, 2026 20:47
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