Open
Conversation
beautifulentropy
requested changes
Sep 6, 2023
Co-authored-by: Samantha <hello@entropy.cat>
beautifulentropy
approved these changes
Sep 8, 2023
jsha
reviewed
Sep 11, 2023
| *s3prefix = *logURL | ||
| } | ||
|
|
||
| _, err := url.ParseRequestURI(*s3bucket) |
Contributor
There was a problem hiding this comment.
Looking at the documentation for ParseRequestURI it doesn't seem to say it will reject absolute URIs (starting with a scheme). It actually seems to say the opposite - that it will accept them. Does this definitely work?
Member
Author
There was a problem hiding this comment.
From my manual testing, yes it works.
$ go run . -log-url https://oak.ct.letsencrypt.org/2023 -tile-size 256 -s3-bucket s3://whatever
2023/09/11 14:36:11 scheme provided for s3-bucket, but should not be
exit status 1
$ go run . -log-url https://oak.ct.letsencrypt.org/2023 -tile-size 256 -s3-bucket whoops://hasotherscheme
2023/09/11 14:36:34 scheme provided for s3-bucket, but should not be
exit status 1
# As expected, runs ctile instead of erroring out
$ go run . -log-url https://oak.ct.letsencrypt.org/2023 -tile-size 256 -s3-bucket noscheme
^Csignal: interrupt
What I'm ultimately relying on using url.ParseRequestURI is that the call to getScheme returns nil, because if it does there's a good chance that a scheme was found and I can return an error to the ctile user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Return an error to the operator if the supplied bucket name contains a scheme e.g.
s3://bucketname,whatever://bucketname,http://bucketname, etc. The aws-sdk-go s3 service examples show the bucket name without the scheme. This change does not enforce that a bucket is properly named according to the s3 docs nor do I think it should. Instead that work should be left to the aws-sdk-go. This is just a nice ease of use improvement for myself because I didn't know what an appropriate bucket name was.