René's URL Explorer Experiment


Title: fix(selectors): rebind Copilot principals for nested domain use cases by icecrasher321 · Pull Request #8397 · simstudioai/sim · GitHub

Open Graph Title: fix(selectors): rebind Copilot principals for nested domain use cases by icecrasher321 · Pull Request #8397 · simstudioai/sim

X Title: fix(selectors): rebind Copilot principals for nested domain use cases by icecrasher321 · Pull Request #8397 · simstudioai/sim

Description: Summary Chat reported 404 "Workspace not found" when previewing a fork push or pull (sim workspaces push-preview / pull-preview), even though the user was an admin of both workspaces and direct reads of each succeeded. Root cause: the fork sync preview re-validates saved dependent values (for example a Table block's conflict column or a Knowledge block's document) through selectors. Selectors backed by another domain (knowledge.documents, table.columns, table.outputColumns, sim.workflows, workspace.sandboxes, mcp.tools) forwarded the Copilot principal, admitted under the sim:selectors audience, straight into use cases that only accept their own audience (sim:knowledge, sim:tables, ...). The refusal is a DelegatedWorkspaceAuthorizationError, which the v2 surface conceals as a 404, so Chat saw a missing workspace. Session callers (the in-app sync view) were unaffected. The same bug broke those pickers for Chat everywhere (sim selectors list), not just in fork previews. Fix: bindCopilotWorkspaceOperation (the existing nested-operation helper used by workflow lint and tool inspection) can now also project the single resource a nested call reaches onto the derived principal. This matches how the executor and Chat MCP paths already mint ({ credentialId } for a managed connection, { mcpServerId } for a shared server). It only adds scope: a grant already narrowed to one resource is never moved to another. New nestedSelectorPrincipal in lib/selectors/server/types.ts wraps it with the selector source audience (SELECTOR_DELEGATION_AUDIENCE, now a named constant). Every internal and MCP selector that calls another domain's use case goes through it. Session-only selectors are unchanged. Managed MCP connections: the mcp.tools managed branch now names the connection, so Chat reaches the credential-group rule. That rule deliberately denies Chat on credentials without an OAuth binding (pinned in credential-groups/application/authorization.test.ts), so the result is now its honest 403 "Credential Group credential access denied" instead of the concealed 404. This PR does not change that policy. Type of Change Bug fix Testing fork-sync.integration.ts: new scenario drives a push preview through the same in-process CLI transport Chat uses (createScopedCliTransport + withWorkspaceInvocationScope), with a mapped table and a saved conflict-column value. Before the fix it returns {"error":{"code":"NOT_FOUND","message":"Workspace not found"}}; with the fix it returns 200 with the field validated against the destination. selectors/__integration__/copilot-nested-selectors.integration.ts: POST /api/v2/selectors/list for mcp.tools on a real managed MCP connection through the Chat transport. Before the fix it returns 404 "Selector scope not found"; with the fix it returns the credential-group 403. copilot-workspace-invocation.test.ts: a grant scoped to one credential cannot be re-bound to another (security boundary). Each guard was reverted separately to confirm its test goes red: the table rebinding (404 again), the managed connection scope (404 again), and the scope-conflict check (the unit test no longer throws). bun run type-check, bun run check:audits, Biome, and unit tests across lib/core/application, lib/selectors, lib/workflows, lib/mcp, lib/credentials, lib/credential-groups, ee/workspace-forking and lib/mothership/agent-cli all pass. (One agent-cli/services.test.ts case timed out at 10s under full parallel load and passes in isolation. It covers list_workspaces, not selectors.) Reviewers: the security-relevant piece is narrowResourceScope in lib/core/application/copilot-workspace-invocation.ts. 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) 🤖 Generated with Claude Code

Open Graph Description: Summary Chat reported 404 "Workspace not found" when previewing a fork push or pull (sim workspaces push-preview / pull-preview), even though the user was an admin of both workspaces and ...

X Description: Summary Chat reported 404 "Workspace not found" when previewing a fork push or pull (sim workspaces push-preview / pull-preview), even though the user was an admin of both workspa...

