{"action":"created","comment":{"url":"https://api.github.com/repos/storj/storj/pulls/comments/221660513","pull_request_review_id":160363110,"id":221660513,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTY2MDUxMw==","diff_hunk":"@@ -0,0 +1,88 @@\n+// Copyright (C) 2018 Storj Labs, Inc.\n+// See LICENSE for copying information.\n+\n+package auth\n+\n+import (\n+\t\"context\"\n+\t\"crypto/ecdsa\"\n+\t\"encoding/base64\"\n+\t\"strings\"\n+\n+\t\"github.com/gogo/protobuf/proto\"\n+\t\"github.com/grpc-ecosystem/go-grpc-middleware/util/metautils\"\n+\t\"github.com/gtank/cryptopasta\"\n+\t\"google.golang.org/grpc\"\n+\t\"google.golang.org/grpc/codes\"\n+\t\"google.golang.org/grpc/metadata\"\n+\t\"google.golang.org/grpc/status\"\n+\n+\t\"storj.io/storj/pkg/pb\"\n+\t\"storj.io/storj/pkg/pointerdb/auth\"\n+\t\"storj.io/storj/pkg/provider\"\n+)\n+\n+// ResponseGenerator interface for generating signature\n+type ResponseGenerator interface {\n+\tGenerate(ctx context.Context) error\n+}\n+\n+// NewSatelliteAuthenticator creates instance of satellite authenticator\n+func NewSatelliteAuthenticator(generator ResponseGenerator) grpc.UnaryServerInterceptor {\n+\treturn func(ctx context.Context, req interface{},\n+\t\tinfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{},\n+\t\terr error) {\n+\n+\t\t// TODO(michal) we can extend auth to overlay requests also\n+\t\tif strings.HasPrefix(info.FullMethod, \"/pointerdb\") {\n+\t\t\tAPIKey := metautils.ExtractIncoming(ctx).Get(\"apikey\")\n+\t\t\tif !auth.ValidateAPIKey(APIKey) {\n+\t\t\t\treturn nil, status.Errorf(codes.Unauthenticated, \"Invalid API credential\")\n+\t\t\t}\n+\n+\t\t\terr := generator.Generate(ctx)\n+\t\t\tif err != nil {\n+\t\t\t\treturn nil, status.Errorf(codes.Internal, \"%v\", err)\n+\t\t\t}\n+\t\t}\n+\n+\t\treturn handler(ctx, req)\n+\t}\n+}\n+\n+type defaultResponseGenerator struct {\n+\tidentity *provider.FullIdentity\n+}\n+\n+// NewResponseGenerator creates default response generator based on identity\n+func NewResponseGenerator(identity *provider.FullIdentity) ResponseGenerator {\n+\treturn &defaultResponseGenerator{identity: identity}\n+}\n+\n+func (s *defaultResponseGenerator) Generate(ctx context.Context) error {\n+\tpbd := &pb.PayerBandwidthAllocation_Data{Payer: s.identity.ID.Bytes(), MaxSize: -1, ExpirationUnixSec: -1}\n+\tserializedPbd, err := proto.Marshal(pbd)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tsignature, err := cryptopasta.Sign(serializedPbd, s.identity.Key.(*ecdsa.PrivateKey))\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tpba := &pb.PayerBandwidthAllocation{Data: serializedPbd, Signature: signature}","path":"pkg/satellite/auth/authentication.go","position":74,"original_position":74,"commit_id":"42801c8b843c14f242f811b18779ebe29b13e7f1","original_commit_id":"42801c8b843c14f242f811b18779ebe29b13e7f1","user":{"login":"aleitner","id":7276007,"node_id":"MDQ6VXNlcjcyNzYwMDc=","avatar_url":"https://avatars3.githubusercontent.com/u/7276007?v=4","gravatar_id":"","url":"https://api.github.com/users/aleitner","html_url":"https://github.com/aleitner","followers_url":"https://api.github.com/users/aleitner/followers","following_url":"https://api.github.com/users/aleitner/following{/other_user}","gists_url":"https://api.github.com/users/aleitner/gists{/gist_id}","starred_url":"https://api.github.com/users/aleitner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleitner/subscriptions","organizations_url":"https://api.github.com/users/aleitner/orgs","repos_url":"https://api.github.com/users/aleitner/repos","events_url":"https://api.github.com/users/aleitner/events{/privacy}","received_events_url":"https://api.github.com/users/aleitner/received_events","type":"User","site_admin":false},"body":"This PR is returning a serialized PayerBandwidthAllocation with the signature inside, but don't we only want to return a signature? Delete and Meta methods for the storage nodes should require a signature but don't have a bandwidth allocation message","created_at":"2018-10-01T15:49:46Z","updated_at":"2018-10-01T15:49:46Z","html_url":"https://github.com/storj/storj/pull/383#discussion_r221660513","pull_request_url":"https://api.github.com/repos/storj/storj/pulls/383","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/storj/storj/pulls/comments/221660513"},"html":{"href":"https://github.com/storj/storj/pull/383#discussion_r221660513"},"pull_request":{"href":"https://api.github.com/repos/storj/storj/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/storj/storj/pulls/383","id":218059723,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4MDU5NzIz","html_url":"https://github.com/storj/storj/pull/383","diff_url":"https://github.com/storj/storj/pull/383.diff","patch_url":"https://github.com/storj/storj/pull/383.patch","issue_url":"https://api.github.com/repos/storj/storj/issues/383","number":383,"state":"open","locked":false,"title":"Satellite signs proofs","user":{"login":"mniewrzal","id":7313031,"node_id":"MDQ6VXNlcjczMTMwMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/7313031?v=4","gravatar_id":"","url":"https://api.github.com/users/mniewrzal","html_url":"https://github.com/mniewrzal","followers_url":"https://api.github.com/users/mniewrzal/followers","following_url":"https://api.github.com/users/mniewrzal/following{/other_user}","gists_url":"https://api.github.com/users/mniewrzal/gists{/gist_id}","starred_url":"https://api.github.com/users/mniewrzal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mniewrzal/subscriptions","organizations_url":"https://api.github.com/users/mniewrzal/orgs","repos_url":"https://api.github.com/users/mniewrzal/repos","events_url":"https://api.github.com/users/mniewrzal/events{/privacy}","received_events_url":"https://api.github.com/users/mniewrzal/received_events","type":"User","site_admin":false},"body":"The code is a chaos right now and is far from finished but general idea is to remove api key from pointerdb api and make authentication independent from satellite elements. Api key is passed via context to request interceptor and there validation is done. When api key is valid we can return to uplink generated signature in response header. I still need to figure out many things but I want to be sure that the general idea is ok :)","created_at":"2018-09-25T17:27:03Z","updated_at":"2018-10-01T15:49:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e14059cd1903f70b3050e138e412f8a92e87979c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"egonelbre","id":192964,"node_id":"MDQ6VXNlcjE5Mjk2NA==","avatar_url":"https://avatars1.githubusercontent.com/u/192964?v=4","gravatar_id":"","url":"https://api.github.com/users/egonelbre","html_url":"https://github.com/egonelbre","followers_url":"https://api.github.com/users/egonelbre/followers","following_url":"https://api.github.com/users/egonelbre/following{/other_user}","gists_url":"https://api.github.com/users/egonelbre/gists{/gist_id}","starred_url":"https://api.github.com/users/egonelbre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egonelbre/subscriptions","organizations_url":"https://api.github.com/users/egonelbre/orgs","repos_url":"https://api.github.com/users/egonelbre/repos","events_url":"https://api.github.com/users/egonelbre/events{/privacy}","received_events_url":"https://api.github.com/users/egonelbre/received_events","type":"User","site_admin":false},{"login":"kaloyan-raev","id":468091,"node_id":"MDQ6VXNlcjQ2ODA5MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/468091?v=4","gravatar_id":"","url":"https://api.github.com/users/kaloyan-raev","html_url":"https://github.com/kaloyan-raev","followers_url":"https://api.github.com/users/kaloyan-raev/followers","following_url":"https://api.github.com/users/kaloyan-raev/following{/other_user}","gists_url":"https://api.github.com/users/kaloyan-raev/gists{/gist_id}","starred_url":"https://api.github.com/users/kaloyan-raev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaloyan-raev/subscriptions","organizations_url":"https://api.github.com/users/kaloyan-raev/orgs","repos_url":"https://api.github.com/users/kaloyan-raev/repos","events_url":"https://api.github.com/users/kaloyan-raev/events{/privacy}","received_events_url":"https://api.github.com/users/kaloyan-raev/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":982933521,"node_id":"MDU6TGFiZWw5ODI5MzM1MjE=","url":"https://api.github.com/repos/storj/storj/labels/cla-signed","name":"cla-signed","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/storj/storj/pulls/383/commits","review_comments_url":"https://api.github.com/repos/storj/storj/pulls/383/comments","review_comment_url":"https://api.github.com/repos/storj/storj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/storj/storj/issues/383/comments","statuses_url":"https://api.github.com/repos/storj/storj/statuses/42801c8b843c14f242f811b18779ebe29b13e7f1","head":{"label":"storj:satellite-signs-proofs","ref":"satellite-signs-proofs","sha":"42801c8b843c14f242f811b18779ebe29b13e7f1","user":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"repo":{"id":128089774,"node_id":"MDEwOlJlcG9zaXRvcnkxMjgwODk3NzQ=","name":"storj","full_name":"storj/storj","private":false,"owner":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/storj/storj","description":"Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.","fork":false,"url":"https://api.github.com/repos/storj/storj","forks_url":"https://api.github.com/repos/storj/storj/forks","keys_url":"https://api.github.com/repos/storj/storj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storj/storj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storj/storj/teams","hooks_url":"https://api.github.com/repos/storj/storj/hooks","issue_events_url":"https://api.github.com/repos/storj/storj/issues/events{/number}","events_url":"https://api.github.com/repos/storj/storj/events","assignees_url":"https://api.github.com/repos/storj/storj/assignees{/user}","branches_url":"https://api.github.com/repos/storj/storj/branches{/branch}","tags_url":"https://api.github.com/repos/storj/storj/tags","blobs_url":"https://api.github.com/repos/storj/storj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storj/storj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storj/storj/git/refs{/sha}","trees_url":"https://api.github.com/repos/storj/storj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storj/storj/statuses/{sha}","languages_url":"https://api.github.com/repos/storj/storj/languages","stargazers_url":"https://api.github.com/repos/storj/storj/stargazers","contributors_url":"https://api.github.com/repos/storj/storj/contributors","subscribers_url":"https://api.github.com/repos/storj/storj/subscribers","subscription_url":"https://api.github.com/repos/storj/storj/subscription","commits_url":"https://api.github.com/repos/storj/storj/commits{/sha}","git_commits_url":"https://api.github.com/repos/storj/storj/git/commits{/sha}","comments_url":"https://api.github.com/repos/storj/storj/comments{/number}","issue_comment_url":"https://api.github.com/repos/storj/storj/issues/comments{/number}","contents_url":"https://api.github.com/repos/storj/storj/contents/{+path}","compare_url":"https://api.github.com/repos/storj/storj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storj/storj/merges","archive_url":"https://api.github.com/repos/storj/storj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storj/storj/downloads","issues_url":"https://api.github.com/repos/storj/storj/issues{/number}","pulls_url":"https://api.github.com/repos/storj/storj/pulls{/number}","milestones_url":"https://api.github.com/repos/storj/storj/milestones{/number}","notifications_url":"https://api.github.com/repos/storj/storj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storj/storj/labels{/name}","releases_url":"https://api.github.com/repos/storj/storj/releases{/id}","deployments_url":"https://api.github.com/repos/storj/storj/deployments","created_at":"2018-04-04T16:27:18Z","updated_at":"2018-10-01T11:29:31Z","pushed_at":"2018-10-01T15:34:02Z","git_url":"git://github.com/storj/storj.git","ssh_url":"git@github.com:storj/storj.git","clone_url":"https://github.com/storj/storj.git","svn_url":"https://github.com/storj/storj","homepage":"https://storj.io","size":61227,"stargazers_count":232,"watchers_count":232,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":49,"open_issues":16,"watchers":232,"default_branch":"master"}},"base":{"label":"storj:master","ref":"master","sha":"c9cabaf73a05c82e07d7ad0eb89aa228a66a63e4","user":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"repo":{"id":128089774,"node_id":"MDEwOlJlcG9zaXRvcnkxMjgwODk3NzQ=","name":"storj","full_name":"storj/storj","private":false,"owner":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/storj/storj","description":"Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.","fork":false,"url":"https://api.github.com/repos/storj/storj","forks_url":"https://api.github.com/repos/storj/storj/forks","keys_url":"https://api.github.com/repos/storj/storj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storj/storj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storj/storj/teams","hooks_url":"https://api.github.com/repos/storj/storj/hooks","issue_events_url":"https://api.github.com/repos/storj/storj/issues/events{/number}","events_url":"https://api.github.com/repos/storj/storj/events","assignees_url":"https://api.github.com/repos/storj/storj/assignees{/user}","branches_url":"https://api.github.com/repos/storj/storj/branches{/branch}","tags_url":"https://api.github.com/repos/storj/storj/tags","blobs_url":"https://api.github.com/repos/storj/storj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storj/storj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storj/storj/git/refs{/sha}","trees_url":"https://api.github.com/repos/storj/storj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storj/storj/statuses/{sha}","languages_url":"https://api.github.com/repos/storj/storj/languages","stargazers_url":"https://api.github.com/repos/storj/storj/stargazers","contributors_url":"https://api.github.com/repos/storj/storj/contributors","subscribers_url":"https://api.github.com/repos/storj/storj/subscribers","subscription_url":"https://api.github.com/repos/storj/storj/subscription","commits_url":"https://api.github.com/repos/storj/storj/commits{/sha}","git_commits_url":"https://api.github.com/repos/storj/storj/git/commits{/sha}","comments_url":"https://api.github.com/repos/storj/storj/comments{/number}","issue_comment_url":"https://api.github.com/repos/storj/storj/issues/comments{/number}","contents_url":"https://api.github.com/repos/storj/storj/contents/{+path}","compare_url":"https://api.github.com/repos/storj/storj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storj/storj/merges","archive_url":"https://api.github.com/repos/storj/storj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storj/storj/downloads","issues_url":"https://api.github.com/repos/storj/storj/issues{/number}","pulls_url":"https://api.github.com/repos/storj/storj/pulls{/number}","milestones_url":"https://api.github.com/repos/storj/storj/milestones{/number}","notifications_url":"https://api.github.com/repos/storj/storj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storj/storj/labels{/name}","releases_url":"https://api.github.com/repos/storj/storj/releases{/id}","deployments_url":"https://api.github.com/repos/storj/storj/deployments","created_at":"2018-04-04T16:27:18Z","updated_at":"2018-10-01T11:29:31Z","pushed_at":"2018-10-01T15:34:02Z","git_url":"git://github.com/storj/storj.git","ssh_url":"git@github.com:storj/storj.git","clone_url":"https://github.com/storj/storj.git","svn_url":"https://github.com/storj/storj","homepage":"https://storj.io","size":61227,"stargazers_count":232,"watchers_count":232,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":49,"open_issues":16,"watchers":232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/storj/storj/pulls/383"},"html":{"href":"https://github.com/storj/storj/pull/383"},"issue":{"href":"https://api.github.com/repos/storj/storj/issues/383"},"comments":{"href":"https://api.github.com/repos/storj/storj/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/storj/storj/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/storj/storj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/storj/storj/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/storj/storj/statuses/42801c8b843c14f242f811b18779ebe29b13e7f1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"aleitner"}}