fix(selectors): resolve shared environment references server-side - #7095
fix(selectors): resolve shared environment references server-side#7095BillLeoutsakosvl346 wants to merge 10 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
2402184 to
2434652
Compare
2434652 to
ad5a672
Compare
ad5a672 to
0b8f18c
Compare
fafded6 to
0486f57
Compare
0486f57 to
17726cb
Compare
Greptile SummaryThis PR adds shared infrastructure for resolving authorized selector environment references server-side while keeping secret values out of browser query keys and state.
Confidence Score: 5/5The PR appears safe to merge; no concrete changed-code failure remains reachable in the reviewed changes. The authorization path derives canonical scope before environment resolution, credential-backed requests enforce workspace agreement, and browser caches are partitioned and invalidated without exposing resolved secret values.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/selectors/application/resolve-authorized-context.ts | Adds the central authorized application operation for canonical workspace derivation, credential checks, delegated scope enforcement, and exact environment-reference resolution. |
| apps/sim/lib/selectors/application/credential-provider.ts | Adds provider compatibility checks before credential secret access; the helper is not yet reached by a production caller in this changeset. |
| apps/sim/hooks/selectors/context-resolution.ts | Preserves server-resolved references and creates stable opaque cache revisions without exposing raw dependency values in query keys. |
| apps/sim/hooks/selectors/use-selector-query.ts | Partitions opted-in selector caches by canonical workspace, workflow, and opaque dependency scope while retaining legacy keys for other selectors. |
| apps/sim/hooks/queries/environment.ts | Refreshes environment queries first and then invalidates selector-dependent caches after successful environment mutations. |
| apps/sim/lib/atlassian/discovery.ts | Adds a sanitized discovery mode that excludes provider-controlled response bodies from errors and separates sanitized and standard cache entries. |
| apps/sim/stores/index.ts | Expands user-data reset from environment-only removal to clearing the complete React Query cache. |
Sequence Diagram
sequenceDiagram
participant Browser
participant Route as Selector route
participant Auth as Principal authorization
participant Env as Effective environment
participant Provider
Browser->>Route: "Opaque context with exact {{KEY}} reference"
Route->>Auth: Authenticate principal and authorize workflow/credential
Auth-->>Route: Canonical workspace and credential scope
Route->>Env: Resolve authorized exact references
Env-->>Route: Resolved server-only context
Route->>Provider: Fetch selector options
Provider-->>Route: Provider result
Route-->>Browser: Sanitized selector options
Note over Browser: Query key contains workspace/workflow/opaque revision, not plaintext
Reviews (1): Last reviewed commit: "fix(selectors): refresh caches after env..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 37 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
17726cb to
aeaa7ec
Compare
There was a problem hiding this comment.
All reported issues were addressed across 40 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
|
Addressed the latest Cubic P2 in eb0d42e. Successful personal Copilot secret updates now invalidate both the personal environment query and the workspace-environment prefix before invalidating the four selector cache namespaces, matching the regular personal-save mutation. The focused stream suite (13 tests), app/root type-checks, lint, format, strict API validation, client-boundary, React Query audit, and diff check all pass on the rebuilt combined stack. |
|
@cubic-dev-ai review this PR |
@BillLeoutsakosvl346 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 40 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
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:
serverResolvedContextFieldsmetadata and exact-reference preservationSlack report: https://sim-ai.slack.com/archives/C093DF8MA21/p1786822370070229
Security invariant
Type of Change
Focused coverage
sim:selectorsdelegation audience.Verification
Verified after rebuilding on the latest
origin/staging:lint:checkandformat:checkpassed. Lint reports one unrelated existing unused-suppression warning inshell-layout.test.ts.git diff --checkpassed.The final review follow-up adds behavior-level regressions for connector dependency-scoped cache identity, Copilot personal/workspace secret-update invalidation, and sanitized Atlassian response cancellation without duplicating provider matrices.
Combined browser acceptance
Credential not foundresponse. The temporary blocks and values were undone, and reload confirmed the workflow returned to its original Start-only state.Intentional scope
Checklist
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 tostaging.