Opengraph URL: https://github.com/simstudioai/sim/pull/8397

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:8ce6f85c-e80b-c553-3274-9b61224a7a0b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD7D6:5A71D:E73649:13C188E:6AFB5C83
html-safe-noncefcb34b5f3ede504d9a4441eacabdad0dc9fc54685949428003e4f028c695276d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0Q2OjVBNzFEOkU3MzY0OToxM0MxODhFOjZBRkI1QzgzIiwidmlzaXRvcl9pZCI6IjQ4NTMxNTQwMjUxMTA3MjM3MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac84c647350810a1fd7dda475110a85f5105cee17bc03bde2f0890d1b7a619307d
hovercard-subject-tagpull_request:4671782518
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/8397/files
twitter:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
og:image:altSummary Chat reported 404 "Workspace not found" when previewing a fork push or pull (sim workspaces push-preview / pull-preview), even though the user was an admin of both workspaces and ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ef97164c52cf59bd10558ddec9c4f482763988
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8397/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8397%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8397%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/8397/files
Reloadhttps://github.com/simstudioai/sim/pull/8397/files
Reloadhttps://github.com/simstudioai/sim/pull/8397/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
icecrasher321https://github.com/icecrasher321
staginghttps://github.com/simstudioai/sim/tree/staging
rvt-sandbox-to-uat-push-errorhttps://github.com/simstudioai/sim/tree/rvt-sandbox-to-uat-push-error
Conversation 8 https://github.com/simstudioai/sim/pull/8397
Commits 2 https://github.com/simstudioai/sim/pull/8397/commits
Checks 31 https://github.com/simstudioai/sim/pull/8397/checks
Files changed https://github.com/simstudioai/sim/pull/8397/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8397/files
fix(selectors): rebind Copilot principals for nested domain use cases https://github.com/simstudioai/sim/pull/8397/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8397/files
9c82ba8 fix(selectors): rebind Copilot principals for nested domain use cases Sep 29, 2026 https://github.com/simstudioai/sim/pull/8397/commits/9c82ba8d47e93faf0c5ef03e77e87587d98a8abd
a0ba913 fix(selectors): scope table selector reads to the selected table Sep 29, 2026 https://github.com/simstudioai/sim/pull/8397/commits/a0ba913452a106e3e2df25660ed51ff66700f1b7
Clear filters https://github.com/simstudioai/sim/pull/8397/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8397/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8397/files
copilot-workspace-invocation.test.ts https://github.com/simstudioai/sim/pull/8397/files#diff-86c11fa63158eecca88911689f85e1e8c45f1cede76a4a4007fb3468a4192d4e
copilot-workspace-invocation.ts https://github.com/simstudioai/sim/pull/8397/files#diff-bd6fab345275120c734b89e0d9e1f04242db95189288f762d493da2d86cbfe80
copilot-nested-selectors.integration.ts https://github.com/simstudioai/sim/pull/8397/files#diff-e5bc094dfe371e37e1d1ef2792bad99abb88adb8e9bc291f5418264d1fb5be9c
execute-selector.ts https://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
operations.ts https://github.com/simstudioai/sim/pull/8397/files#diff-107fd84bfa425213eab2b477b62e34a27daa36f69e28b00752427a7510e3af04
internal.ts https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
mcp.ts https://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
types.ts https://github.com/simstudioai/sim/pull/8397/files#diff-b7dc0bb860a0b58a2a88aaf24c8c621ab3a1361e044ba07de3c94fee24c1fa85
fork-sync.integration.ts https://github.com/simstudioai/sim/pull/8397/files#diff-a4ea318a8ac11706ffecb532aa5a78dda0dbd13cb412f146d53d2b244e971e40
apps/sim/lib/core/application/copilot-workspace-invocation.test.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-86c11fa63158eecca88911689f85e1e8c45f1cede76a4a4007fb3468a4192d4e
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/core/application/copilot-workspace-invocation.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-86c11fa63158eecca88911689f85e1e8c45f1cede76a4a4007fb3468a4192d4e
https://github.com/simstudioai/sim/pull/8397/files#diff-86c11fa63158eecca88911689f85e1e8c45f1cede76a4a4007fb3468a4192d4e
apps/sim/lib/core/application/copilot-workspace-invocation.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-bd6fab345275120c734b89e0d9e1f04242db95189288f762d493da2d86cbfe80
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/core/application/copilot-workspace-invocation.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-bd6fab345275120c734b89e0d9e1f04242db95189288f762d493da2d86cbfe80
https://github.com/simstudioai/sim/pull/8397/files#diff-bd6fab345275120c734b89e0d9e1f04242db95189288f762d493da2d86cbfe80
apps/sim/lib/selectors/__integration__/copilot-nested-selectors.integration.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-e5bc094dfe371e37e1d1ef2792bad99abb88adb8e9bc291f5418264d1fb5be9c
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/selectors/__integration__/copilot-nested-selectors.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
apps/sim/lib/selectors/application/execute-selector.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/selectors/application/execute-selector.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
https://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
https://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
https://github.com/simstudioai/sim/pull/8397/files#diff-1a0f51fcff92a244191406a5c7ce807e8443fcfb71c7ebe8206f5977287960a9
apps/sim/lib/selectors/application/operations.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-107fd84bfa425213eab2b477b62e34a27daa36f69e28b00752427a7510e3af04
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/selectors/application/operations.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-107fd84bfa425213eab2b477b62e34a27daa36f69e28b00752427a7510e3af04
apps/sim/lib/selectors/server/internal.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/selectors/server/internal.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
https://github.com/simstudioai/sim/pull/8397/files#diff-72c921ddf124455a73fc7bf047445568f16cff8f9ad626388c4695dd109e2fc4
apps/sim/lib/selectors/server/providers/mcp.tshttps://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
View file https://github.com/simstudioai/sim/blob/a0ba913452a106e3e2df25660ed51ff66700f1b7/apps/sim/lib/selectors/server/providers/mcp.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8397/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
https://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
https://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
https://github.com/simstudioai/sim/pull/8397/files#diff-f95ce6a1052d0336321ec5ca1845b7775afeee505ce647560559af48f504dccf
Please reload this pagehttps://github.com/simstudioai/sim/pull/8397/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8397/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.