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

feat: Implement "accept list" authorization handlers for "Follow" and "Invite" witness #867

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

bstasyszyn
Copy link
Contributor

Implemented "accept list" authorization policies for "Follow" and "Invite" witness ActivityPub requests. When one of these ActivityPub requests is sent to an Orb server, the server uses an authorization policy that is configured either as "accept-all" (default) or "accept-list". The "accept-all" policy accepts any "Follow" or "Invite" witness request (i.e. an ActivityPub response of "Accept" is always returned). The "accept-list" policy only accepts a "Follow" or "Invite" witness request IF the actor of the request is included in an "accept list" of the destination server. So, if the actor of the request is NOT in the accept list, then a "Reject" activity is returned to the requestor.

The "accept list" is managed by a new REST endpoint: /services/orb/acceptlist. A POST request updates the accept list to add or remove actor URIs, and a GET request retrieves the current accept list. The GET request may include a parameter, "type" (e.g. "follow", "invite-witness") so that only the URIs of the given type are returned. If no "type" parameter is specified then accept lists of all types are returned.

This commit also reduces the number of DEBUG logs that are emitted.

closes #352
closes #353

Signed-off-by: Bob Stasyszyn Bob.Stasyszyn@securekey.com

… "Invite" witness

Implemented "accept list" authorization policies for "Follow" and "Invite" witness ActivityPub requests. When one of these ActivityPub requests is sent to an Orb server, the server uses an authorization policy that is configured either as "accept-all" (default) or "accept-list". The "accept-all" policy accepts any "Follow" or "Invite" witness request (i.e. an ActivityPub response of "Accept" is always returned). The "accept-list" policy only accepts a "Follow" or "Invite" witness request IF the actor of the request is included in an "accept list" of the destination server. So, if the actor of the request is NOT in the accept list, then a "Reject" activity is returned to the requestor.

The "accept list" is managed by a new REST endpoint: /services/orb/acceptlist. A POST request updates the accept list to add or remove actor URIs, and a GET request retrieves the current accept list. The GET request may include a parameter, "type" (e.g. "follow", "invite-witness") so that only the URIs of the given type are returned. If no "type" parameter is specified then accept lists of all types are returned.

This commit also reduces the number of DEBUG logs that are emitted.

closes trustbloc#352
closes trustbloc#353

Signed-off-by: Bob Stasyszyn <Bob.Stasyszyn@securekey.com>
@cla-bot cla-bot bot added the cla-signed label Nov 9, 2021
@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #867 (1d530d8) into main (0e89ab9) will increase coverage by 0.08%.
The diff coverage is 89.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
+ Coverage   89.24%   89.32%   +0.08%     
==========================================
  Files         148      151       +3     
  Lines       13177    13494     +317     
==========================================
+ Hits        11760    12054     +294     
- Misses        872      886      +14     
- Partials      545      554       +9     
Impacted Files Coverage Δ
pkg/errors/errors.go 88.88% <0.00%> (-11.12%) ⬇️
pkg/store/witness/witness.go 90.80% <ø> (-0.06%) ⬇️
cmd/orb-server/startcmd/start.go 72.97% <42.10%> (-0.70%) ⬇️
pkg/activitypub/service/acceptlist/acceptlist.go 87.39% <87.39%> (ø)
cmd/orb-server/startcmd/params.go 80.33% <87.50%> (+0.45%) ⬆️
pkg/activitypub/resthandler/acceptlisthandler.go 97.63% <97.63%> (ø)
pkg/activitypub/resthandler/resthandler.go 91.44% <100.00%> (+0.23%) ⬆️
...b/service/activityhandler/acceptlistauthhandler.go 100.00% <100.00%> (ø)
...vitypub/service/activityhandler/activityhandler.go 100.00% <100.00%> (ø)
...ctivitypub/service/activityhandler/inboxhandler.go 85.29% <100.00%> (+0.34%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e89ab9...1d530d8. Read the comment docs.

@fqutishat fqutishat merged commit ecebebb into trustbloc:main Nov 10, 2021
@bstasyszyn bstasyszyn deleted the 353 branch November 10, 2021 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow auth handler Witness invitation auth handler
3 participants