This repository was archived by the owner on Apr 22, 2021. It is now read-only.
Update mock document proofer to be able to substitute local URLs for S3#42
Merged
zachmargolis merged 5 commits intomasterfrom Nov 27, 2020
Merged
Update mock document proofer to be able to substitute local URLs for S3#42zachmargolis merged 5 commits intomasterfrom
zachmargolis merged 5 commits intomasterfrom
Conversation
**Why**: Because we're transporting raw bytes via JSON, and JSON doesn't do raw bytes
aduth
approved these changes
Nov 27, 2020
| module IdentityIdpFunctions | ||
| class S3Helper | ||
| def s3_url?(url) | ||
| URI.parse(url).host.split('.').include?('s3') |
Contributor
There was a problem hiding this comment.
Not sure how concerned we are for accuracy of this check, but alternatively:
Suggested change
| URI.parse(url).host.split('.').include?('s3') | |
| URI.parse(url).host =~ /\.?s3\.amazonaws\.com$/ |
Could maybe do for a test case or two as well?
Contributor
Author
There was a problem hiding this comment.
My thinking was, if any subdomain was exactly equal to s3 then it was probably an actual S3 URL, or at least a fake that was trying hard enough to be an S3 URL that it would count?
For simplicity's sake I'd like to leave this as-is for now, but happy to re-evaluate if we run into issues with it.
I've added a few test cases, including how this can be "fooled" in 57e971b
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The "plain" HTTP get This is only for the mock proofer, and only for local development and test cases
The Base64 changes are needed for both normal and mock proofers