Skip to content

Option to Reject requests by default#58

Merged
hannahhoward merged 3 commits intomasterfrom
feat/reject-requests-by-default
Apr 2, 2020
Merged

Option to Reject requests by default#58
hannahhoward merged 3 commits intomasterfrom
feat/reject-requests-by-default

Conversation

@hannahhoward
Copy link
Collaborator

Goals

Some graphsync operators may want to operate a graphsync node which is more locked down, rejecting all requests by default, and only authorizing requests through hooks.

Implementation

  • modify hook registrations to return an unregister function (so hooks can be removed)
  • setup default validation as simply a validating hook
  • add a configurable functional options pattern to graphsync constructor
  • add an option to reject all requests by default -- just unregisters default validation
  • fix a potential race condition with list of request hooks in ResponseManager

@hannahhoward hannahhoward requested a review from Stebalien March 30, 2020 18:06
Copy link
Member

@Stebalien Stebalien 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 except one case where you're not unlocking.

for _, requestHook := range rm.requestHooks {
requestHook.hook(p, request, ha)
if ha.err != nil {
return
Copy link
Member

Choose a reason for hiding this comment

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

Not unlocking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ha good catch

@hannahhoward hannahhoward requested a review from Stebalien April 1, 2020 23:40
@hannahhoward hannahhoward force-pushed the feat/reject-requests-by-default branch from f904432 to 0d82d29 Compare April 2, 2020 00:15
@hannahhoward hannahhoward changed the base branch from refactor/testify to master April 2, 2020 00:15
@hannahhoward hannahhoward merged commit 6760665 into master Apr 2, 2020
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
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.

2 participants