Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/companion: include origin in dynamic customer credentials #5310

Open
4 of 6 tasks
Murderlon opened this issue Jul 3, 2024 · 0 comments
Open
4 of 6 tasks

@uppy/companion: include origin in dynamic customer credentials #5310

Murderlon opened this issue Jul 3, 2024 · 0 comments
Assignees
Labels

Comments

@Murderlon
Copy link
Member

Murderlon commented Jul 3, 2024

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

People who self-host Companion can set the corsOrigins option to only allow trusted origins. However, when going through the OAuth process we use window.opener.postMessage() to send the token to another tab but this also makes it accessible in all tabs (and any client from any origin).

When customers use Transloadit hosted Companion, CORS is set to allow all origins. But when people use their own credentials (fetched by Companion from their account) we should still allow them to configure strict origins.

Solution

The solution requires multiple steps.

  • Remove the recently added @uppy/companion: add oauthOrigin option #5297. We don't need a separate option for this.
  • Use the corsOrigins option on window.opener.postMessage() as well. This may involve changing the option to only allow a string instead of also a regular expression.
    • In the case of self-hosting Companion, you want these to be the same.
    • When using Transloadit hosted Companion, we want to allow all origins ('*'). Except for when customers use dynamic credentials, then we should pass their defined origin to postMessage (but keep CORS '*')
  • Add origin to the database and API response.
  • Add a new "allowed origins" field on the Transloadit website under "Third-party Credentials" -> "New Credential" -> "Companion OAuth".

Alternatives

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants