fix: security vulnerability in attachment downloads#154
Open
hmnd wants to merge 2 commits intoschpet:mainfrom
Open
fix: security vulnerability in attachment downloads#154hmnd wants to merge 2 commits intoschpet:mainfrom
hmnd wants to merge 2 commits intoschpet:mainfrom
Conversation
Owner
|
@hmnd thanks! can you confirm this works with both images and attachments? forget if they are on the same endpoint or not. i also sometimes upload stuff to my own domains, wonder if i should support that at all... via flag or config perhaps. mostly thinking out loud here. i'll do a proper review at some point, likely next week. |
Author
|
@schpet yes, works for both! Your note on other domains brings up a gap though... In this change, I've only hardened against including credentials in non-Linear domain fetches, but it doesn't stop fetching image urls from non-Linear hosts. I figured that would likely be best for a separate PR once the UX is figured out. |
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.
Currently, the CLI attempts to download any url that merely contains
uploads.linear.app, doing so with an authenticatedfetch(). This means a threat actor can add a url likehttps://myevilurl.com/uploads.linear.appsomewhere in the issue in order to steal a user's credentials.This PR explicitly checks the hostname of the url, and only passes the api token when downloading from uploads.linear.app, rather than both uploads.linear.app and public.linear.app.
I've also taken the liberty of centralizing all Linear url usage in a const.ts, rather than having them scattered around.