Skip to content

v0.4.21: more internal auth changes, supabase vector search tool - #1708

Merged
icecrasher321 merged 5 commits into
mainfrom
staging
Oct 22, 2025
Merged

v0.4.21: more internal auth changes, supabase vector search tool#1708
icecrasher321 merged 5 commits into
mainfrom
staging

Conversation

@icecrasher321

@icecrasher321icecrasher321 commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator

Summary

fix(kb): added internal auth for Mistral OCR tool via KB (#1704)

fix(case-sensitive-header): fix case-sensitive header (#1705)

fix(external-route): handleInternalRequest should still check if request is internal

fix(base-url): use getBaseUrl helper in Copilot revert state endpoint (#1706)

feat(supabase): added vector search tool and updated docs (#1707)

@vercel

vercelBot commented Oct 22, 2025

Copy link
Copy Markdown

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

ProjectDeploymentPreviewCommentsUpdated (UTC)
docsReadyReadyPreviewCommentOct 22, 2025 1:50am

* feat(supabase): added vector search tool and updated docs
* exclude generic webhook from docs gen
* change items to pages in meta.json for tools directory in the docs
@icecrasher321icecrasher321 changed the title v0.4.21: more internal auth changesv0.4.21: more internal auth changes, supabase vector search toolOct 22, 2025
@icecrasher321
icecrasher321 merged commit 1b7437a into mainOct 22, 2025
7 of 8 checks passed

@greptile-appsgreptile-appsBot left a comment

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.

Greptile Overview

Summary

This PR consolidates several internal authentication and URL handling fixes across the codebase.

Key Changes:

  • Base URL standardization: Replaced direct usage of request.nextUrl.origin with the getBaseUrl() helper in the checkpoint revert endpoint for consistency with the rest of the codebase
  • Internal auth for Mistral OCR: Added internal authentication token when calling the Mistral OCR endpoint from the document processor to ensure proper authorization
  • External URL protection: Fixed handleInternalRequest to only add internal auth tokens to routes starting with /api/, preventing external URLs from incorrectly receiving internal authentication tokens
  • Case-sensitive headers: Fixed Authorization header handling (headers are case-sensitive in HTTP)

All changes follow consistent patterns established in the codebase and include corresponding test updates. The fixes address authentication gaps that could have caused internal API calls to fail.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes are focused bug fixes that improve internal authentication handling and URL consistency. The changes follow established patterns in the codebase, include proper test coverage updates, and fix real issues (preventing external URLs from getting internal tokens, ensuring Mistral OCR calls are properly authenticated, and using consistent base URL helpers). No breaking changes or risky logic modifications.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/api/copilot/checkpoints/revert/route.ts5/5Replaced request.nextUrl.origin with getBaseUrl() helper for consistency; updated test mocks accordingly
apps/sim/app/api/copilot/checkpoints/revert/route.test.ts5/5Added mock for getBaseUrl helper function to support route changes
apps/sim/lib/knowledge/documents/document-processor.ts4/5Added internal auth token for Mistral OCR API calls; headers variable changed from const to let for reassignment
apps/sim/tools/index.ts5/5Added check to only add internal auth for routes starting with /api/ to prevent external URLs from receiving internal tokens

Sequence Diagram

sequenceDiagram
participant Client
participant CopilotAPI as Copilot Checkpoint API
participant WorkflowAPI as Workflow State API
participant ToolsHandler as Tools Handler
participant MistralAPI as Mistral OCR API
participant DocProcessor as Document Processor
Note over CopilotAPI,WorkflowAPI: Checkpoint Revert Flow (Fix #1706)
Client->>CopilotAPI: POST /api/copilot/checkpoints/revert
CopilotAPI->>CopilotAPI: getBaseUrl() instead of request.nextUrl.origin
CopilotAPI->>WorkflowAPI: PUT {baseUrl}/api/workflows/{id}/state
Note over CopilotAPI,WorkflowAPI: Uses session cookie for auth
WorkflowAPI-->>CopilotAPI: Checkpoint applied
CopilotAPI-->>Client: Success response
Note over ToolsHandler,MistralAPI: Internal Request Auth Fix (#1704, #1705)
ToolsHandler->>ToolsHandler: Check if endpointUrl.startsWith('/api/')
alt Internal Route
ToolsHandler->>ToolsHandler: generateInternalToken()
ToolsHandler->>MistralAPI: Request with Authorization header
else External Route
ToolsHandler->>ToolsHandler: Skip internal auth
Note over ToolsHandler: Prevents external URLs from getting internal tokens
end
Note over DocProcessor,MistralAPI: Mistral OCR Auth (Fix #1704, #1705)
DocProcessor->>DocProcessor: Check if URL contains '/api/tools/mistral/parse'
DocProcessor->>DocProcessor: generateInternalToken()
DocProcessor->>DocProcessor: Set Authorization header (case-sensitive)
DocProcessor->>MistralAPI: POST /api/tools/mistral/parse
MistralAPI->>MistralAPI: checkHybridAuth validates token
MistralAPI-->>DocProcessor: OCR result
Loading

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for freeto 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.

2 participants

@icecrasher321@waleedlatif1