feat(integrations): add Vanta integration with compliance, evidence file, people, vendor, vulnerability, and risk tools#4993
Conversation
…ile, people, vendor, vulnerability, and risk tools
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Server-side access goes through Submit document is a write operation on the query route. BlockMeta adds templates and agent skills for common compliance workflows. Reviewed by Cursor Bugbot for commit c160878. Configure here. |
|
@greptile |
|
@cursor review |
… stream-cap document downloads
|
@greptile |
|
@cursor review |
Greptile SummaryThis PR adds a complete Vanta integration with 29 tools spanning compliance frameworks, controls, tests, evidence documents (upload/download/submit), people, policies, vendors, monitored computers, vulnerabilities, and risk scenarios. Auth is handled server-side via OAuth client credentials with an in-memory token cache that includes SHA-256 hashing of secrets, scope-based cache keys, concurrent-request deduplication, and a 401-triggered force-refresh retry.
Confidence Score: 5/5Safe to merge; the one open question is whether Vanta's single-active-token-per-application constraint is global across scopes or per-scope, which determines whether the current scope-split caching causes extra retries in mixed read/write workflows. Auth logic, token caching (SHA-256 hashing, TTL buffer, in-flight deduplication, 401 retry), upload size guards (schema-level .max() + post-decode check), and download size cap (incremental streaming read) all look correct. No missing required fields, broken contracts, or data-loss paths were found. apps/sim/tools/vanta/utils.ts — specifically the three scope-keyed token cache entries and whether they interact correctly with Vanta's per-application token revocation behavior. Important Files Changed
Sequence DiagramsequenceDiagram
participant Block as Vanta Block
participant QR as /api/tools/vanta/query
participant UR as /api/tools/vanta/upload
participant DR as /api/tools/vanta/download
participant Cache as Token Cache (in-memory)
participant Vanta as Vanta API
Block->>QR: "POST {operation, clientId, clientSecret}"
QR->>QR: checkInternalAuth
QR->>Cache: vantaTokenCacheKey(sha256(secret))
alt cache hit
Cache-->>QR: cached token
else cache miss / expired
QR->>Vanta: POST /oauth/token
Vanta-->>QR: access_token
QR->>Cache: store with TTL-10min
end
QR->>Vanta: GET/POST /v1/resource
alt 401 token revoked
Vanta-->>QR: 401
QR->>Vanta: POST /oauth/token forceRefresh
Vanta-->>QR: new token
QR->>Vanta: retry request
end
Vanta-->>QR: response
QR-->>Block: success + normalized output
Block->>UR: "POST {documentId, file}"
UR->>UR: checkInternalAuth + assertToolFileAccess
UR->>Vanta: POST /v1/documents/id/uploads multipart
Vanta-->>UR: file metadata
UR-->>Block: success + upload
Block->>DR: "POST {documentId, uploadedFileId}"
DR->>DR: checkInternalAuth
DR->>Vanta: GET /v1/documents/id/uploads/fileId/media
Vanta-->>DR: binary stream
DR->>DR: readBodyWithLimit 100MB
DR-->>Block: success + base64 file
Reviews (9): Last reviewed commit: "improvement(integrations): expose vanta ..." | Re-trigger Greptile |
Greptile SummaryThis PR adds a Vanta integration with 29 tools spanning compliance frameworks, controls, tests, evidence documents (list/get/upload/download/submit), people, policies, vendors, monitored computers, vulnerabilities, and risk scenarios. Auth uses Vanta's OAuth client-credentials flow exchanged server-side on each request, with three internal Next.js routes protected by
Confidence Score: 3/5The core routing, auth, and normalization logic is well-structured, but two correctness issues in the new code need addressing before merging: a field-path mismatch in the policy normalizer that silently drops The policy normalizer reads apps/sim/tools/vanta/utils.ts (normalizeVantaPolicy field path), apps/sim/lib/api/contracts/tools/vanta.ts (fileContent size bound), apps/sim/app/api/tools/vanta/query/route.ts and download/route.ts (auth outside try/catch) Important Files Changed
Sequence DiagramsequenceDiagram
participant Tool as Vanta Tool (client)
participant QRoute as /api/tools/vanta/query
participant URoute as /api/tools/vanta/upload
participant DRoute as /api/tools/vanta/download
participant Auth as checkInternalAuth
participant VantaOAuth as Vanta /oauth/token
participant VantaAPI as Vanta REST API
Note over Tool,VantaAPI: Query / read flow (27 operations)
Tool->>QRoute: "POST {operation, clientId, clientSecret}"
QRoute->>Auth: checkInternalAuth(request)
Auth-->>QRoute: "{success, userId}"
QRoute->>VantaOAuth: "POST {client_credentials, scope: read}"
VantaOAuth-->>QRoute: "{access_token}"
QRoute->>VantaAPI: GET/POST (operation URL, Bearer token)
VantaAPI-->>QRoute: raw JSON
QRoute-->>Tool: "{success, output: normalizedData}"
Note over Tool,VantaAPI: Upload evidence file flow
Tool->>URoute: "POST {clientId, clientSecret, documentId, file|fileContent}"
URoute->>Auth: checkInternalAuth(request)
Auth-->>URoute: "{success, userId}"
URoute->>URoute: processFilesToUserFiles / Buffer.from(base64)
URoute->>VantaOAuth: "POST {client_credentials, scope: read+write+upload}"
VantaOAuth-->>URoute: "{access_token}"
URoute->>VantaAPI: "POST /documents/{id}/uploads (multipart)"
VantaAPI-->>URoute: uploaded file metadata
URoute-->>Tool: "{success, output: {upload}}"
Note over Tool,VantaAPI: Download evidence file flow
Tool->>DRoute: "POST {clientId, clientSecret, documentId, uploadedFileId}"
DRoute->>Auth: checkInternalAuth(request)
Auth-->>DRoute: "{success}"
DRoute->>VantaOAuth: "POST {client_credentials, scope: read}"
VantaOAuth-->>DRoute: "{access_token}"
DRoute->>VantaAPI: "GET /documents/{id}/uploads/{fileId}/media"
VantaAPI-->>DRoute: binary file data
DRoute-->>Tool: "{success, output: {file: {name, mimeType, data, size}}}"
Reviews (2): Last reviewed commit: "fix(integrations): use write-only scope ..." | Re-trigger Greptile |
…for base64 uploads, auth check consistency
|
@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 9576c47. Configure here.
Greptile SummaryThis PR adds a full Vanta integration with 29 tools spanning compliance frameworks, controls, tests, evidence documents (upload/download/submit), people, policies, vendors, monitored computers, vulnerabilities, and risk scenarios. Auth is handled via OAuth client credentials exchanged server-side per request, with three dedicated internal API routes (
Confidence Score: 4/5Safe to merge with the concurrent-token issue noted; it only manifests when two Vanta tool calls share credentials and run in parallel. The integration is well-structured with thorough Zod contract validation, correct credential visibility, proper file-access authorization in the upload path, and solid normalizers for all 14 resource types. The two areas that could bite in production are the token-per-request pattern (Vanta invalidates prior tokens on each exchange, so parallel executions with the same credentials race) and the auth check inside the upload route's try-catch. Neither is a showstopper but both are worth addressing before the feature gets heavy parallel use. apps/sim/tools/vanta/utils.ts (token exchange without caching), apps/sim/app/api/tools/vanta/upload/route.ts (auth check placement) Important Files Changed
Sequence DiagramsequenceDiagram
participant Block as VantaBlock
participant GenHandler as GenericHandler
participant Tool as VantaTool
participant QueryRoute as /api/tools/vanta/query
participant UploadRoute as /api/tools/vanta/upload
participant DownloadRoute as /api/tools/vanta/download
participant VantaOAuth as Vanta OAuth
participant VantaAPI as Vanta REST API
Block->>GenHandler: resolve inputs + config.params()
GenHandler->>GenHandler: "finalInputs = inputs + transformedParams"
GenHandler->>Tool: executeTool(toolId, finalInputs)
alt query / read operations
Tool->>QueryRoute: POST with operation + credentials
QueryRoute->>QueryRoute: checkInternalAuth
QueryRoute->>VantaOAuth: POST /oauth/token
VantaOAuth-->>QueryRoute: access_token
QueryRoute->>VantaAPI: GET /v1/resource
VantaAPI-->>QueryRoute: JSON response
QueryRoute-->>Tool: normalized output
else file upload
Tool->>UploadRoute: POST with documentId + file
UploadRoute->>UploadRoute: checkInternalAuth + assertToolFileAccess
UploadRoute->>VantaOAuth: POST /oauth/token (upload scope)
VantaOAuth-->>UploadRoute: access_token
UploadRoute->>VantaAPI: POST multipart upload
VantaAPI-->>UploadRoute: upload metadata
UploadRoute-->>Tool: upload output
else file download
Tool->>DownloadRoute: POST with documentId + uploadedFileId
DownloadRoute->>DownloadRoute: checkInternalAuth
DownloadRoute->>VantaOAuth: POST /oauth/token (read scope)
VantaOAuth-->>DownloadRoute: access_token
DownloadRoute->>VantaAPI: GET media endpoint
VantaAPI-->>DownloadRoute: binary stream
DownloadRoute->>DownloadRoute: readBodyWithLimit 100MB
DownloadRoute-->>Tool: base64 file output
end
Tool-->>GenHandler: ToolResponse
GenHandler-->>Block: output
Reviews (3): Last reviewed commit: "fix(integrations): bound vanta base64 fi..." | Re-trigger Greptile |
…ation to avoid concurrent token races
|
@greptile |
|
@cursor review |
|
@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 6519dac. Configure here.
|
@greptile review |
|
@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 4e3d257. Configure here.
… align fileContent bound with the 100MB cap
|
@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 c160878. Configure here.
Summary
/api/tools/vanta/query|upload|download) behindwithRouteHandler+checkInternalAuth, with a contract-validated discriminated-union body; responses normalized field-for-field against Vanta's OpenAPI specprocessFilesToUserFiles+assertToolFileAccess+downloadFileFromStorage, multipart to Vanta); document file download returns execution files viaFileToolProcessorcanonicalParamId), BlockMeta with 7 templates + 5 skills grounded in Vanta's own guidescheck:api-validationroute baseline 812 → 815 for the new routesType of Change
Testing
check:api-validation:strictpassesChecklist