Skip to content
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
mock-proofer-handles-local-urls
Nov 27, 2020
Merged

Update mock document proofer to be able to substitute local URLs for S3#42
zachmargolis merged 5 commits intomasterfrom
mock-proofer-handles-local-urls

Conversation

@zachmargolis
Copy link
Copy Markdown
Contributor

@zachmargolis zachmargolis commented Nov 26, 2020

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

**Why**: Because we're transporting raw bytes via JSON, and JSON
doesn't do raw bytes
Copy link
Copy Markdown
Contributor

@stevegsa stevegsa left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

👍

module IdentityIdpFunctions
class S3Helper
def s3_url?(url)
URI.parse(url).host.split('.').include?('s3')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@zachmargolis zachmargolis merged commit e4646b3 into master Nov 27, 2020
@aduth aduth deleted the mock-proofer-handles-local-urls branch November 27, 2020 18:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants