fix(security): xlsx CVE bump and bundled security hardening#4481
fix(security): xlsx CVE bump and bundled security hardening#4481waleedlatif1 merged 7 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Authorization boundaries tightened. v1 Request validation + dependency hygiene. Dataverse file upload switches to Reviewed by Cursor Bugbot for commit d3dc1d7. Configure here. |
Greptile SummaryThis PR applies a broad security hardening pass across several subsystems: CSRF state protection for Trello OAuth, Stripe webhook HMAC verification, SSRF guards on Microsoft Dataverse fetches, workspace-boundary enforcement on v1 API endpoints, and a
Confidence Score: 5/5Safe to merge — all new security mechanisms are correctly implemented and the existing test surface is unaffected. Each hardening change is self-contained and well-scoped: the Trello CSRF flow correctly binds state to an httpOnly cookie and clears it on completion, the Stripe HMAC path uses the static SDK method without any key coupling, workspace-scope enforcement is centralised in a single middleware helper reused consistently across all five endpoints, and the Dataverse SSRF guard leverages the existing DNS-pinning infrastructure. The three Trello route files each define TRELLO_STATE_COOKIE and TRELLO_STATE_COOKIE_PATH independently — a future rename in one file without updating the others would silently break CSRF protection.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/auth/trello/authorize/route.ts | Adds CSRF state generation: creates a 32-char state, appends it to the Trello return URL, and binds it to an httpOnly SameSite=lax cookie. Constants duplicated across the three Trello files. |
| apps/sim/app/api/auth/trello/callback/route.ts | Validates query state matches httpOnly cookie before rendering the callback HTML page; uses escapeForJsString to safely embed the state into the inline fetch call sent to store. |
| apps/sim/app/api/auth/trello/store/route.ts | Second leg of state check: validates the state in the POST body against the httpOnly cookie and clears the cookie on both success and failure paths. |
| apps/sim/app/api/chat/manage/[id]/route.ts | Blocks workflowId repointing on PATCH, preventing privilege escalation through chat deployments. |
| apps/sim/lib/webhooks/providers/stripe.ts | Adds verifyAuth using Stripe.webhooks.constructEvent (static, no API key required) for constant-time HMAC verification. |
| apps/sim/app/api/tools/microsoft-dataverse/upload-file/route.ts | Replaces plain fetch with secureFetchWithValidation to add DNS resolution and SSRF protection for the Dataverse environment URL. |
| apps/sim/app/api/v1/logs/route.ts | Adds checkWorkspaceScope to prevent workspace-scoped API keys from listing logs belonging to a different workspace. |
| apps/sim/app/api/v1/logs/[id]/route.ts | Replaces the permissions innerJoin with a post-fetch validateWorkspaceAccess call; returns 404 on access failures. |
| apps/sim/app/api/v1/workflows/route.ts | Replaces direct getUserEntityPermissions call with validateWorkspaceAccess for consistent workspace boundary enforcement. |
| apps/sim/package.json | Bumps xlsx to 0.20.3 via CDN tarball and upgrades other dependencies; xlsx CDN URL bypasses npm audit scanning. |
Reviews (4): Last reviewed commit: "fix(security): bump minimatch + clean up..." | Re-trigger Greptile
Avoids leaving a recognisable placeholder string in heap dumps and error serialisations. Webhook verification remains a purely local HMAC operation; the SDK's constructor key is unused by it. Addresses Greptile feedback on #4481. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Avoids instantiating a Stripe client just to access constructEvent. The webhook signing secret is per-trigger (user-provided whsec_…) and unrelated to our billing STRIPE_SECRET_KEY, so coupling them was wrong. Stripe.webhooks is exposed as a static — no client, no API key needed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
Resolves CVE-2026-27903 (GHSA-7r86-cg39-jmmj) by adding a root-level minimatch ^10.2.5 override. Also resolves CVE-2026-0969 in next-mdx-remote (bumped to ^6.0.0). Cleanup: - Make scripts/ a proper bun workspace (root workspaces array) - Remove duplicate scripts/package-lock.json (this repo uses bun) - Remove redundant scripts/bun.lock (now hoisted to root) - Remove vestigial scripts/setup-doc-generator.sh - Slim scripts/package.json to its real deps (glob, yaml) - Gitignore stray package-lock.json files - Update scripts/README.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@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 d3dc1d7. Configure here.
* fix(security): xlsx CVE bump and bundled security hardening * fix(stripe): use configured secret key for SDK init Avoids leaving a recognisable placeholder string in heap dumps and error serialisations. Webhook verification remains a purely local HMAC operation; the SDK's constructor key is unused by it. Addresses Greptile feedback on #4481. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(stripe): use static Stripe.webhooks for verification Avoids instantiating a Stripe client just to access constructEvent. The webhook signing secret is per-trigger (user-provided whsec_…) and unrelated to our billing STRIPE_SECRET_KEY, so coupling them was wrong. Stripe.webhooks is exposed as a static — no client, no API key needed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(ci): revert client-bundled tools to avoid .server import in client * fix(security): collapse 403 to 404 on v1 detail-by-ID routes * chore(security): remove unused validateAgiloftInstanceUrl helper * fix(security): bump minimatch + clean up scripts/ workspace Resolves CVE-2026-27903 (GHSA-7r86-cg39-jmmj) by adding a root-level minimatch ^10.2.5 override. Also resolves CVE-2026-0969 in next-mdx-remote (bumped to ^6.0.0). Cleanup: - Make scripts/ a proper bun workspace (root workspaces array) - Remove duplicate scripts/package-lock.json (this repo uses bun) - Remove redundant scripts/bun.lock (now hoisted to root) - Remove vestigial scripts/setup-doc-generator.sh - Slim scripts/package.json to its real deps (glob, yaml) - Gitignore stray package-lock.json files - Update scripts/README.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
xlsxto 0.20.3 (CDN tarball) to address CVE-2023-30533 (prototype pollution) and CVE-2024-22363 (ReDoS)/api/v1/workflows,/api/v1/workflows/[id],/api/v1/logs,/api/v1/logs/[id],/api/v1/logs/executions/[executionId]authorize,callback,store) — httpOnly cookie binding, JS-escaped state injection, required state on store bodysecureFetchWithPinnedIPworkflowIdrepointing onchat/manage/[id]PATCH to prevent privilege escalation through chat deploymentsconstructEvent(constant-time HMAC + timestamp tolerance)secureFetchWithValidationfor SSRFvalidateAgiloftInstanceUrlshared validatorType of Change
Testing
Tested manually.
bun run check:api-validationand lint pass.Checklist