{"action":"created","comment":{"url":"https://api.github.com/repos/googledatalab/datalab/pulls/comments/190682255","pull_request_review_id":123112177,"id":190682255,"diff_hunk":"@@ -299,6 +299,17 @@ function stopVmHandler(request: http.ServerRequest, response: http.ServerRespons\n }\n \n function socketHandler(request: http.ServerRequest, socket: net.Socket, head: Buffer) {\n+  // Websocket requests aren't CORS-checked by the browser. Reject any CORS\n+  // requests here by checking their host vs origin request headers.\n+  // Origin headers contain the protocol, while host headers do not, so we strip\n+  // it off the origin header before matching.\n+  if (request.headers.origin &&\n+    request.headers.origin.replace(/^.*\\/\\//, '') !== request.headers.host) {","path":"sources/web/datalab/server.ts","position":9,"original_position":9,"commit_id":"515504dfd7686f0782520a0dcb7f092243b4a901","original_commit_id":"515504dfd7686f0782520a0dcb7f092243b4a901","user":{"login":"yebrahim","id":1424661,"avatar_url":"https://avatars2.githubusercontent.com/u/1424661?v=4","gravatar_id":"","url":"https://api.github.com/users/yebrahim","html_url":"https://github.com/yebrahim","followers_url":"https://api.github.com/users/yebrahim/followers","following_url":"https://api.github.com/users/yebrahim/following{/other_user}","gists_url":"https://api.github.com/users/yebrahim/gists{/gist_id}","starred_url":"https://api.github.com/users/yebrahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yebrahim/subscriptions","organizations_url":"https://api.github.com/users/yebrahim/orgs","repos_url":"https://api.github.com/users/yebrahim/repos","events_url":"https://api.github.com/users/yebrahim/events{/privacy}","received_events_url":"https://api.github.com/users/yebrahim/received_events","type":"User","site_admin":false},"body":"Sure.\r\nDo we see any instances where this can be `ws://`?","created_at":"2018-05-24T18:14:31Z","updated_at":"2018-05-24T18:14:31Z","html_url":"https://github.com/googledatalab/datalab/pull/2011#discussion_r190682255","pull_request_url":"https://api.github.com/repos/googledatalab/datalab/pulls/2011","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/comments/190682255"},"html":{"href":"https://github.com/googledatalab/datalab/pull/2011#discussion_r190682255"},"pull_request":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/2011"}},"in_reply_to_id":190680753},"pull_request":{"url":"https://api.github.com/repos/googledatalab/datalab/pulls/2011","id":190095813,"html_url":"https://github.com/googledatalab/datalab/pull/2011","diff_url":"https://github.com/googledatalab/datalab/pull/2011.diff","patch_url":"https://github.com/googledatalab/datalab/pull/2011.patch","issue_url":"https://api.github.com/repos/googledatalab/datalab/issues/2011","number":2011,"state":"open","locked":false,"title":"Reject CORS websocket requests","user":{"login":"yebrahim","id":1424661,"avatar_url":"https://avatars2.githubusercontent.com/u/1424661?v=4","gravatar_id":"","url":"https://api.github.com/users/yebrahim","html_url":"https://github.com/yebrahim","followers_url":"https://api.github.com/users/yebrahim/followers","following_url":"https://api.github.com/users/yebrahim/following{/other_user}","gists_url":"https://api.github.com/users/yebrahim/gists{/gist_id}","starred_url":"https://api.github.com/users/yebrahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yebrahim/subscriptions","organizations_url":"https://api.github.com/users/yebrahim/orgs","repos_url":"https://api.github.com/users/yebrahim/repos","events_url":"https://api.github.com/users/yebrahim/events{/privacy}","received_events_url":"https://api.github.com/users/yebrahim/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-23T20:30:20Z","updated_at":"2018-05-24T18:14:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cb2012d6b04db90cc0aba6e9d0bdd7d710b1ec5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rileyjbauer","id":34456002,"avatar_url":"https://avatars0.githubusercontent.com/u/34456002?v=4","gravatar_id":"","url":"https://api.github.com/users/rileyjbauer","html_url":"https://github.com/rileyjbauer","followers_url":"https://api.github.com/users/rileyjbauer/followers","following_url":"https://api.github.com/users/rileyjbauer/following{/other_user}","gists_url":"https://api.github.com/users/rileyjbauer/gists{/gist_id}","starred_url":"https://api.github.com/users/rileyjbauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rileyjbauer/subscriptions","organizations_url":"https://api.github.com/users/rileyjbauer/orgs","repos_url":"https://api.github.com/users/rileyjbauer/repos","events_url":"https://api.github.com/users/rileyjbauer/events{/privacy}","received_events_url":"https://api.github.com/users/rileyjbauer/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/googledatalab/datalab/pulls/2011/commits","review_comments_url":"https://api.github.com/repos/googledatalab/datalab/pulls/2011/comments","review_comment_url":"https://api.github.com/repos/googledatalab/datalab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googledatalab/datalab/issues/2011/comments","statuses_url":"https://api.github.com/repos/googledatalab/datalab/statuses/515504dfd7686f0782520a0dcb7f092243b4a901","head":{"label":"googledatalab:websocket-cors","ref":"websocket-cors","sha":"515504dfd7686f0782520a0dcb7f092243b4a901","user":{"login":"googledatalab","id":18582876,"avatar_url":"https://avatars0.githubusercontent.com/u/18582876?v=4","gravatar_id":"","url":"https://api.github.com/users/googledatalab","html_url":"https://github.com/googledatalab","followers_url":"https://api.github.com/users/googledatalab/followers","following_url":"https://api.github.com/users/googledatalab/following{/other_user}","gists_url":"https://api.github.com/users/googledatalab/gists{/gist_id}","starred_url":"https://api.github.com/users/googledatalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googledatalab/subscriptions","organizations_url":"https://api.github.com/users/googledatalab/orgs","repos_url":"https://api.github.com/users/googledatalab/repos","events_url":"https://api.github.com/users/googledatalab/events{/privacy}","received_events_url":"https://api.github.com/users/googledatalab/received_events","type":"Organization","site_admin":false},"repo":{"id":22693761,"name":"datalab","full_name":"googledatalab/datalab","owner":{"login":"googledatalab","id":18582876,"avatar_url":"https://avatars0.githubusercontent.com/u/18582876?v=4","gravatar_id":"","url":"https://api.github.com/users/googledatalab","html_url":"https://github.com/googledatalab","followers_url":"https://api.github.com/users/googledatalab/followers","following_url":"https://api.github.com/users/googledatalab/following{/other_user}","gists_url":"https://api.github.com/users/googledatalab/gists{/gist_id}","starred_url":"https://api.github.com/users/googledatalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googledatalab/subscriptions","organizations_url":"https://api.github.com/users/googledatalab/orgs","repos_url":"https://api.github.com/users/googledatalab/repos","events_url":"https://api.github.com/users/googledatalab/events{/privacy}","received_events_url":"https://api.github.com/users/googledatalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googledatalab/datalab","description":"Interactive tools and developer experiences for Big Data on Google Cloud Platform.","fork":false,"url":"https://api.github.com/repos/googledatalab/datalab","forks_url":"https://api.github.com/repos/googledatalab/datalab/forks","keys_url":"https://api.github.com/repos/googledatalab/datalab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googledatalab/datalab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googledatalab/datalab/teams","hooks_url":"https://api.github.com/repos/googledatalab/datalab/hooks","issue_events_url":"https://api.github.com/repos/googledatalab/datalab/issues/events{/number}","events_url":"https://api.github.com/repos/googledatalab/datalab/events","assignees_url":"https://api.github.com/repos/googledatalab/datalab/assignees{/user}","branches_url":"https://api.github.com/repos/googledatalab/datalab/branches{/branch}","tags_url":"https://api.github.com/repos/googledatalab/datalab/tags","blobs_url":"https://api.github.com/repos/googledatalab/datalab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googledatalab/datalab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googledatalab/datalab/git/refs{/sha}","trees_url":"https://api.github.com/repos/googledatalab/datalab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googledatalab/datalab/statuses/{sha}","languages_url":"https://api.github.com/repos/googledatalab/datalab/languages","stargazers_url":"https://api.github.com/repos/googledatalab/datalab/stargazers","contributors_url":"https://api.github.com/repos/googledatalab/datalab/contributors","subscribers_url":"https://api.github.com/repos/googledatalab/datalab/subscribers","subscription_url":"https://api.github.com/repos/googledatalab/datalab/subscription","commits_url":"https://api.github.com/repos/googledatalab/datalab/commits{/sha}","git_commits_url":"https://api.github.com/repos/googledatalab/datalab/git/commits{/sha}","comments_url":"https://api.github.com/repos/googledatalab/datalab/comments{/number}","issue_comment_url":"https://api.github.com/repos/googledatalab/datalab/issues/comments{/number}","contents_url":"https://api.github.com/repos/googledatalab/datalab/contents/{+path}","compare_url":"https://api.github.com/repos/googledatalab/datalab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googledatalab/datalab/merges","archive_url":"https://api.github.com/repos/googledatalab/datalab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googledatalab/datalab/downloads","issues_url":"https://api.github.com/repos/googledatalab/datalab/issues{/number}","pulls_url":"https://api.github.com/repos/googledatalab/datalab/pulls{/number}","milestones_url":"https://api.github.com/repos/googledatalab/datalab/milestones{/number}","notifications_url":"https://api.github.com/repos/googledatalab/datalab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googledatalab/datalab/labels{/name}","releases_url":"https://api.github.com/repos/googledatalab/datalab/releases{/id}","deployments_url":"https://api.github.com/repos/googledatalab/datalab/deployments","created_at":"2014-08-06T18:37:34Z","updated_at":"2018-05-24T03:20:43Z","pushed_at":"2018-05-24T18:05:04Z","git_url":"git://github.com/googledatalab/datalab.git","ssh_url":"git@github.com:googledatalab/datalab.git","clone_url":"https://github.com/googledatalab/datalab.git","svn_url":"https://github.com/googledatalab/datalab","homepage":"","size":25478,"stargazers_count":711,"watchers_count":711,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":179,"mirror_url":null,"archived":false,"open_issues_count":186,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":179,"open_issues":186,"watchers":711,"default_branch":"master"}},"base":{"label":"googledatalab:master","ref":"master","sha":"b330e34ff03420cf2019db3ed7ae086c355a5309","user":{"login":"googledatalab","id":18582876,"avatar_url":"https://avatars0.githubusercontent.com/u/18582876?v=4","gravatar_id":"","url":"https://api.github.com/users/googledatalab","html_url":"https://github.com/googledatalab","followers_url":"https://api.github.com/users/googledatalab/followers","following_url":"https://api.github.com/users/googledatalab/following{/other_user}","gists_url":"https://api.github.com/users/googledatalab/gists{/gist_id}","starred_url":"https://api.github.com/users/googledatalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googledatalab/subscriptions","organizations_url":"https://api.github.com/users/googledatalab/orgs","repos_url":"https://api.github.com/users/googledatalab/repos","events_url":"https://api.github.com/users/googledatalab/events{/privacy}","received_events_url":"https://api.github.com/users/googledatalab/received_events","type":"Organization","site_admin":false},"repo":{"id":22693761,"name":"datalab","full_name":"googledatalab/datalab","owner":{"login":"googledatalab","id":18582876,"avatar_url":"https://avatars0.githubusercontent.com/u/18582876?v=4","gravatar_id":"","url":"https://api.github.com/users/googledatalab","html_url":"https://github.com/googledatalab","followers_url":"https://api.github.com/users/googledatalab/followers","following_url":"https://api.github.com/users/googledatalab/following{/other_user}","gists_url":"https://api.github.com/users/googledatalab/gists{/gist_id}","starred_url":"https://api.github.com/users/googledatalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googledatalab/subscriptions","organizations_url":"https://api.github.com/users/googledatalab/orgs","repos_url":"https://api.github.com/users/googledatalab/repos","events_url":"https://api.github.com/users/googledatalab/events{/privacy}","received_events_url":"https://api.github.com/users/googledatalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googledatalab/datalab","description":"Interactive tools and developer experiences for Big Data on Google Cloud Platform.","fork":false,"url":"https://api.github.com/repos/googledatalab/datalab","forks_url":"https://api.github.com/repos/googledatalab/datalab/forks","keys_url":"https://api.github.com/repos/googledatalab/datalab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googledatalab/datalab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googledatalab/datalab/teams","hooks_url":"https://api.github.com/repos/googledatalab/datalab/hooks","issue_events_url":"https://api.github.com/repos/googledatalab/datalab/issues/events{/number}","events_url":"https://api.github.com/repos/googledatalab/datalab/events","assignees_url":"https://api.github.com/repos/googledatalab/datalab/assignees{/user}","branches_url":"https://api.github.com/repos/googledatalab/datalab/branches{/branch}","tags_url":"https://api.github.com/repos/googledatalab/datalab/tags","blobs_url":"https://api.github.com/repos/googledatalab/datalab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googledatalab/datalab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googledatalab/datalab/git/refs{/sha}","trees_url":"https://api.github.com/repos/googledatalab/datalab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googledatalab/datalab/statuses/{sha}","languages_url":"https://api.github.com/repos/googledatalab/datalab/languages","stargazers_url":"https://api.github.com/repos/googledatalab/datalab/stargazers","contributors_url":"https://api.github.com/repos/googledatalab/datalab/contributors","subscribers_url":"https://api.github.com/repos/googledatalab/datalab/subscribers","subscription_url":"https://api.github.com/repos/googledatalab/datalab/subscription","commits_url":"https://api.github.com/repos/googledatalab/datalab/commits{/sha}","git_commits_url":"https://api.github.com/repos/googledatalab/datalab/git/commits{/sha}","comments_url":"https://api.github.com/repos/googledatalab/datalab/comments{/number}","issue_comment_url":"https://api.github.com/repos/googledatalab/datalab/issues/comments{/number}","contents_url":"https://api.github.com/repos/googledatalab/datalab/contents/{+path}","compare_url":"https://api.github.com/repos/googledatalab/datalab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googledatalab/datalab/merges","archive_url":"https://api.github.com/repos/googledatalab/datalab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googledatalab/datalab/downloads","issues_url":"https://api.github.com/repos/googledatalab/datalab/issues{/number}","pulls_url":"https://api.github.com/repos/googledatalab/datalab/pulls{/number}","milestones_url":"https://api.github.com/repos/googledatalab/datalab/milestones{/number}","notifications_url":"https://api.github.com/repos/googledatalab/datalab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googledatalab/datalab/labels{/name}","releases_url":"https://api.github.com/repos/googledatalab/datalab/releases{/id}","deployments_url":"https://api.github.com/repos/googledatalab/datalab/deployments","created_at":"2014-08-06T18:37:34Z","updated_at":"2018-05-24T03:20:43Z","pushed_at":"2018-05-24T18:05:04Z","git_url":"git://github.com/googledatalab/datalab.git","ssh_url":"git@github.com:googledatalab/datalab.git","clone_url":"https://github.com/googledatalab/datalab.git","svn_url":"https://github.com/googledatalab/datalab","homepage":"","size":25478,"stargazers_count":711,"watchers_count":711,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":179,"mirror_url":null,"archived":false,"open_issues_count":186,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":179,"open_issues":186,"watchers":711,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/2011"},"html":{"href":"https://github.com/googledatalab/datalab/pull/2011"},"issue":{"href":"https://api.github.com/repos/googledatalab/datalab/issues/2011"},"comments":{"href":"https://api.github.com/repos/googledatalab/datalab/issues/2011/comments"},"review_comments":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/2011/comments"},"review_comment":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googledatalab/datalab/pulls/2011/commits"},"statuses":{"href":"https://api.github.com/repos/googledatalab/datalab/statuses/515504dfd7686f0782520a0dcb7f092243b4a901"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"yebrahim"}}