{"action":"created","comment":{"url":"https://api.github.com/repos/webgme/webgme/pulls/comments/58564303","id":58564303,"diff_hunk":"@@ -584,9 +585,33 @@ function StandAloneServer(gmeConfig) {\n \n     setupExternalRestModules();\n \n-    // Basic authentication\n+    __app.get(['', '/', '/index.html'], ensureAuthenticated, function (req, res) {\n+        var indexHtmlPath = Path.join(__clientBaseDir, 'index.html'),\n+            protocol = gmeConfig.server.behindSecureProxy ? 'https' : 'http',\n+            host = protocol + '://' + req.get('host'),\n+            url = host + req.originalUrl,\n+            imageUrl = host + '/img/gme-logo.png',\n+            projectId = req.query.project;\n+\n+        logger.debug('resolved url', url);\n+\n+        fs.readFile(indexHtmlPath, 'utf8', function (err, data) {\n+            if (err) {\n+                logger.error(err);\n+                res.send(404);\n+            } else {\n+                res.contentType('text/html');\n+                res.send(\n+                    data.replace(/__URL__/g, url)\n+                        .replace(/__IMAGE_URL__/g, imageUrl)\n+                        .replace(/__TITLE__/g, projectId ? projectId.replace('+', '/') : 'WebGME')","path":"src/server/standalone.js","position":32,"original_position":32,"commit_id":"1254179198c6c4cd7165d2f406379217b6845346","original_commit_id":"1254179198c6c4cd7165d2f406379217b6845346","user":{"login":"ksmyth","id":1047813,"avatar_url":"https://avatars.githubusercontent.com/u/1047813?v=3","gravatar_id":"","url":"https://api.github.com/users/ksmyth","html_url":"https://github.com/ksmyth","followers_url":"https://api.github.com/users/ksmyth/followers","following_url":"https://api.github.com/users/ksmyth/following{/other_user}","gists_url":"https://api.github.com/users/ksmyth/gists{/gist_id}","starred_url":"https://api.github.com/users/ksmyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksmyth/subscriptions","organizations_url":"https://api.github.com/users/ksmyth/orgs","repos_url":"https://api.github.com/users/ksmyth/repos","events_url":"https://api.github.com/users/ksmyth/events{/privacy}","received_events_url":"https://api.github.com/users/ksmyth/received_events","type":"User","site_admin":false},"body":"Need to escape HTML entities here. Current code has a XSS vulnerability (e.g. set projectId to `\"><script>...evil stuff...</script><a href=\"`)","created_at":"2016-04-05T15:54:22Z","updated_at":"2016-04-05T15:54:22Z","html_url":"https://github.com/webgme/webgme/pull/902#discussion_r58564303","pull_request_url":"https://api.github.com/repos/webgme/webgme/pulls/902","_links":{"self":{"href":"https://api.github.com/repos/webgme/webgme/pulls/comments/58564303"},"html":{"href":"https://github.com/webgme/webgme/pull/902#discussion_r58564303"},"pull_request":{"href":"https://api.github.com/repos/webgme/webgme/pulls/902"}}},"pull_request":{"url":"https://api.github.com/repos/webgme/webgme/pulls/902","id":63763618,"html_url":"https://github.com/webgme/webgme/pull/902","diff_url":"https://github.com/webgme/webgme/pull/902.diff","patch_url":"https://github.com/webgme/webgme/pull/902.patch","issue_url":"https://api.github.com/repos/webgme/webgme/issues/902","number":902,"state":"closed","locked":false,"title":"Set www.ogp.me metadata in index.html when requested.","user":{"login":"pmeijer","id":6518904,"avatar_url":"https://avatars.githubusercontent.com/u/6518904?v=3","gravatar_id":"","url":"https://api.github.com/users/pmeijer","html_url":"https://github.com/pmeijer","followers_url":"https://api.github.com/users/pmeijer/followers","following_url":"https://api.github.com/users/pmeijer/following{/other_user}","gists_url":"https://api.github.com/users/pmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/pmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmeijer/subscriptions","organizations_url":"https://api.github.com/users/pmeijer/orgs","repos_url":"https://api.github.com/users/pmeijer/repos","events_url":"https://api.github.com/users/pmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/pmeijer/received_events","type":"User","site_admin":false},"body":"With this metadata e.g. facebook links will be decorated with metadata and images:\r\n\r\nN.B. If behind a secure proxy, `gmeConfig.server.behindSecureProxy` need to be set to `true`.\r\n\r\nFaceBook: (Using [URL-debugger](https://developers.facebook.com/tools/debug/og/object/).)\r\n![facebook](https://cloud.githubusercontent.com/assets/6518904/13961808/2dcc668c-f02c-11e5-9d1d-ac414d0217b4.PNG)\r\n\r\nSkype:\r\n![skype](https://cloud.githubusercontent.com/assets/6518904/13961835/4ac6cf3e-f02c-11e5-878a-375b4e7d2b1b.PNG)\r\n\r\nSlack:\r\n![slack](https://cloud.githubusercontent.com/assets/6518904/13961856/6066873a-f02c-11e5-8413-be05c89cfb9d.PNG)","created_at":"2016-03-22T17:50:09Z","updated_at":"2016-04-05T15:54:22Z","closed_at":"2016-03-22T18:00:30Z","merged_at":"2016-03-22T18:00:30Z","merge_commit_sha":"73fb3bd9eb101691e540f7bfdb18eaf8ad820e7c","assignee":{"login":"lattmann","id":1108945,"avatar_url":"https://avatars.githubusercontent.com/u/1108945?v=3","gravatar_id":"","url":"https://api.github.com/users/lattmann","html_url":"https://github.com/lattmann","followers_url":"https://api.github.com/users/lattmann/followers","following_url":"https://api.github.com/users/lattmann/following{/other_user}","gists_url":"https://api.github.com/users/lattmann/gists{/gist_id}","starred_url":"https://api.github.com/users/lattmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lattmann/subscriptions","organizations_url":"https://api.github.com/users/lattmann/orgs","repos_url":"https://api.github.com/users/lattmann/repos","events_url":"https://api.github.com/users/lattmann/events{/privacy}","received_events_url":"https://api.github.com/users/lattmann/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/webgme/webgme/milestones/36","html_url":"https://github.com/webgme/webgme/milestones/v1.7.0","labels_url":"https://api.github.com/repos/webgme/webgme/milestones/36/labels","id":1643814,"number":36,"title":"v1.7.0","description":"","creator":{"login":"kecso","id":1371489,"avatar_url":"https://avatars.githubusercontent.com/u/1371489?v=3","gravatar_id":"","url":"https://api.github.com/users/kecso","html_url":"https://github.com/kecso","followers_url":"https://api.github.com/users/kecso/followers","following_url":"https://api.github.com/users/kecso/following{/other_user}","gists_url":"https://api.github.com/users/kecso/gists{/gist_id}","starred_url":"https://api.github.com/users/kecso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kecso/subscriptions","organizations_url":"https://api.github.com/users/kecso/orgs","repos_url":"https://api.github.com/users/kecso/repos","events_url":"https://api.github.com/users/kecso/events{/privacy}","received_events_url":"https://api.github.com/users/kecso/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":16,"state":"open","created_at":"2016-03-14T17:56:37Z","updated_at":"2016-04-01T20:33:43Z","due_on":"2016-04-11T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/webgme/webgme/pulls/902/commits","review_comments_url":"https://api.github.com/repos/webgme/webgme/pulls/902/comments","review_comment_url":"https://api.github.com/repos/webgme/webgme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/webgme/webgme/issues/902/comments","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/1254179198c6c4cd7165d2f406379217b6845346","head":{"label":"webgme:enhancement/metadata_in_links","ref":"enhancement/metadata_in_links","sha":"1254179198c6c4cd7165d2f406379217b6845346","user":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"repo":{"id":2526173,"name":"webgme","full_name":"webgme/webgme","owner":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webgme/webgme","description":"Web-based Generic Modeling Environment","fork":false,"url":"https://api.github.com/repos/webgme/webgme","forks_url":"https://api.github.com/repos/webgme/webgme/forks","keys_url":"https://api.github.com/repos/webgme/webgme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webgme/webgme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webgme/webgme/teams","hooks_url":"https://api.github.com/repos/webgme/webgme/hooks","issue_events_url":"https://api.github.com/repos/webgme/webgme/issues/events{/number}","events_url":"https://api.github.com/repos/webgme/webgme/events","assignees_url":"https://api.github.com/repos/webgme/webgme/assignees{/user}","branches_url":"https://api.github.com/repos/webgme/webgme/branches{/branch}","tags_url":"https://api.github.com/repos/webgme/webgme/tags","blobs_url":"https://api.github.com/repos/webgme/webgme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webgme/webgme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webgme/webgme/git/refs{/sha}","trees_url":"https://api.github.com/repos/webgme/webgme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/{sha}","languages_url":"https://api.github.com/repos/webgme/webgme/languages","stargazers_url":"https://api.github.com/repos/webgme/webgme/stargazers","contributors_url":"https://api.github.com/repos/webgme/webgme/contributors","subscribers_url":"https://api.github.com/repos/webgme/webgme/subscribers","subscription_url":"https://api.github.com/repos/webgme/webgme/subscription","commits_url":"https://api.github.com/repos/webgme/webgme/commits{/sha}","git_commits_url":"https://api.github.com/repos/webgme/webgme/git/commits{/sha}","comments_url":"https://api.github.com/repos/webgme/webgme/comments{/number}","issue_comment_url":"https://api.github.com/repos/webgme/webgme/issues/comments{/number}","contents_url":"https://api.github.com/repos/webgme/webgme/contents/{+path}","compare_url":"https://api.github.com/repos/webgme/webgme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webgme/webgme/merges","archive_url":"https://api.github.com/repos/webgme/webgme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webgme/webgme/downloads","issues_url":"https://api.github.com/repos/webgme/webgme/issues{/number}","pulls_url":"https://api.github.com/repos/webgme/webgme/pulls{/number}","milestones_url":"https://api.github.com/repos/webgme/webgme/milestones{/number}","notifications_url":"https://api.github.com/repos/webgme/webgme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webgme/webgme/labels{/name}","releases_url":"https://api.github.com/repos/webgme/webgme/releases{/id}","deployments_url":"https://api.github.com/repos/webgme/webgme/deployments","created_at":"2011-10-06T14:01:08Z","updated_at":"2016-03-17T02:57:23Z","pushed_at":"2016-04-05T04:52:24Z","git_url":"git://github.com/webgme/webgme.git","ssh_url":"git@github.com:webgme/webgme.git","clone_url":"https://github.com/webgme/webgme.git","svn_url":"https://github.com/webgme/webgme","homepage":"https://webgme.org","size":130406,"stargazers_count":27,"watchers_count":27,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":28,"forks":17,"open_issues":28,"watchers":27,"default_branch":"master"}},"base":{"label":"webgme:master","ref":"master","sha":"37346dd7be59596a8b11ab803b1ea5b69605f8fb","user":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"repo":{"id":2526173,"name":"webgme","full_name":"webgme/webgme","owner":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webgme/webgme","description":"Web-based Generic Modeling Environment","fork":false,"url":"https://api.github.com/repos/webgme/webgme","forks_url":"https://api.github.com/repos/webgme/webgme/forks","keys_url":"https://api.github.com/repos/webgme/webgme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webgme/webgme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webgme/webgme/teams","hooks_url":"https://api.github.com/repos/webgme/webgme/hooks","issue_events_url":"https://api.github.com/repos/webgme/webgme/issues/events{/number}","events_url":"https://api.github.com/repos/webgme/webgme/events","assignees_url":"https://api.github.com/repos/webgme/webgme/assignees{/user}","branches_url":"https://api.github.com/repos/webgme/webgme/branches{/branch}","tags_url":"https://api.github.com/repos/webgme/webgme/tags","blobs_url":"https://api.github.com/repos/webgme/webgme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webgme/webgme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webgme/webgme/git/refs{/sha}","trees_url":"https://api.github.com/repos/webgme/webgme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/{sha}","languages_url":"https://api.github.com/repos/webgme/webgme/languages","stargazers_url":"https://api.github.com/repos/webgme/webgme/stargazers","contributors_url":"https://api.github.com/repos/webgme/webgme/contributors","subscribers_url":"https://api.github.com/repos/webgme/webgme/subscribers","subscription_url":"https://api.github.com/repos/webgme/webgme/subscription","commits_url":"https://api.github.com/repos/webgme/webgme/commits{/sha}","git_commits_url":"https://api.github.com/repos/webgme/webgme/git/commits{/sha}","comments_url":"https://api.github.com/repos/webgme/webgme/comments{/number}","issue_comment_url":"https://api.github.com/repos/webgme/webgme/issues/comments{/number}","contents_url":"https://api.github.com/repos/webgme/webgme/contents/{+path}","compare_url":"https://api.github.com/repos/webgme/webgme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webgme/webgme/merges","archive_url":"https://api.github.com/repos/webgme/webgme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webgme/webgme/downloads","issues_url":"https://api.github.com/repos/webgme/webgme/issues{/number}","pulls_url":"https://api.github.com/repos/webgme/webgme/pulls{/number}","milestones_url":"https://api.github.com/repos/webgme/webgme/milestones{/number}","notifications_url":"https://api.github.com/repos/webgme/webgme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webgme/webgme/labels{/name}","releases_url":"https://api.github.com/repos/webgme/webgme/releases{/id}","deployments_url":"https://api.github.com/repos/webgme/webgme/deployments","created_at":"2011-10-06T14:01:08Z","updated_at":"2016-03-17T02:57:23Z","pushed_at":"2016-04-05T04:52:24Z","git_url":"git://github.com/webgme/webgme.git","ssh_url":"git@github.com:webgme/webgme.git","clone_url":"https://github.com/webgme/webgme.git","svn_url":"https://github.com/webgme/webgme","homepage":"https://webgme.org","size":130406,"stargazers_count":27,"watchers_count":27,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":28,"forks":17,"open_issues":28,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/webgme/webgme/pulls/902"},"html":{"href":"https://github.com/webgme/webgme/pull/902"},"issue":{"href":"https://api.github.com/repos/webgme/webgme/issues/902"},"comments":{"href":"https://api.github.com/repos/webgme/webgme/issues/902/comments"},"review_comments":{"href":"https://api.github.com/repos/webgme/webgme/pulls/902/comments"},"review_comment":{"href":"https://api.github.com/repos/webgme/webgme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/webgme/webgme/pulls/902/commits"},"statuses":{"href":"https://api.github.com/repos/webgme/webgme/statuses/1254179198c6c4cd7165d2f406379217b6845346"}}}}