Repository navigation
web: require same-app origin for session-changing requests and store unknown upload types as downloads - #4345
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Completion copies the object onto itself and set video/mp4 on every upload. It now keeps application/octet-stream when that was stored at the start and the key does not name a video file; every other upload still completes as video/mp4.
Member
Author
|
@greptileai please re-review the latest commit. |
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · Review details |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Two small changes to how the web app treats requests and uploads that come from places other than the app itself.
Same-site cookie writes must come from the app
isCrossSiteCookieWritedecides whether a non-GET request may use the session cookie. When the browser sentSec-Fetch-Site: same-site, it accepted the write without looking atOrigin. Butsame-sitecovers every sibling subdomain of the app's domain, not just the app. It now also needs anOriginthat is the app itself or itswwwcounterpart.flowchart TD A[cookie write] --> B{Sec-Fetch-Site} B -- cross-site --> X[no cookie user] B -- same-origin / none --> OK[cookie user] B -- same-site --> C{Origin is the request host,<br/>WEB_URL, or WEB_URL's www counterpart<br/>on the same scheme?} C -- yes --> OK C -- no, null or missing --> X B -- absent --> D[unchanged Origin fallback]packages/database/auth/request-site.ts:38isOwnSiteOrigin, used only forsame-siteat:63.cross-site,same-origin,none, requests without fetch metadata (plain-http self-hosted installs), and anything authenticated with a bearer key. The desktop app, the iOS app, the CLI and the Chrome extension all use bearer keys and send noSec-Fetch-Site.same-originand not affected.withAuth/withOptionalAuthwrappers, the Effect HttpApi and RPC auth middleware, and the App Router routes that call it directly. Server actions don't go through it.Uploads keep only media content types
Multipart
/initiateand mobile upload create stored whatevercontentTypethe client sent, and the media host serves objects with their stored type. Now, anything that isn't audio, video or a raster image is stored asapplication/octet-stream.apps/web/lib/media-processing-policy.ts:80, applied atapps/web/app/api/upload/[...route]/multipart.ts:140(replacement upload),:243(normal upload) andapps/web/app/api/mobile/[...route]/route.ts:3430.video/mp4, the web recorder and the extension send theirMediaRecordertype (video/webmorvideo/mp4), and iOS sendsvideo/*or a png/jpeg screenshot. iOS PUTs with theContent-Typeheader returned by the server, so the signed type and the sent type always match.

Confidence Score: 5/5
The latest commit appears safe to merge.Summary
The latest commit preserves the download type when ordinary S3 uploads finish, addressing the previously reported
page.htmlcase.No new actionable issues were found.
Reviews (2) · Last reviewed commit: "fix(web): keep the download type when co..." · Reviewed by Greptile