fix(copilot): hosted api key validation + credential validation#3000
fix(copilot): hosted api key validation + credential validation#3000
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR adds credential and API key validation to the workflow editing tool. The changes introduce a new Key changes:
How it works: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as EditWorkflowClientTool
participant API as /api/copilot/execute-copilot-server-tool
participant Server as EditWorkflowServerTool
participant PreValidate as preValidateCredentialInputs
participant Validator as validateSelectorIds
participant Apply as applyOperationsToWorkflowState
participant PostValidate as validateWorkflowSelectorIds
Client->>API: POST operations, workflowId
API->>Server: execute(params, context)
Note over Server: Parse currentUserWorkflow or fetch from DB
Server->>PreValidate: validate credentials & apiKeys
PreValidate->>PreValidate: Collect oauth-input & apiKey fields from operations
PreValidate->>PreValidate: Filter apiKeys for hosted models
PreValidate->>Validator: validateSelectorIds('oauth-input', credentialIds)
Validator->>Validator: Check credentials belong to user
Validator-->>PreValidate: {valid, invalid, warning}
PreValidate->>PreValidate: Remove invalid credentials from operations
PreValidate-->>Server: {filteredOperations, errors}
Server->>Apply: applyOperationsToWorkflowState(workflowState, filteredOperations)
Apply-->>Server: {modifiedWorkflowState, validationErrors, skippedItems}
Note over Server: Add credential errors to validationErrors
Server->>PostValidate: validateWorkflowSelectorIds(modifiedWorkflowState)
Note over PostValidate: Skips oauth-input (already validated)
PostValidate->>Validator: validateSelectorIds(other selector types)
Validator-->>PostValidate: validation results
PostValidate-->>Server: selector validation errors
Server-->>API: {workflowState, validationErrors, skippedItems}
API-->>Client: {workflowState, inputValidationErrors, skippedItems}
Note over Client: Apply diff & mark complete with errors
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
@cursor review |
Summary
Validates that credentials set by the copilot are valid and belong to the user. Also doesn't allow the api key to be set for hosted models if ishosted
Type of Change
Testing
Tested with @icecrasher321
Checklist