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

Allow List #11

Merged
merged 18 commits into from
Dec 21, 2021
Merged

Allow List #11

merged 18 commits into from
Dec 21, 2021

Conversation

peterjan
Copy link

PULL REQUEST

Overview

This PR adds an allow list. It's an initial version but it will give us the option to manually put allow listed (v1) skylinks in the database and have the reported/blocked skylink be verified against that list before proceeding to block it.

Example for Visual Changes

N/A

Checklist

Review and complete the checklist to ensure that the PR is complete before assigned to an approver.

  • All new methods or updated methods have clear docstrings
  • Testing added or updated for new methods
  • Verify if any changes impact the WebPortal Health Checks
  • Approriate documentation updated
  • Changelog file created

Issues Closed

N/A

@peterjan peterjan marked this pull request as ready for review December 21, 2021 10:12
@peterjan
Copy link
Author

We could F/U with testing although really the only thing we can test here would require setting up a database in testing or mocking the skyd API.

Copy link
Collaborator

@ro-tex ro-tex left a comment

Choose a reason for hiding this comment

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

LGTM

skyd/api.go Outdated
// allow list, it returns true if the skylink is present on the allow list
func (skyd *SkydAPI) IsAllowListed(ctx context.Context, skylink string) bool {
// build the request to resolve the skylink with skyd
url := fmt.Sprintf("http://%s:%d/skynet/resolve/%s", skyd.staticSkydHost, skyd.staticSkydPort)
Copy link
Collaborator

Choose a reason for hiding this comment

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

F/U: We can check if it's a V2 skylink before making a request.

Also, resolving the skylink can make a nice helper func.

@ChrisSchinnerl ChrisSchinnerl merged commit e647277 into main Dec 21, 2021
@ro-tex ro-tex deleted the pj/allowlist branch December 21, 2021 14: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.

3 participants