fix(dataverse): harden OAuth connection preflight - #7238
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThe PR hardens Dataverse OAuth setup and reconnect preflight while preserving the canonical scopes required by legacy authorization.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/auth/oauth2/authorize/route.ts | Passes provider-specific canonical scopes into generic OAuth account linking while preserving existing draft and callback behavior. |
| apps/sim/hooks/queries/oauth/microsoft-dataverse-connections.ts | Centralizes reconnect preflight checks and converts Better Auth link failures into rejected mutations. |
| apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx | Runs the centralized Dataverse reconnect assertion before creating a credential draft. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/microsoft-dataverse-policy.ts | Explicitly models invalid requested environments in the Dataverse credential policy. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx | Displays invalid-environment guidance independently of credential selection and suppresses inappropriate OAuth actions. |
Sequence Diagram
sequenceDiagram
actor User
participant UI as Dataverse UI
participant Preflight as Reconnect preflight
participant Draft as Credential draft API
participant OAuth as OAuth authorization
participant BA as Better Auth
User->>UI: Connect or reconnect Dataverse
UI->>Preflight: Validate environment binding
alt Binding cannot be trusted
Preflight-->>UI: Surface validation error
else Binding is valid
Preflight->>Draft: Create connection draft
Draft-->>UI: Return draft ID
UI->>OAuth: Start authorization
OAuth->>BA: Link account with required scopes
alt Link creation fails
BA-->>UI: Return surfaced error
else Link created
BA-->>User: Redirect to Microsoft consent
end
end
Reviews (2): Last reviewed commit: "fix(dataverse): preserve legacy reconnec..." | Re-trigger Greptile
There was a problem hiding this comment.
2 issues found across 8 files
Confidence score: 3/5
connected-credential-detail.tsxcan throw during legacy Dataverse reconnection before reaching the desktop-capable path, blocking users from reconnecting that credential; skip the web-only preflight for legacy bindings while preserving the intended rejection cases.credential-selector.tsxfails to mark a Dynamics workflow for update when an invalid non-empty environment URL exists before credential selection, allowing invalid configuration to persist; decouple the URL validation from thehasOAuthSelectiongate.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx">
<violation number="1" location="apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx:216">
P2: When a Dynamics workflow contains an invalid non-empty environment URL before a credential is selected, this condition never makes `needsUpdate` true because the whole expression remains gated by `hasOAuthSelection`; the selector therefore does not surface the invalid environment. Evaluate `hasInvalidEnvironment` outside the credential-selection gate while keeping scope/account updates gated on a selected credential.</violation>
</file>
<file name="apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx">
<violation number="1" location="apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx:133">
P2: When a legacy Dataverse credential is reconnected in the desktop app, this preflight throws before reaching the generic desktop-capable branch below. Skip the web-only check for legacy bindings while still rejecting query failures and invalid bindings.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
waleedlatif1
force-pushed
the
codex/dynamics-release-review-7224
branch
from
August 28, 2026 23:16
b447a24 to
c67bafb
Compare
Collaborator
Author
Collaborator
Author
|
@cubic review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
bun run lint:checkbun run type-checkbun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:auditsChecklist