-
Notifications
You must be signed in to change notification settings - Fork 8
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
Beginnings of S3 request proxying #11
Conversation
7e98ecf
to
d7eccf9
Compare
56ad313
to
51a21e9
Compare
320be0e
to
362b3da
Compare
362b3da
to
0a76a50
Compare
3d80dcf
to
4245318
Compare
0a76a50
to
f5dd859
Compare
44b8194
to
d535abb
Compare
588cd85
to
5d80432
Compare
31cee7d
to
3444d91
Compare
7dd1e70
to
6dacc83
Compare
94fa65c
to
0287a5f
Compare
6dacc83
to
0e46571
Compare
0287a5f
to
f61ca24
Compare
0e46571
to
d617549
Compare
f61ca24
to
ec39d06
Compare
d617549
to
be09fa0
Compare
ec39d06
to
5787e06
Compare
be09fa0
to
89953b2
Compare
5787e06
to
fa2de77
Compare
89953b2
to
824bc0c
Compare
367da6b
to
ee3d24d
Compare
3497048
to
6af50b0
Compare
@@ -36,17 +37,56 @@ public SigningController(CredentialsController credentialsController, SigningCon | |||
maxClockDrift = signingControllerConfig.getMaxClockDrift().toJavaTime(); | |||
} | |||
|
|||
public Optional<SigningMetadata> signingMetadataFromRequest( | |||
Function<Credentials, Credentials.Credential> credentialsSupplier, |
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 understand that this is to support us obtaining the metadata in the same way whether this is using the emulated access key or the external one. Is the idea that we may want to proxy requests signed with the real access key?
However, we currently never use this argument. Even if we were to use it, we would need to somehow pass it onto isValidAuthorization
and we should have a way to retrieve a Credentials pair from a real key in the same way we do for emulated ones right?
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.
Is the idea that we may want to proxy requests signed with the real access key?
We need to sign the real request being sent to AWS (or whatever real object store we're using). The signing mechanism is the same. However, for the real request we must use the real AccessKey/Secret.
However, we currently never use this argument
It's used by TrinoS3ProxyClient
. See here: https://github.com/trinodb/s3-proxy/pull/11/files#diff-86567ef27fb9d1f3e89e0d28033e383903d06ae883810cb03d45ca40400bb665R104
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.
It is used for the sign
method but not for the signingMetadataFromRequest
right? I completely agree with needing this for the sign
method, just wondering its purpose for this one
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 see. signingMetadataFromRequest
always uses the emulated credentials. I find it easier to reason about when SigningController
is agnostic about which credentials are used. I'd prefer to leave as is unless you feel strongly about it.
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.
SigningController
can be agnostic as to what credentials are used, I agree that's good. But this method is taking an argument that is unused, so it is misleading for a caller as it gives the impression you can ask it to use the real credentials, but it won't.
If we want to make it explicit that this method (unlike the others in SigningController
) only deals with emulated credentials, should we rename to validateEmulatedCredentialsAndGetMetadata
?
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.
OK - it's fixed now. PTAL. Thanks for your persistence.
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.
Also, now that I look at it fresh, we can change signRequest()
to just take a region and a Credential
and not have it take the SigningMetadata
. wdyt? However, we may want that metadata object in the future. I'm 50/50
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.
No worries! I originally had this design in mind, but at present there is no way to allow users to pass in Credentials::real
to this method (as our credential store doesn't store a mapping from real credential to emulated ones, only the other way around)
However, that is personal preference - and in any case, we could tweak the CredentialsController later if we wanted to make this possible for any reason.
Looks good!
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.
Whoops just saw your last comment. If we did that we'd need to also pass in the session, if any - right?
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 ^^^ - we should leave it due to that.
trino-s3-proxy/src/main/java/io/trino/s3/proxy/server/credentials/SigningController.java
Show resolved
Hide resolved
trino-s3-proxy/src/main/java/io/trino/s3/proxy/server/rest/TrinoS3ProxyResource.java
Outdated
Show resolved
Hide resolved
trino-s3-proxy/src/main/java/io/trino/s3/proxy/server/rest/TrinoS3ProxyResource.java
Show resolved
Hide resolved
6af50b0
to
1438e19
Compare
1438e19
to
b7caafc
Compare
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.
LGTM!
See ReadMe for details: https://github.com/trinodb/s3-proxy/blob/jordanz/initial-proxied-request/README.md
E.g.
~/dev/starburst/trino-s3-proxy (jordanz/initial-proxied-request)$ aws --endpoint-url http://localhost:53893/api/v1/s3Proxy/s3 s3 ls s3://galaxy-cur/ PRE demo/ PRE dev/ PRE prod/ PRE staging/ 2024-05-16 11:41:31 4 aws-programmatic-access-test-object
Closes #8
Closes #10