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

Fix S3 optional auth #2907

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Fix S3 optional auth #2907

merged 3 commits into from
Aug 10, 2023

Conversation

jdisanti
Copy link
Collaborator

@jdisanti jdisanti commented Aug 7, 2023

Motivation and Context

This PR implements a short-term solution for aws-sdk-rust#864 while a long-term solution is worked out.

Testing

  • Tested manually against S3.
  • Added DVR tests.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jdisanti jdisanti requested a review from a team as a code owner August 7, 2023 21:26
@jdisanti jdisanti force-pushed the jdisanti-fix-s3-optional-auth branch from 93556f4 to 00d0f41 Compare August 7, 2023 21:27
@jdisanti jdisanti requested a review from a team as a code owner August 7, 2023 21:27
@github-actions
Copy link

github-actions bot commented Aug 7, 2023

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.


let result = client
.list_objects()
.bucket("gdc-organoid-pancreatic-phs001611-2-open")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is giving me flashbacks to my previous job

Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved, nice narrow fix. Had some naming suggestions

}
}
],
"docs": "todo docs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"docs": "todo docs",
"docs": "a traffic recording of optional auth (no AUTHORIZATION header is included)",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed docs in 6244621

Comment on lines +32 to +33
.remove_invocation_id_for_tests()
.user_agent_for_tests()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side note: we should add these to with_test_defaults() on the main config

// TODO(P96049742): Endpoint config doesn't currently have a concept of optional auth or "no auth", so
// we are short-circuiting lookup of endpoint auth scheme config if that is the selected scheme.
if scheme_id == NO_AUTH_SCHEME_ID {
return Ok(AuthSchemeEndpointConfig::from(None));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return Ok(AuthSchemeEndpointConfig::from(None));
return Ok(AuthSchemeEndpointConfig::empty());

just a little clearer on intention I think. Could also consider naming this from_model() or inherit()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6244621

@@ -124,6 +125,11 @@ fn extract_endpoint_auth_scheme_config(
endpoint: &Endpoint,
scheme_id: AuthSchemeId,
) -> Result<AuthSchemeEndpointConfig<'_>, AuthOrchestrationError> {
// TODO(P96049742): Endpoint config doesn't currently have a concept of optional auth or "no auth", so
// we are short-circuiting lookup of endpoint auth scheme config if that is the selected scheme.
if scheme_id == NO_AUTH_SCHEME_ID {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might consider renaming this—I'm not sure if NO_AUTH_SCHEME_ID means "empty" or "not authenticated". This would probably be clearer as

AuthSchemeId::unauthenticated()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's referring to the special auth scheme named "no auth", but I decided to leave out the second "auth" in the name: NO_AUTH_AUTH_SCHEME_ID.

@jdisanti jdisanti enabled auto-merge August 10, 2023 21:51
@github-actions
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@jdisanti jdisanti added this pull request to the merge queue Aug 10, 2023
Merged via the queue into main with commit 0286b9f Aug 10, 2023
@jdisanti jdisanti deleted the jdisanti-fix-s3-optional-auth branch August 10, 2023 22:41
github-merge-queue bot pushed a commit that referenced this pull request Aug 29, 2023
In #2907, I created an allow list of S3 operations to add
`@optionalAuth` to, but this turns out to be too restrictive, as seen in
awslabs/aws-sdk-rust#878. This PR restores the
original middleware behavior of allowing optional auth for all S3
operations.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants