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

[s3 gateway] Handle all path characters in SigV2 and add Nessie S3-ish test #2464

Merged
merged 8 commits into from
Sep 14, 2021

Conversation

arielshaqed
Copy link
Contributor

@arielshaqed arielshaqed commented Sep 12, 2021

Use correctly-coded path when checking sigV2 signatures in the S3 gateway.

Use the minIO client to test S3 uploads and downloads with both V2 and V4
signatures. (Unlike the AWS S3 client, the minIO client supports signing
using SigV2.)

@arielshaqed arielshaqed force-pushed the bugfix/2445-nonascii-sigv2 branch 2 times, most recently from a7588b2 to 8f2794f Compare September 12, 2021 10:53
@arielshaqed arielshaqed changed the title Add Nessie S3-ish test [s3 gateway] Handle all path characters in SigV2 and add Nessie S3-ish test Sep 12, 2021
@arielshaqed arielshaqed force-pushed the bugfix/2445-nonascii-sigv2 branch 6 times, most recently from f7c2b54 to bac9681 Compare September 13, 2021 07:32
@arielshaqed arielshaqed force-pushed the bugfix/2445-nonascii-sigv2 branch 2 times, most recently from c45837f to 1b9109c Compare September 14, 2021 07:22
@arielshaqed arielshaqed marked this pull request as ready for review September 14, 2021 07:25
Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

Looks good!
We really needed these tests,
Thanks!

@@ -277,6 +277,7 @@ func (ctx *verificationCtx) getAmzDate() (string, error) {
// parse signature date
sigTS, err := time.Parse(v4shortTimeFormat, ctx.AuthValue.Date)
if err != nil {
fmt.Printf("[DEBUG] failed to parse auth-date %s by %s: %s\n", ctx.AuthValue.Date, v4shortTimeFormat, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove or change to log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😢 sorry, thanks!

download, err := client.GetObject(
ctx, repo, o.Path, minio.GetObjectOptions{})
if err != nil {
t.Error(fmt.Sprintf("minio.Client.GetObject(%s): %s", o.Path, err))
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use t.Errorf ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, that was silly of me.

Secure: false,
})
if err != nil {
t.Error(fmt.Sprintf("minio.New: %s", err))
Copy link
Contributor

Choose a reason for hiding this comment

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

why aren't you returning in case of error? will be hard to continue without a client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Dying fatally outside the goroutine when this fails.

Copy link
Contributor Author

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks!

download, err := client.GetObject(
ctx, repo, o.Path, minio.GetObjectOptions{})
if err != nil {
t.Error(fmt.Sprintf("minio.Client.GetObject(%s): %s", o.Path, err))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, that was silly of me.

Secure: false,
})
if err != nil {
t.Error(fmt.Sprintf("minio.New: %s", err))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Dying fatally outside the goroutine when this fails.

Use the minIO client to test S3 uploads and downloads with both V2 and V4
signatures.  (Unlike the AWS S3 client, the minIO client supports signing
using SigV2.)
(Timed out on GCP)
Sign using minio, verify using gateway code.
Also increase parallelism somewhat.
@arielshaqed arielshaqed merged commit 4713534 into master Sep 14, 2021
@arielshaqed arielshaqed deleted the bugfix/2445-nonascii-sigv2 branch September 14, 2021 13:44
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.

None yet

2 participants