Title: fix(uploads): drop the stray 'use server' directive that enables Server Actions app-wide by waleedlatif1 · Pull Request #6335 · simstudioai/sim · GitHub
Open Graph Title: fix(uploads): drop the stray 'use server' directive that enables Server Actions app-wide by waleedlatif1 · Pull Request #6335 · simstudioai/sim
X Title: fix(uploads): drop the stray 'use server' directive that enables Server Actions app-wide by waleedlatif1 · Pull Request #6335 · simstudioai/sim
Description: Problem Any unauthenticated POST with Content-Type: multipart/form-data to any App Router path returns HTTP 500. Next decides a request is a Server Action from headers alone — next/dist/server/app-render/server-action-request-meta.js:36, no body inspection, no auth. The fetch-style action path returns a graceful 404, but the non-fetch multipart path does a bare throw (action-handler.js:589,743) that becomes a 500. Next has an escape hatch at action-handler.js:412: when hasServerActions() is false it returns 404 early and none of this runs. Sim had exactly one 'use server' file — apps/sim/lib/uploads/utils/file-utils.server.ts — and it was the sole reason that flag was true. Availability impact ~180 requests (60/min for 3 min from a single IP) is enough to drive the ALB 5xx alarm ...-alb-high-error-percentage (>5% for 3 consecutive 60s periods) and page on-call. It fired today at 17:22:16Z. This is an unauthenticated, zero-cost DoS against the alerting path. Auth-surface impact 'use server' also published every export of that module as a remotely invocable endpoint with no auth wrapper: downloadFileFromUrl, resolveInternalFileUrl, downloadFileFromStorage, downloadServableFileFromStorage, resolveFileInputToUrl. Several take a caller-supplied URL and fetch it — SSRF-shaped. Exploitability was not confirmed (Next's action IDs are build-derived and hard to guess), but the surface should not exist at all. Removing the directive removes it. Fix Delete the directive. Nothing ever invoked these as Server Actions. server-only was considered and rejected: it is not currently a dependency, is used nowhere in the repo, and the .server.ts suffix already carries the server-only convention here. Adding a dependency for a one-line deletion is not the minimal fix. Verification Only 'use server' in the repo (rg over apps/ + packages/): 1 hit, this file. Zero 'use client' importers: all ~77 importers are route handlers, executor code, and other .server.ts modules. No useActionState/useFormState/
Open Graph Description: Problem Any unauthenticated POST with Content-Type: multipart/form-data to any App Router path returns HTTP 500. Next decides a request is a Server Action from headers alone — next/dist/server/app-...
X Description: Problem Any unauthenticated POST with Content-Type: multipart/form-data to any App Router path returns HTTP 500. Next decides a request is a Server Action from headers alone — next/dist/server/app-...
Opengraph URL: https://github.com/simstudioai/sim/pull/6335
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:55f89733-e737-b51c-397a-caaeb7de129a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E372:2F2AB3:C57B2E:10FC6B0:6AFB56BD |
| html-safe-nonce | 2f654bcffb86c9145954119aa9c3876e28fbe4c197ef8fd9ba88d68cf0b89bd7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzcyOjJGMkFCMzpDNTdCMkU6MTBGQzZCMDo2QUZCNTZCRCIsInZpc2l0b3JfaWQiOiI0NzM5MzAyOTE2MDY0MjM3MjQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 143c5c2c5fa22aedcee7702db30e3f8bdaca04d183dbae4f44be4c42bbb41c0f |
| hovercard-subject-tag | pull_request:4223286629 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6335/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Problem Any unauthenticated POST with Content-Type: multipart/form-data to any App Router path returns HTTP 500. Next decides a request is a Server Action from headers alone — next/dist/server/app-... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width