Skip to content

fix(selectors): resolve shared environment references server-side - #7095

Draft
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/server-resolved-selector-context
Draft

fix(selectors): resolve shared environment references server-side#7095
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/server-resolved-selector-context

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the shared, authorized infrastructure for dependent selectors whose context may contain environment-secret references. This PR contains no Jira, Confluence, JSM, Slack, CloudWatch, or IMAP selector migration; those are independent sibling PRs stacked on this branch.

The browser carries literals or opaque exact {{KEY}} references only. Authorized resolution happens server-side, and resolved shared-secret plaintext never enters selector query keys, responses, or client state.

Shared infrastructure in this PR:

  • serverResolvedContextFields metadata and exact-reference preservation
  • Principal-based workflow/credential authorization
  • active readable workflow scope, delegated executor scope, and session-only workflowless credential scope
  • canonical workspace derivation and workflow/credential workspace agreement
  • effective environment resolution with workspace-over-personal precedence and existing shared-secret membership filtering
  • credential provider matching before token or service-account secret access
  • cache partitioning by workspace, workflow, and opaque dependency revision
  • complete selector-query reset during user-data reset
  • shared Atlassian credential binding, sanitized discovery mode, provider-error mapping, and provider-owned selector contract map composition used by the Jira/Confluence and JSM children

Slack report: https://sim-ai.slack.com/archives/C093DF8MA21/p1786822370070229

Security invariant

  • Route adapters authenticate before parsing and reuse the authenticated session or executor principal.
  • Workflow selectors require an active workflow the principal may read.
  • Workflowless selectors require a session principal and an authorized credential; direct-secret selectors still require a workflow.
  • Credential-backed requests use existing credential-use authorization and enforce workflow/credential workspace agreement.
  • Provider compatibility is checked before token refresh or service-account secret access.
  • Only exact whole-value references resolve; missing and inaccessible references return the same sanitized error.
  • Resolved values never return to the browser or enter logs/query keys.
  • Atlassian provider response bodies are neither returned nor logged.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Focused coverage

  • Literal passthrough; exact personal/shared references; workspace precedence; missing/inaccessible equivalence; exact-reference-only behavior.
  • Active/archived workflow authorization, delegated scope, workflowless credential scope, workflow/credential workspace agreement, and direct-secret workflow enforcement.
  • OAuth and Atlassian service-account provider binding plus mismatch denial before secret/provider access.
  • One real QueryClient suite for opaque revisions, workspace/workflow separation, plaintext exclusion, and unchanged legacy keys.
  • User-data reset removes the entire selector query namespace.
  • Server adapter authentication success/failure and the sim:selectors delegation audience.
  • Exact public provider-error mappings without incidental implementation assertions.

Verification

Verified after rebuilding on the latest origin/staging:

  • Focused shared Vitest: 8 files, 54 tests passed.
  • Full combined focused selector suite: 23 files, 123 tests passed.
  • Full root suite: 19/19 tasks; app 2,357 files passed, 3 skipped; 34,659 tests passed, 46 skipped.
  • App and root type-checks passed.
  • Root lint:check and format:check passed. Lint reports one unrelated existing unused-suppression warning in shell-layout.test.ts.
  • Strict API validation passed: 1,213/1,213 routes Zod-backed.
  • Client-boundary and React Query audits passed.
  • git diff --check passed.

The right-sized stack adds 2,458 permanent test lines across 91 newly declared it/test blocks, down from 2,500 lines / 92 declarations in the previous five-PR layout. Coverage was removed only when it duplicated mechanics or forwarding rather than observable behavior or a security boundary.

Combined browser acceptance

  • Jira, Confluence, JSM, CloudWatch, Slack, and IMAP selector forms preserved literals and exact personal/shared references across the browser boundary.
  • Existing Slack OAuth loaded real channel options in both a workflow and a workflowless knowledge connector.
  • Changing between two deterministic invalid Slack direct tokens produced separate requests; an exact runtime block reference produced no selector request.
  • CloudWatch and IMAP deterministic invalid inputs reached their dedicated selector routes and returned sanitized failures without echoing secrets.
  • No selector-specific console warnings appeared and no plaintext secret values appeared in keys, responses, or server logs.
  • Disposable workflow and knowledge-base data were deleted afterward; the existing Slack workflow was restored.

Intentional scope

  • Exact whole-value references only; embedded interpolation is unchanged.
  • Runtime tool routes, block definitions, database schemas, runtime environment resolution, and chained resource-ID selectors are unchanged.
  • Provider selector migrations remain in independent child PRs.

Checklist

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

Stacked children

Each child is a draft sibling based directly on this PR's tip. Review each diff against fix/server-resolved-selector-context; do not merge a child until #7095 lands and that child is rebased and retargeted to staging.

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 26, 2026 8:26pm

Request Review

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