{"action":"created","comment":{"url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/comments/206517972","pull_request_review_id":141939548,"id":206517972,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjUxNzk3Mg==","diff_hunk":"@@ -78,6 +79,63 @@ func MultiLogConfigFromFile(filename string) (*configpb.LogMultiConfig, error) {\n \treturn &cfg, nil\n }\n \n+// ValidateLogConfig checks that a signle log config is valid. In particular:\n+//  - A mirror log has a valid public key and no private key.\n+//  - A non-mirror log has a private, and optionally a public key (both valid).\n+//  - Each of NotBeforeStart and NotBeforeLimit, if set, is a valid timestamp\n+//    proto. If both are set then NotBeforeStart <= NotBeforeLimit.\n+//\n+// TODO(pavelkalinnikov): Return the parsed values so that we don't have to\n+// parse them again after validation.\n+func ValidateLogConfig(cfg *configpb.LogConfig) error {\n+\tif cfg.LogId == 0 {\n+\t\treturn errors.New(\"empty log ID\")\n+\t}\n+\tvar err error\n+\n+\t// Validate the public key.\n+\tpubKey := cfg.PublicKey\n+\tif pubKey != nil {\n+\t\tif _, err = der.UnmarshalPublicKey(pubKey.Der); err != nil {\n+\t\t\treturn fmt.Errorf(\"invalid public key: %v\", err)\n+\t\t}\n+\t} else if cfg.IsMirror {\n+\t\treturn errors.New(\"empty public key\")\n+\t}\n+\n+\t// Validate the private key.\n+\tif !cfg.IsMirror {\n+\t\tif cfg.PrivateKey == nil {\n+\t\t\treturn errors.New(\"empty private key\")\n+\t\t}\n+\t\tvar keyProto ptypes.DynamicAny\n+\t\tif err = ptypes.UnmarshalAny(cfg.PrivateKey, &keyProto); err != nil {\n+\t\t\treturn fmt.Errorf(\"invalid private key: %v\", err)\n+\t\t}\n+\t} else if cfg.PrivateKey != nil {\n+\t\treturn errors.New(\"unnecessary private key\")","path":"trillian/ctfe/config.go","position":46,"original_position":46,"commit_id":"6db577e7536e81f0efa1e4457bd828ca5fddd9a1","original_commit_id":"6db577e7536e81f0efa1e4457bd828ca5fddd9a1","user":{"login":"Martin2112","id":13366863,"node_id":"MDQ6VXNlcjEzMzY2ODYz","avatar_url":"https://avatars2.githubusercontent.com/u/13366863?v=4","gravatar_id":"","url":"https://api.github.com/users/Martin2112","html_url":"https://github.com/Martin2112","followers_url":"https://api.github.com/users/Martin2112/followers","following_url":"https://api.github.com/users/Martin2112/following{/other_user}","gists_url":"https://api.github.com/users/Martin2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin2112/subscriptions","organizations_url":"https://api.github.com/users/Martin2112/orgs","repos_url":"https://api.github.com/users/Martin2112/repos","events_url":"https://api.github.com/users/Martin2112/events{/privacy}","received_events_url":"https://api.github.com/users/Martin2112/received_events","type":"User","site_admin":false},"body":"Error message could be more specific.","created_at":"2018-07-31T13:04:22Z","updated_at":"2018-07-31T13:14:24Z","html_url":"https://github.com/google/certificate-transparency-go/pull/306#discussion_r206517972","pull_request_url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/comments/206517972"},"html":{"href":"https://github.com/google/certificate-transparency-go/pull/306#discussion_r206517972"},"pull_request":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306"}}},"pull_request":{"url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306","id":205100230,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MTAwMjMw","html_url":"https://github.com/google/certificate-transparency-go/pull/306","diff_url":"https://github.com/google/certificate-transparency-go/pull/306.diff","patch_url":"https://github.com/google/certificate-transparency-go/pull/306.patch","issue_url":"https://api.github.com/repos/google/certificate-transparency-go/issues/306","number":306,"state":"open","locked":false,"title":"Introduce individual LogConfig validation","user":{"login":"pavelkalinnikov","id":3757441,"node_id":"MDQ6VXNlcjM3NTc0NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-31T12:46:20Z","updated_at":"2018-07-31T13:14:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b1b4a6c2fb9de12e6f250d60b85f56186f2caa8","assignee":null,"assignees":[],"requested_reviewers":[{"login":"daviddrysdale","id":457208,"node_id":"MDQ6VXNlcjQ1NzIwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/457208?v=4","gravatar_id":"","url":"https://api.github.com/users/daviddrysdale","html_url":"https://github.com/daviddrysdale","followers_url":"https://api.github.com/users/daviddrysdale/followers","following_url":"https://api.github.com/users/daviddrysdale/following{/other_user}","gists_url":"https://api.github.com/users/daviddrysdale/gists{/gist_id}","starred_url":"https://api.github.com/users/daviddrysdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviddrysdale/subscriptions","organizations_url":"https://api.github.com/users/daviddrysdale/orgs","repos_url":"https://api.github.com/users/daviddrysdale/repos","events_url":"https://api.github.com/users/daviddrysdale/events{/privacy}","received_events_url":"https://api.github.com/users/daviddrysdale/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":602120732,"node_id":"MDU6TGFiZWw2MDIxMjA3MzI=","url":"https://api.github.com/repos/google/certificate-transparency-go/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306/commits","review_comments_url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306/comments","review_comment_url":"https://api.github.com/repos/google/certificate-transparency-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/certificate-transparency-go/issues/306/comments","statuses_url":"https://api.github.com/repos/google/certificate-transparency-go/statuses/6db577e7536e81f0efa1e4457bd828ca5fddd9a1","head":{"label":"pavelkalinnikov:validate_log_config","ref":"validate_log_config","sha":"6db577e7536e81f0efa1e4457bd828ca5fddd9a1","user":{"login":"pavelkalinnikov","id":3757441,"node_id":"MDQ6VXNlcjM3NTc0NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"repo":{"id":112630682,"node_id":"MDEwOlJlcG9zaXRvcnkxMTI2MzA2ODI=","name":"certificate-transparency-go","full_name":"pavelkalinnikov/certificate-transparency-go","owner":{"login":"pavelkalinnikov","id":3757441,"node_id":"MDQ6VXNlcjM3NTc0NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pavelkalinnikov/certificate-transparency-go","description":"Auditing for TLS certificates, Go code. ","fork":true,"url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go","forks_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/forks","keys_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/teams","hooks_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/hooks","issue_events_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/issues/events{/number}","events_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/events","assignees_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/assignees{/user}","branches_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/branches{/branch}","tags_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/tags","blobs_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/statuses/{sha}","languages_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/languages","stargazers_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/stargazers","contributors_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/contributors","subscribers_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/subscribers","subscription_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/subscription","commits_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/contents/{+path}","compare_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/merges","archive_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/downloads","issues_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/issues{/number}","pulls_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/pulls{/number}","milestones_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/milestones{/number}","notifications_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/labels{/name}","releases_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/releases{/id}","deployments_url":"https://api.github.com/repos/pavelkalinnikov/certificate-transparency-go/deployments","created_at":"2017-11-30T15:57:17Z","updated_at":"2018-07-31T09:52:20Z","pushed_at":"2018-07-31T12:45:24Z","git_url":"git://github.com/pavelkalinnikov/certificate-transparency-go.git","ssh_url":"git@github.com:pavelkalinnikov/certificate-transparency-go.git","clone_url":"https://github.com/pavelkalinnikov/certificate-transparency-go.git","svn_url":"https://github.com/pavelkalinnikov/certificate-transparency-go","homepage":"http://www.certificate-transparency.org/","size":7051,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"49744098543b4ecaeb3320a45619d29bd719838e","user":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":90636971,"node_id":"MDEwOlJlcG9zaXRvcnk5MDYzNjk3MQ==","name":"certificate-transparency-go","full_name":"google/certificate-transparency-go","owner":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/certificate-transparency-go","description":"Auditing for TLS certificates, Go code. ","fork":false,"url":"https://api.github.com/repos/google/certificate-transparency-go","forks_url":"https://api.github.com/repos/google/certificate-transparency-go/forks","keys_url":"https://api.github.com/repos/google/certificate-transparency-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/certificate-transparency-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/certificate-transparency-go/teams","hooks_url":"https://api.github.com/repos/google/certificate-transparency-go/hooks","issue_events_url":"https://api.github.com/repos/google/certificate-transparency-go/issues/events{/number}","events_url":"https://api.github.com/repos/google/certificate-transparency-go/events","assignees_url":"https://api.github.com/repos/google/certificate-transparency-go/assignees{/user}","branches_url":"https://api.github.com/repos/google/certificate-transparency-go/branches{/branch}","tags_url":"https://api.github.com/repos/google/certificate-transparency-go/tags","blobs_url":"https://api.github.com/repos/google/certificate-transparency-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/certificate-transparency-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/certificate-transparency-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/certificate-transparency-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/certificate-transparency-go/statuses/{sha}","languages_url":"https://api.github.com/repos/google/certificate-transparency-go/languages","stargazers_url":"https://api.github.com/repos/google/certificate-transparency-go/stargazers","contributors_url":"https://api.github.com/repos/google/certificate-transparency-go/contributors","subscribers_url":"https://api.github.com/repos/google/certificate-transparency-go/subscribers","subscription_url":"https://api.github.com/repos/google/certificate-transparency-go/subscription","commits_url":"https://api.github.com/repos/google/certificate-transparency-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/certificate-transparency-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/certificate-transparency-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/certificate-transparency-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/certificate-transparency-go/contents/{+path}","compare_url":"https://api.github.com/repos/google/certificate-transparency-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/certificate-transparency-go/merges","archive_url":"https://api.github.com/repos/google/certificate-transparency-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/certificate-transparency-go/downloads","issues_url":"https://api.github.com/repos/google/certificate-transparency-go/issues{/number}","pulls_url":"https://api.github.com/repos/google/certificate-transparency-go/pulls{/number}","milestones_url":"https://api.github.com/repos/google/certificate-transparency-go/milestones{/number}","notifications_url":"https://api.github.com/repos/google/certificate-transparency-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/certificate-transparency-go/labels{/name}","releases_url":"https://api.github.com/repos/google/certificate-transparency-go/releases{/id}","deployments_url":"https://api.github.com/repos/google/certificate-transparency-go/deployments","created_at":"2017-05-08T14:22:46Z","updated_at":"2018-07-31T09:51:43Z","pushed_at":"2018-07-31T12:46:21Z","git_url":"git://github.com/google/certificate-transparency-go.git","ssh_url":"git@github.com:google/certificate-transparency-go.git","clone_url":"https://github.com/google/certificate-transparency-go.git","svn_url":"https://github.com/google/certificate-transparency-go","homepage":"http://www.certificate-transparency.org/","size":7055,"stargazers_count":91,"watchers_count":91,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":51,"open_issues":11,"watchers":91,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306"},"html":{"href":"https://github.com/google/certificate-transparency-go/pull/306"},"issue":{"href":"https://api.github.com/repos/google/certificate-transparency-go/issues/306"},"comments":{"href":"https://api.github.com/repos/google/certificate-transparency-go/issues/306/comments"},"review_comments":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306/comments"},"review_comment":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/certificate-transparency-go/pulls/306/commits"},"statuses":{"href":"https://api.github.com/repos/google/certificate-transparency-go/statuses/6db577e7536e81f0efa1e4457bd828ca5fddd9a1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Martin2112"}}