-
-
Notifications
You must be signed in to change notification settings - Fork 260
fix: remove duplicate slash in tus upload url generator #801
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
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 20041649574Details
💛 - Coveralls |
| const forwardedPath = req.headers['x-forwarded-prefix'] | ||
| if (requestAllowXForwardedPrefix && typeof forwardedPath === 'string') { | ||
| basePath = forwardedPath + path | ||
| // Remove trailing slash from forwardedPath to avoid double slashes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar pattern could happen for signV4 of canonical request if this feature requestAllowXForwardedPrefix is enabled or a configuration value ending with a slash is given. I believe, as a result, it can cause SignatureDoesNotMatch errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This (and the original issue) does not impact our hosted service because we do not have a trailing slash, but for self hosted people may want to configure it (nginx, envoy, etc) with a trailing slash and that would cause S3 signature mismatch.
1251a82 to
8e5c8cc
Compare
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Paths returned by TUS during multi-part uploads include a duplicate slash when adding the forwarded path prefix
Example:
/storage/v1//upload/resumable/abc123What is the new behavior?
Remove duplicate slash (
/storage/v1/upload/resumable/abc123)Additional context
Thanks for the report @aantti