feat(integrations): add Brex integration#4983
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
️✅ 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. |
PR SummaryMedium Risk Overview The integration ships 28 tools (expenses, receipts, card/cash transactions and accounts, statements, budgets, spend limits, team/org data, vendors, and transfer status) plus a Brex workflow block with operation-specific subblocks, templates, and skills. Scope is read-heavy: listing and reporting dominate; writes are limited to expense memo updates and receipt upload/match. Receipt flows use the standard file pattern and a dedicated Reviewed by Cursor Bugbot for commit 5be5521. Configure here. |
|
@greptile |
|
@cursor review |
Greptile SummaryThis PR adds a Brex integration with 28 tools spanning Expenses, Receipts, Transactions & Accounts, Team, Budgets, and Payments — all wired up through a single
Confidence Score: 5/5Safe to merge — the receipt upload route is well-hardened and all 28 tools follow established project patterns without introducing money-movement or card-issuance capabilities. The integration is read-heavy and deliberately scoped to safe operations. Security-sensitive paths (SSRF, file access, header injection, size limits) all have server-side enforcement and corresponding tests. The block-to-tool mapping, PAGINATED_OPERATIONS set, and conditional subblock logic are internally consistent across all 28 operations. No files require special attention. The route, contract, tools, and block are all consistent with each other. Important Files Changed
Sequence DiagramsequenceDiagram
participant B as Block / Tool
participant R as /api/tools/brex/upload-receipt
participant BrexAPI as Brex API
participant S3 as Pre-signed S3 URL
B->>R: "POST {apiKey, expenseId?, file, receiptName?}"
R->>R: checkInternalAuth
R->>R: parseRequest Zod trim+min expenseId and receiptName
R->>R: assertToolFileAccess(file.key, userId)
R->>R: downloadFileFromStorage check 50 MB
alt expenseId present
R->>BrexAPI: "POST /v1/expenses/card/{expenseId}/receipt_upload"
else no expenseId
R->>BrexAPI: POST /v1/expenses/card/receipt_match
end
BrexAPI-->>R: "{id, uri}"
R->>R: validateUrlWithDNS(uri) SSRF check
R->>S3: secureFetchWithPinnedIP PUT binary
S3-->>R: 200 OK
R-->>B: "{success:true, output:{receiptId, receiptName, expenseId}}"
Reviews (7): Last reviewed commit: "fix(brex): normalize timezone-suffixed t..." | Re-trigger Greptile |
…nsactions, team, budgets, and payments tools
…ad of silently falling back to receipt match
03f842d to
0446c75
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 0446c75. Configure here.
…gination metadata with Brex API specs
|
@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 27ced43. Configure here.
…d harden API key input
|
@greptile |
|
@cursor review |
…ap on list expenses
|
@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 cfe4ef7. Configure here.
…te filters (Brex rejects offsets)
|
@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 5be5521. Configure here.
Summary
file-uploadsubblock +normalizeFileInput+ internal route (/api/tools/brex/upload-receipt) that downloads theUserFilefrom storage and PUTs it to Brex's pre-signed S3 URL (receipt_uploadfor a specific expense,receipt_matchfor auto-matching)brexUploadReceiptContract) withcheckInternalAuthbeforeparseRequest, file access authorization, and a 50 MB receipt size limit per Brex docsdeveloper.brex.com/_bundle/openapi/*.yaml); list tools use Brex cursor pagination (cursor/limit,next_cursor)Type of Change
Testing
tsc --noEmit,biome check,check:api-validation:strict, and registry-wide block/tool tests all passChecklist