{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/comments/170902505","pull_request_review_id":99657503,"id":170902505,"diff_hunk":"@@ -0,0 +1,81 @@\n+package ocspStatusWorker\n+\n+import (\n+\t\"encoding/json\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"crypto/x509\"\n+\n+\t\"github.com/mozilla/tls-observatory/logger\"\n+\t\"github.com/mozilla/tls-observatory/worker\"\n+\t\"golang.org/x/crypto/ocsp\"\n+\t\"bytes\"\n+\t\"crypto\"\n+\t\"time\"\n+\t\"encoding/base64\"\n+)\n+\n+var workerName = \"ocspStatusWorker\"\n+var workerDesc = `Determines a certificate's status via OCSP'`\n+\n+var log = logger.GetLogger()\n+\n+func init() {\n+\tworker.RegisterWorker(workerName, worker.Info{Runner: new(ocspStatusWorker), Description: workerDesc})\n+}\n+\n+type ocspStatusWorker struct {\n+\tstatus OCSPStatus\n+}\n+\n+type OCSPStatus struct {\n+\tStatus int `json:\"status\"`\n+\tRevokedAt time.Time `json:\"revoked_at\"`\n+\n+}\n+\n+type params struct {\n+}\n+\n+func (w ocspStatusWorker) Run(in worker.Input, resChan chan worker.Result) {\n+\tres := worker.Result{WorkerName: workerName, Success:false}\n+\n+\trawCert, _ := base64.StdEncoding.DecodeString(in.CertificateChain.Certs[0])\n+\tcertificate, _ := x509.ParseCertificate(rawCert)\n+\trawIssuerCert, _ := base64.StdEncoding.DecodeString(in.CertificateChain.Certs[1])\n+\tissuerCertificate, _ := x509.ParseCertificate(rawIssuerCert)\n+\n+\topts := &ocsp.RequestOptions{Hash: crypto.SHA256}\n+\treq, err := ocsp.CreateRequest(certificate, issuerCertificate, opts)\n+\tif err != nil {\n+\t\tres.Errors = append(res.Errors, err.Error())\n+\t\treturn\n+\t}\n+\n+\thttpResponse, err := http.Post(certificate.OCSPServer[0], \"application/ocsp-request\", bytes.NewReader(req))\n+\tif err != nil {\n+\t\tres.Errors = append(res.Errors, err.Error())\n+\t\treturn\n+\t}\n+","path":"worker/ocspStatusWorker/ocspStatusWorker.go","position":54,"original_position":60,"commit_id":"e8f9ab87bd5d1e1fa991faa0151363b7da730f9d","original_commit_id":"e8f9ab87bd5d1e1fa991faa0151363b7da730f9d","user":{"login":"jvehent","id":415617,"avatar_url":"https://avatars1.githubusercontent.com/u/415617?v=4","gravatar_id":"","url":"https://api.github.com/users/jvehent","html_url":"https://github.com/jvehent","followers_url":"https://api.github.com/users/jvehent/followers","following_url":"https://api.github.com/users/jvehent/following{/other_user}","gists_url":"https://api.github.com/users/jvehent/gists{/gist_id}","starred_url":"https://api.github.com/users/jvehent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvehent/subscriptions","organizations_url":"https://api.github.com/users/jvehent/orgs","repos_url":"https://api.github.com/users/jvehent/repos","events_url":"https://api.github.com/users/jvehent/events{/privacy}","received_events_url":"https://api.github.com/users/jvehent/received_events","type":"User","site_admin":false},"body":"add a `defer httpResponse.Body.Close()`","created_at":"2018-02-27T12:14:37Z","updated_at":"2018-02-27T12:16:16Z","html_url":"https://github.com/mozilla/tls-observatory/pull/286#discussion_r170902505","pull_request_url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/comments/170902505"},"html":{"href":"https://github.com/mozilla/tls-observatory/pull/286#discussion_r170902505"},"pull_request":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286","id":161250121,"html_url":"https://github.com/mozilla/tls-observatory/pull/286","diff_url":"https://github.com/mozilla/tls-observatory/pull/286.diff","patch_url":"https://github.com/mozilla/tls-observatory/pull/286.patch","issue_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/286","number":286,"state":"open","locked":false,"title":"Added OCSP worker to retrieve certificate status","user":{"login":"fr0zenbits","id":20429006,"avatar_url":"https://avatars0.githubusercontent.com/u/20429006?v=4","gravatar_id":"","url":"https://api.github.com/users/fr0zenbits","html_url":"https://github.com/fr0zenbits","followers_url":"https://api.github.com/users/fr0zenbits/followers","following_url":"https://api.github.com/users/fr0zenbits/following{/other_user}","gists_url":"https://api.github.com/users/fr0zenbits/gists{/gist_id}","starred_url":"https://api.github.com/users/fr0zenbits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fr0zenbits/subscriptions","organizations_url":"https://api.github.com/users/fr0zenbits/orgs","repos_url":"https://api.github.com/users/fr0zenbits/repos","events_url":"https://api.github.com/users/fr0zenbits/events{/privacy}","received_events_url":"https://api.github.com/users/fr0zenbits/received_events","type":"User","site_admin":false},"body":"This is one of my first go projects, so any constructive feedback is appreciated. I know the OCSP code works, but I am not sure if I implemented the worker-releated code correctly. ","created_at":"2018-01-05T00:48:15Z","updated_at":"2018-02-27T12:16:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09eb89297f81f1cefe38af2b947b4936cc94fed4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286/commits","review_comments_url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286/comments","review_comment_url":"https://api.github.com/repos/mozilla/tls-observatory/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/286/comments","statuses_url":"https://api.github.com/repos/mozilla/tls-observatory/statuses/e8f9ab87bd5d1e1fa991faa0151363b7da730f9d","head":{"label":"fr0zenbits:master","ref":"master","sha":"e8f9ab87bd5d1e1fa991faa0151363b7da730f9d","user":{"login":"fr0zenbits","id":20429006,"avatar_url":"https://avatars0.githubusercontent.com/u/20429006?v=4","gravatar_id":"","url":"https://api.github.com/users/fr0zenbits","html_url":"https://github.com/fr0zenbits","followers_url":"https://api.github.com/users/fr0zenbits/followers","following_url":"https://api.github.com/users/fr0zenbits/following{/other_user}","gists_url":"https://api.github.com/users/fr0zenbits/gists{/gist_id}","starred_url":"https://api.github.com/users/fr0zenbits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fr0zenbits/subscriptions","organizations_url":"https://api.github.com/users/fr0zenbits/orgs","repos_url":"https://api.github.com/users/fr0zenbits/repos","events_url":"https://api.github.com/users/fr0zenbits/events{/privacy}","received_events_url":"https://api.github.com/users/fr0zenbits/received_events","type":"User","site_admin":false},"repo":{"id":116203127,"name":"tls-observatory","full_name":"fr0zenbits/tls-observatory","owner":{"login":"fr0zenbits","id":20429006,"avatar_url":"https://avatars0.githubusercontent.com/u/20429006?v=4","gravatar_id":"","url":"https://api.github.com/users/fr0zenbits","html_url":"https://github.com/fr0zenbits","followers_url":"https://api.github.com/users/fr0zenbits/followers","following_url":"https://api.github.com/users/fr0zenbits/following{/other_user}","gists_url":"https://api.github.com/users/fr0zenbits/gists{/gist_id}","starred_url":"https://api.github.com/users/fr0zenbits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fr0zenbits/subscriptions","organizations_url":"https://api.github.com/users/fr0zenbits/orgs","repos_url":"https://api.github.com/users/fr0zenbits/repos","events_url":"https://api.github.com/users/fr0zenbits/events{/privacy}","received_events_url":"https://api.github.com/users/fr0zenbits/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fr0zenbits/tls-observatory","description":"An observatory for TLS configurations, X509 certificates, and more.","fork":true,"url":"https://api.github.com/repos/fr0zenbits/tls-observatory","forks_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/forks","keys_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/teams","hooks_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/hooks","issue_events_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/issues/events{/number}","events_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/events","assignees_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/assignees{/user}","branches_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/branches{/branch}","tags_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/tags","blobs_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/git/refs{/sha}","trees_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/statuses/{sha}","languages_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/languages","stargazers_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/stargazers","contributors_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/contributors","subscribers_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/subscribers","subscription_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/subscription","commits_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/commits{/sha}","git_commits_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/git/commits{/sha}","comments_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/comments{/number}","issue_comment_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/issues/comments{/number}","contents_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/contents/{+path}","compare_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/merges","archive_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/downloads","issues_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/issues{/number}","pulls_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/pulls{/number}","milestones_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/milestones{/number}","notifications_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/labels{/name}","releases_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/releases{/id}","deployments_url":"https://api.github.com/repos/fr0zenbits/tls-observatory/deployments","created_at":"2018-01-04T02:10:50Z","updated_at":"2018-01-04T02:10:52Z","pushed_at":"2018-02-27T00:41:28Z","git_url":"git://github.com/fr0zenbits/tls-observatory.git","ssh_url":"git@github.com:fr0zenbits/tls-observatory.git","clone_url":"https://github.com/fr0zenbits/tls-observatory.git","svn_url":"https://github.com/fr0zenbits/tls-observatory","homepage":"","size":111424,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"1cbd734ed3c245baf67e6928e62b4aa1e91affa3","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":23923847,"name":"tls-observatory","full_name":"mozilla/tls-observatory","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/tls-observatory","description":"An observatory for TLS configurations, X509 certificates, and more.","fork":false,"url":"https://api.github.com/repos/mozilla/tls-observatory","forks_url":"https://api.github.com/repos/mozilla/tls-observatory/forks","keys_url":"https://api.github.com/repos/mozilla/tls-observatory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/tls-observatory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/tls-observatory/teams","hooks_url":"https://api.github.com/repos/mozilla/tls-observatory/hooks","issue_events_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/tls-observatory/events","assignees_url":"https://api.github.com/repos/mozilla/tls-observatory/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/tls-observatory/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/tls-observatory/tags","blobs_url":"https://api.github.com/repos/mozilla/tls-observatory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/tls-observatory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/tls-observatory/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/tls-observatory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/tls-observatory/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/tls-observatory/languages","stargazers_url":"https://api.github.com/repos/mozilla/tls-observatory/stargazers","contributors_url":"https://api.github.com/repos/mozilla/tls-observatory/contributors","subscribers_url":"https://api.github.com/repos/mozilla/tls-observatory/subscribers","subscription_url":"https://api.github.com/repos/mozilla/tls-observatory/subscription","commits_url":"https://api.github.com/repos/mozilla/tls-observatory/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/tls-observatory/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/tls-observatory/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/tls-observatory/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/tls-observatory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/tls-observatory/merges","archive_url":"https://api.github.com/repos/mozilla/tls-observatory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/tls-observatory/downloads","issues_url":"https://api.github.com/repos/mozilla/tls-observatory/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/tls-observatory/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/tls-observatory/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/tls-observatory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/tls-observatory/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/tls-observatory/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/tls-observatory/deployments","created_at":"2014-09-11T15:23:25Z","updated_at":"2018-02-27T12:08:09Z","pushed_at":"2018-02-27T11:24:46Z","git_url":"git://github.com/mozilla/tls-observatory.git","ssh_url":"git@github.com:mozilla/tls-observatory.git","clone_url":"https://github.com/mozilla/tls-observatory.git","svn_url":"https://github.com/mozilla/tls-observatory","homepage":"","size":109823,"stargazers_count":315,"watchers_count":315,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":58,"open_issues":51,"watchers":315,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286"},"html":{"href":"https://github.com/mozilla/tls-observatory/pull/286"},"issue":{"href":"https://api.github.com/repos/mozilla/tls-observatory/issues/286"},"comments":{"href":"https://api.github.com/repos/mozilla/tls-observatory/issues/286/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/tls-observatory/pulls/286/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/tls-observatory/statuses/e8f9ab87bd5d1e1fa991faa0151363b7da730f9d"}},"author_association":"NONE"}}
{"actor":{"display_login":"jvehent"}}