Skip to content

v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes, subflow fixes, multipart uploads#964

Merged
icecrasher321 merged 8 commits into
mainfrom
staging
Aug 14, 2025
Merged

v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes, subflow fixes, multipart uploads#964
icecrasher321 merged 8 commits into
mainfrom
staging

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

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)

aadamgough and others added 8 commits August 13, 2025 12:18
Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
* improvement(oauth): credential UX while sharing workflows

* fix tests

* address greptile comments

* fix linear, jira, folder selectors

* fix routes

* fix linear

* jira fix attempt

* jira fix attempt

* jira fixes

* fix

* fix

* fix jira

* fix selector disable behaviour

* minor fixes

* clear selectors correctly

* fix project selector jira

* fix gdrive

* fix labels dropdown

* fix webhook realtime collab

* fix

* fix webhooks persistence

* fix folders route

* fix lint

* test webhook intermittent error

* fix

* fix display
* File upload retries + multipart uploads

* Lint

* FIle uploads

* File uploads 2

* Lint

* Fix file uploads

* Add auth to file upload routes

* Lint
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
sim (staging) Ready Preview Comment Aug 14, 2025 7:32am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs ⬜️ Skipped Aug 14, 2025 7:32am

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR implements a comprehensive OAuth credentials sharing mechanism for collaborative workflows, addressing a critical issue where credential auto-selection was overwriting collaborator configurations and causing deselection of dependent subblocks. The solution introduces a distinction between 'owner credentials' and 'foreign credentials', allowing workflows to execute using the original creator's OAuth tokens while being accessed by other users within the same workspace.

The credential sharing system works by:

  • Adding workflowId parameters to API calls for proper authorization context
  • Implementing database-level credential owner resolution instead of relying solely on session users
  • Modifying UI components to display 'Saved by collaborator' for foreign credentials while hiding sensitive owner information
  • Removing problematic auto-selection logic that was interfering with shared credential configurations
  • Adding automatic clearing of dependent fields when credentials change to prevent stale data

Additionally, the PR includes significant upload system improvements with multipart upload support for large files (>50MB), concurrent batch processing (5 files at a time), exponential backoff retry logic (up to 3 attempts), and comprehensive progress tracking. A new /api/files/multipart endpoint handles S3 multipart uploads with proper authentication.

Other notable improvements include fixing workflow change detection for parallel execution blocks, adding proper authentication to file upload endpoints, implementing a Microsoft brand verification file, simplifying API request handling to avoid stringification issues, and reverting error bubbling behavior in workflow blocks to return structured error objects instead of throwing exceptions.

The Helm chart now supports external database configurations through a new secret template, and various API routes have been updated to support the credential sharing mechanism while maintaining security through workspace permission checks.

Confidence score: 4/5

  • This PR introduces complex authentication and authorization changes that require careful review due to security implications around cross-user credential access
  • Score reflects the comprehensive nature of changes affecting critical authentication flows, though the implementation follows established patterns and includes proper permission checks
  • Pay close attention to OAuth credential sharing logic in API routes, multipart upload implementation, and workflow error handling changes

49 files reviewed, 18 comments

Edit Code Review Bot Settings | Greptile

Comment thread apps/sim/app/api/auth/oauth/token/route.ts
Comment thread apps/sim/app/api/auth/oauth/token/route.ts
if (uploadType === 'copilot') {
if (!userId?.trim()) {
throw new ValidationError('userId is required for copilot uploads')
if (!sessionUserId?.trim()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The sessionUserId?.trim() check is redundant since session.user.id is already validated to exist on line 59. The trim() check suggests expecting a string that could be empty, but the session validation ensures it's present.

Suggested change
if (!sessionUserId?.trim()) {
if (!sessionUserId) {

Comment thread apps/sim/app/api/tools/jira/issues/route.ts
Comment thread apps/sim/app/api/tools/linear/teams/route.ts
// Allow collaborator read when workflowId present; otherwise require ownership
const ownerUserId = credential.userId
const requesterUserId = session.user.id
if (ownerUserId !== requesterUserId && !workflowId) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Security concern: This bypasses credential ownership when workflowId is present, but there's no verification that the workflow actually uses this specific credential or that the requester has proper workflow permissions.

headers,
},
error: response.ok ? undefined : `HTTP error ${response.status}: ${response.statusText}`,
error: undefined, // Errors are handled upstream in executeTool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Setting error to undefined means failed HTTP requests (4xx, 5xx) won't be reported as errors. Verify upstream error handling captures HTTP failures properly.

Comment on lines +108 to +110
const data = await (contentType.includes('application/json')
? response.json()
: response.text())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Response.json() and Response.text() can only be called once. If upstream code also tries to read the response body, this will throw an error.

Comment on lines +406 to 411
) : selectedProjectId ? (
<div className='flex items-center gap-2 overflow-hidden'>
<JiraIcon className='h-4 w-4' />
<span className='truncate font-normal'>{selectedProjectId}</span>
</div>
) : (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: displays raw project ID when metadata unavailable - consider adding loading indicator or 'Unknown project' text for better UX

prevCredRef.current = cred
const keys = Object.keys(current)
const dependentKeys = keys.filter((k) => k !== 'credential')
dependentKeys.forEach((k) => collaborativeSetSubblockValue(id, k, ''))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Setting empty strings may not be appropriate for all field types. Some fields might expect null, undefined, or default values instead of empty strings.

@icecrasher321 icecrasher321 merged commit 56ffb53 into main Aug 14, 2025
8 checks passed
@icecrasher321 icecrasher321 changed the title v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes, subflow fixes Aug 14, 2025
@icecrasher321 icecrasher321 changed the title v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes, subflow fixes v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes, subflow fixes, multipart uploads Aug 14, 2025
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes
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.

4 participants