Title: improvement(secrets): gate Copilot code mounting at use level by icecrasher321 · Pull Request #7004 · simstudioai/sim · GitHub
Open Graph Title: improvement(secrets): gate Copilot code mounting at use level by icecrasher321 · Pull Request #7004 · simstudioai/sim
X Title: improvement(secrets): gate Copilot code mounting at use level by icecrasher321 · Pull Request #7004 · simstudioai/sim
Description: What Mounting a saved secret into Copilot code required credential-admin on that key. A workflow Function block resolves the same secret for the same person at use level, via getPersonalAndWorkspaceEnv. This aligns the two. Why the admin bar wasn't buying anything Copilot can reach the workflow path itself — edit_workflow (lib/copilot/tools/handlers/workflow/mutations.ts) plus run_workflow (lib/copilot/tools/workflow-tools.ts:11-16). "Add a Function block containing {{KEY}}, run it, remove the block" reads the value using tools with no view gate. So the gate only redirected a Credential Member through a detour that mutates a persisted workflow, while the direct path is ephemeral and files a usage row. The inconsistency was also internal to Copilot. The secret names advertised to the model come from getAccessibleEnvCredentials (chat/workspace-context.ts:524) and getPersonalAndWorkspaceEnv (vfs/workspace-vfs.ts:3091), both role-agnostic — so Copilot listed every secret the caller could use, then refused to mount all but the admin ones. Change activeAdmin (role === 'admin' && status === 'active') → activeGrant (status === 'active'), applied to both the workspace and shared-personal predicates, with the matching eq(credentialMember.role, 'admin') removed from the query. Shared-personal is relaxed too, not just workspace: getPersonalAndWorkspaceEnv already resolves a member-level grant on someone else's personal secret, so leaving that strict would reproduce the same half-consistency one level down. Unchanged: workspace write is still required; revoked and pending grants still refused; no grant still gets nothing; model-egress projection untouched; usage rows still filed (function-execute.ts:801). What still holds the line The view gate stays where Copilot cannot route around it — values stay masked under Settings → Secrets (maskWorkspaceEnvForViewer), and See usage stays admin-only (lib/secrets/application/use-cases.ts:370-409). A member using a secret in code is recorded for whoever can rotate it. Verified no redaction anywhere is conditional on view rights, so this cannot open a masking hole. Behaviour Member with write + role=member on STRIPE_SECRET_KEY Before After Settings → Secrets "" "" Ask Sim to run code CopilotCodeSecretAccessError mounts, usage row filed Function block on canvas mounts mounts Revoked / pending / no grant denied denied See usage trail admin-only admin-only One behavioural note: selectDistinctOn now picks among member-granted shared-personal rows too, so for a name shared by two people the most-recently-updated credential wins — converging on the updatedAt desc rule getPersonalAndWorkspaceEnv already uses. Docs platform/credentials.mdx — the Copilot section now states the use-level rule and why it differs from the read gate. Also corrected two pre-existing inaccuracies in the Workspace vs. Personal table: "Visibility → All workspace members" implied values were visible to all members (only names are), and "Who can edit → Workspace admins" omitted per-secret Credential Admins. Not in scope Inbox keeps its own, tighter actor resolution (resolveInboxExecutionActor: sender-match or null) and is deliberately untouched — an unmatched sender still mounts nothing. Separately, an allowlisted external sender executes as ws.ownerId with autoExecuteTools: true and no permission gating (tool permissions are interactive-only, lifecycle/run.ts:205-215); whether the headless toolset exposes edit_workflow/run_workflow there is untraced and worth its own issue. Test plan secret-mount-materializer.server.test.ts — 26 passed. Added a member/active mount case, added member/revoked + member/pending to the denial matrix, extended the shared-personal case over both roles, and added a revoked shared-personal denial. The two "unauthorized workspace value" precedence tests now use a revoked grant so they keep testing precedence-on-denial. function-execute + resolved-secret-result + environment/utils — 90 passed. bun run type-check clean, biome clean. 🤖 Generated with Claude Code
Open Graph Description: What Mounting a saved secret into Copilot code required credential-admin on that key. A workflow Function block resolves the same secret for the same person at use level, via getPersonalAndWorkspac...
X Description: What Mounting a saved secret into Copilot code required credential-admin on that key. A workflow Function block resolves the same secret for the same person at use level, via getPersonalAndWorkspac...
Opengraph URL: https://github.com/simstudioai/sim/pull/7004
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:16d7cf4e-10d4-7d6e-f40b-f89b3c94cb6b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C9C6:375283:116604:18640B:6AFB4C82 |
| html-safe-nonce | 85441316b72c472333dedfbf3ebcc16294e84d98c453b16f1ed50461076a7856 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUM2OjM3NTI4MzoxMTY2MDQ6MTg2NDBCOjZBRkI0QzgyIiwidmlzaXRvcl9pZCI6Ijc2NDI3NDU0NDczNTIyMzA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b356b591669f73fb5f33302a5ce0416acebdb520dd2fc1462d59bd7f27f6fbe6 |
| hovercard-subject-tag | pull_request:4340430043 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/7004/files |
| twitter:image | https://avatars.githubusercontent.com/u/17950982?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/17950982?s=400&v=4 |
| og:image:alt | What Mounting a saved secret into Copilot code required credential-admin on that key. A workflow Function block resolves the same secret for the same person at use level, via getPersonalAndWorkspac... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26504db649b58525278f77a52b80ba5f10d5f4de |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width