CredentialsController will attempt to locate a full set of credentials (emulated + real) from a given emulated credential (and optionally a session token).
If found, it will pass them to a credentialsConsumer that can apply whatever transformation or computation it wants with the credentials and return an Optional<T>.
The issue is CredentialsController will log an error stating the credentials were not found if its final result is an empty optional. This could happen in two cases:
The emulated credentials were not found, or
The caller provided credentialsConsumer returned an empty optional
The latter happens, for instance, if the request has an invalid signature. That results in a log along the lines of
The second log line is correct (signature validation failed), but the first one is not - I sent a request with a valid set of credentials, I simply mis-signed the contents.
CredentialsController
will attempt to locate a full set of credentials (emulated + real) from a given emulated credential (and optionally a session token). If found, it will pass them to acredentialsConsumer
that can apply whatever transformation or computation it wants with the credentials and return anOptional<T>
.https://github.com/trinodb/aws-proxy/blob/7aa2af1e43e6ed3a2883ad7323f273598b8326c7/trino-aws-proxy/src/main/java/io/trino/aws/proxy/server/credentials/CredentialsController.java#L138-L146
The issue is
CredentialsController
will log an error stating the credentials were not found if its final result is an empty optional. This could happen in two cases:credentialsConsumer
returned an empty optionalThe latter happens, for instance, if the request has an invalid signature. That results in a log along the lines of
The second log line is correct (signature validation failed), but the first one is not - I sent a request with a valid set of credentials, I simply mis-signed the contents.
I got these results by running this test: https://github.com/trinodb/aws-proxy/blob/7aa2af1e43e6ed3a2883ad7323f273598b8326c7/trino-aws-proxy/src/test/java/io/trino/aws/proxy/server/TestGenericRestRequests.java#L128-L140
And modifying any of the signed header values or the signature, to ensure it was invalid.