-
Notifications
You must be signed in to change notification settings - Fork 25
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
API Sign: Change the S3 Provider into a signer #1698
Conversation
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.
The S3 library should be installed as an optional dependency. The module should export null if the dependency is not available using npm install --no-optional.
How are requests handled where signing fails? eg. missing resource, missing credentials. |
Signing will always succeed even if the credentials are wrong, calling the signed url will return a 403. |
Addressed RFC in 8461242
mod/sign/s3.js
Outdated
getSignedUrl; | ||
|
||
//Check for credentials | ||
if (!process.env?.AWS_S3_CLIENT) { |
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.
How do we handle public buckets that don't require any credentials?
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.
I'll test what happens with public buckets
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.
Public buckets can just be hit on the url. 7071f1b provides a function that returns the public url if no credentials are supplied
I don't understand this bit. Can you comment on this for me to test. if (provider[req.params.provider]?.deprecated){
return await provider[req.params.provider].fn(req, res)
} |
I added S3 to requires of the sign module and updated the docs in regards to exports null from signer modules. 90bc15e |
@dbauszus-glx Turns out this is no longer necessary |
The s3_provider doesn't have to be async or deprecated. We can just require the s3_signer and exports null or s3_provider dependent on the avilability of the s3 signer. The idea is that eventually the s3 provider will sign a request and return the payload as this might be used inside the process. ie the workspace could be stored in an s3 bucket. For now the s3_provider works exactly as the s3 signer. |
@RobAndrewHurst After a quick chat with @dbauszus-glx public url are not signed so these should just be handled in the plugin. Could Maybe do a |
Happy with that! :) |
I bumped the optional dependencies to their current versions 3.691.0 AWS recommends to use ListObjectsV2Command in development. The ListObjectsCommand is only kept for legacy purposes. I also changed the s3 signer to return the signed URL as a text which it is. |
Rather than providing command maps, and action dictionaries to translate commands and properties back and forth it will be much easier to talk directly with the SDK using the commands as documented in the S3 documentation. |
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.
Nice I am happy with this!
I added in a note for developers that they must not use this sign if they are interacting with a public bucket, and gave them an example of how they could use it.
|
Don't feel like I'm best placed to review this one so removed my request. If you two @dbauszus-glx and @RobAndrewHurst are happy, that's great with me! |
Description
Provides an api endpoint
api/sign/s3
Which returns a signed URL.GitHub Issue
#1607
Type of Change
How have you tested this?
Tested with
bugs_testing/sign/s3_workspace.json
Testing Checklist
Code Quality Checklist