feat(integrations): add Ramp integration with spend, receipts, and bill tools#4982
feat(integrations): add Ramp integration with spend, receipts, and bill tools#4982waleedlatif1 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@greptile |
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
@cursor review |
PR SummaryMedium Risk Overview Wires Ramp OAuth ( Reviewed by Cursor Bugbot for commit eceb558. Configure here. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d72df32. Configure here.
Greptile SummaryThis PR adds a complete Ramp integration with 25 tools covering transactions, users, cards, spend limits, reimbursements, bills, departments, vendors, entities, spend programs, business info/balance, and receipts. It registers Ramp as an OAuth provider (authorization code + refresh token via Basic auth), adds the Ramp block, and routes file uploads through an internal proxy endpoint that handles multipart/form-data construction.
Confidence Score: 5/5This PR is safe to merge; it adds a self-contained new integration with no changes to existing logic paths. All 25 tools follow the established codebase patterns for OAuth-backed integrations. The receipt upload route correctly validates the caller, checks file ownership, and sanitizes CR/LF characters in all user-controlled fields before embedding them in the multipart body. OAuth registration mirrors the existing 40+ provider convention. No existing code paths are modified beyond additive registration entries. No files require special attention. The upload-receipt route is the most complex new path and it handles auth, file access, and multipart construction correctly. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client Tool (upload_receipt.ts)
participant Internal as /api/tools/ramp/upload-receipt
participant Storage as File Storage
participant Ramp as Ramp API
Client->>Internal: "POST JSON {accessToken, userId, transactionId?, file}"
Internal->>Internal: checkInternalAuth()
Internal->>Internal: parseRequest (Zod validation)
Internal->>Internal: processFilesToUserFiles()
Internal->>Internal: assertToolFileAccess(key, userId)
Internal->>Storage: downloadFileFromStorage(userFile)
Storage-->>Internal: fileBuffer
Internal->>Internal: buildReceiptMultipartBody(boundary, fields, file)
Internal->>Ramp: POST /receipts multipart/form-data
Ramp-->>Internal: "{id} or error"
Internal-->>Client: "{success, output: {receiptId}} or {success: false, error}"
Reviews (3): Last reviewed commit: "fix(ramp): sanitize multipart field valu..." | Re-trigger Greptile |
Greptile SummaryThis PR adds a full Ramp integration — 25 tools covering transactions, users, cards, spend limits, reimbursements, bills, departments, vendors, entities, spend programs, business info/balance, and receipts — along with an OAuth provider registration, a custom internal upload route for the multipart Ramp receipts endpoint, a block with conditional sub-blocks and wand configs, and docs.
Confidence Score: 4/5The integration is well-structured and the receipt upload route is properly guarded by internal auth and file-access checks; the two findings are both hardening suggestions with no realistic attack surface today. The implementation follows the established patterns for OAuth providers, block definitions, and tool utilities consistently across 46 files. The only actionable findings are a missing CRLF strip on multipart field values (inconsistent with the filename sanitization already present) and generic scope-description keys that could silently collide with future provider registrations. Neither represents a current breakage. apps/sim/app/api/tools/ramp/upload-receipt/route.ts (multipart field sanitization) and apps/sim/lib/oauth/utils.ts (generic scope key names) Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User / Workflow
participant Block as Ramp Block
participant ToolExecutor as Tool Executor
participant InternalRoute as /api/tools/ramp/upload-receipt
participant Storage as File Storage
participant RampAPI as Ramp API
User->>Block: configure operation + inputs
Block->>ToolExecutor: resolve tool (e.g. ramp_list_transactions)
alt Read / list / create tool
ToolExecutor->>RampAPI: GET/POST https://api.ramp.com/developer/v1/...
RampAPI-->>ToolExecutor: JSON response
ToolExecutor-->>Block: transformed output
end
alt Upload Receipt
ToolExecutor->>InternalRoute: POST /api/tools/ramp/upload-receipt
InternalRoute->>InternalRoute: checkInternalAuth + parseRequest
InternalRoute->>InternalRoute: processFilesToUserFiles + assertToolFileAccess
InternalRoute->>Storage: downloadFileFromStorage
Storage-->>InternalRoute: file buffer
InternalRoute->>InternalRoute: buildReceiptMultipartBody
InternalRoute->>RampAPI: POST /developer/v1/receipts (multipart/form-data)
RampAPI-->>InternalRoute: "{ id: receiptId }"
InternalRoute-->>ToolExecutor: "{ success: true, output: { receiptId } }"
ToolExecutor-->>Block: receiptId
end
alt OAuth Token Refresh
ToolExecutor->>RampAPI: POST /developer/v1/token (Basic auth)
RampAPI-->>ToolExecutor: new access_token + refresh_token
end
Reviews (2): Last reviewed commit: "feat(integrations): add Ramp integration..." | Re-trigger Greptile |
4e6f901 to
eceb558
Compare
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit eceb558. Configure here.
Summary
/api/tools/ramp/upload-receipt) with contract validation, internal auth, file access checks, and the documented Ramp multipart format (metadata as form-data parts, file as anattachmentpart namedreceipt)startcursor surfaced asnextStart), BlockMeta templates and skills#E4F222)Type of Change
Testing
Typecheck clean, biome clean,
check:api-validation:strictpasses, block/tool registry test suites pass (162 tests). All endpoints, params, scopes, and response shapes cross-checked against Ramp's OpenAPI spec.Checklist