{"action":"created","comment":{"url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments/180190699","pull_request_review_id":110569595,"id":180190699,"diff_hunk":"@@ -553,6 +560,10 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,\n \t\t\t\t\t\t\t\t\t\t\t   (vacstmt->options & VACOPT_ROOTONLY) != 0,\n \t\t\t\t\t\t\t\t\t\t\t   colLargeRowIndexes);\n \n+\t// change the privilige back to the table owner\n+\tGetUserIdAndSecContext(&save_userid, &save_sec_context);","path":"src/backend/commands/analyze.c","position":19,"original_position":19,"commit_id":"adbf3eb2c24f38f144e857931c4f155dd9f6d962","original_commit_id":"adbf3eb2c24f38f144e857931c4f155dd9f6d962","user":{"login":"bhuvnesh2703","id":10293569,"avatar_url":"https://avatars1.githubusercontent.com/u/10293569?v=4","gravatar_id":"","url":"https://api.github.com/users/bhuvnesh2703","html_url":"https://github.com/bhuvnesh2703","followers_url":"https://api.github.com/users/bhuvnesh2703/followers","following_url":"https://api.github.com/users/bhuvnesh2703/following{/other_user}","gists_url":"https://api.github.com/users/bhuvnesh2703/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuvnesh2703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuvnesh2703/subscriptions","organizations_url":"https://api.github.com/users/bhuvnesh2703/orgs","repos_url":"https://api.github.com/users/bhuvnesh2703/repos","events_url":"https://api.github.com/users/bhuvnesh2703/events{/privacy}","received_events_url":"https://api.github.com/users/bhuvnesh2703/received_events","type":"User","site_admin":false},"body":"fixed","created_at":"2018-04-09T18:38:27Z","updated_at":"2018-04-09T18:38:27Z","html_url":"https://github.com/greenplum-db/gpdb/pull/4832#discussion_r180190699","pull_request_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments/180190699"},"html":{"href":"https://github.com/greenplum-db/gpdb/pull/4832#discussion_r180190699"},"pull_request":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832"}},"in_reply_to_id":179935846},"pull_request":{"url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832","id":180073637,"html_url":"https://github.com/greenplum-db/gpdb/pull/4832","diff_url":"https://github.com/greenplum-db/gpdb/pull/4832.diff","patch_url":"https://github.com/greenplum-db/gpdb/pull/4832.patch","issue_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/4832","number":4832,"state":"open","locked":false,"title":"Fix Analyze privilege issue when executed by superuser","user":{"login":"bhuvnesh2703","id":10293569,"avatar_url":"https://avatars1.githubusercontent.com/u/10293569?v=4","gravatar_id":"","url":"https://api.github.com/users/bhuvnesh2703","html_url":"https://github.com/bhuvnesh2703","followers_url":"https://api.github.com/users/bhuvnesh2703/followers","following_url":"https://api.github.com/users/bhuvnesh2703/following{/other_user}","gists_url":"https://api.github.com/users/bhuvnesh2703/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuvnesh2703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuvnesh2703/subscriptions","organizations_url":"https://api.github.com/users/bhuvnesh2703/orgs","repos_url":"https://api.github.com/users/bhuvnesh2703/repos","events_url":"https://api.github.com/users/bhuvnesh2703/events{/privacy}","received_events_url":"https://api.github.com/users/bhuvnesh2703/received_events","type":"User","site_admin":false},"body":"The patch 62aba76568e58698ad5eaa6153bc45186aacbde2 from upstream fixed\r\nthe CVE-2009-4136 (security vulnerability) with the intent to properly\r\nmanage session-local state during execution of an index function by a\r\ndatabase superuser, which in some cases allowed remote authenticated\r\nusers to gain privileges via a table with crafted index functions.\r\n\r\nLooking into the details of the CVE-2009-4136 and related CVE-2007-6600,\r\nthe patch should ideally have limited the scope while we calculate the\r\nstats on the index expressions, where we run functions to evaluate the\r\nexpression and could potentially present a security threat.\r\n\r\nHowever, the patch changed the user to table owner before collecting the\r\nsample, due to which even if analyze was run by superuser the sample\r\ncouldn't be collected as the table owner did not had sufficient\r\nprivileges to access the table. With this commit, we switch back to the\r\noriginal user while collecting the sample as it does not deal with\r\nindexes, or function call which was the original intention of the patch.\r\n\r\nUpstream did not face the privilege issue, as it does block sampling\r\ninstead of issuing a query.\r\n\r\nSigned-off-by: Sambitesh Dash <sdash@pivotal.io>","created_at":"2018-04-06T23:17:44Z","updated_at":"2018-04-09T18:38:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb68c8daade5b7e717d6b7d97565d0d6c214a1c4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hlinnaka","id":191602,"avatar_url":"https://avatars2.githubusercontent.com/u/191602?v=4","gravatar_id":"","url":"https://api.github.com/users/hlinnaka","html_url":"https://github.com/hlinnaka","followers_url":"https://api.github.com/users/hlinnaka/followers","following_url":"https://api.github.com/users/hlinnaka/following{/other_user}","gists_url":"https://api.github.com/users/hlinnaka/gists{/gist_id}","starred_url":"https://api.github.com/users/hlinnaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlinnaka/subscriptions","organizations_url":"https://api.github.com/users/hlinnaka/orgs","repos_url":"https://api.github.com/users/hlinnaka/repos","events_url":"https://api.github.com/users/hlinnaka/events{/privacy}","received_events_url":"https://api.github.com/users/hlinnaka/received_events","type":"User","site_admin":false},{"login":"danielgustafsson","id":321790,"avatar_url":"https://avatars2.githubusercontent.com/u/321790?v=4","gravatar_id":"","url":"https://api.github.com/users/danielgustafsson","html_url":"https://github.com/danielgustafsson","followers_url":"https://api.github.com/users/danielgustafsson/followers","following_url":"https://api.github.com/users/danielgustafsson/following{/other_user}","gists_url":"https://api.github.com/users/danielgustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgustafsson/subscriptions","organizations_url":"https://api.github.com/users/danielgustafsson/orgs","repos_url":"https://api.github.com/users/danielgustafsson/repos","events_url":"https://api.github.com/users/danielgustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/danielgustafsson/received_events","type":"User","site_admin":false},{"login":"jimmyyih","id":1973115,"avatar_url":"https://avatars2.githubusercontent.com/u/1973115?v=4","gravatar_id":"","url":"https://api.github.com/users/jimmyyih","html_url":"https://github.com/jimmyyih","followers_url":"https://api.github.com/users/jimmyyih/followers","following_url":"https://api.github.com/users/jimmyyih/following{/other_user}","gists_url":"https://api.github.com/users/jimmyyih/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmyyih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmyyih/subscriptions","organizations_url":"https://api.github.com/users/jimmyyih/orgs","repos_url":"https://api.github.com/users/jimmyyih/repos","events_url":"https://api.github.com/users/jimmyyih/events{/privacy}","received_events_url":"https://api.github.com/users/jimmyyih/received_events","type":"User","site_admin":false},{"login":"ashwinstar","id":11396815,"avatar_url":"https://avatars2.githubusercontent.com/u/11396815?v=4","gravatar_id":"","url":"https://api.github.com/users/ashwinstar","html_url":"https://github.com/ashwinstar","followers_url":"https://api.github.com/users/ashwinstar/followers","following_url":"https://api.github.com/users/ashwinstar/following{/other_user}","gists_url":"https://api.github.com/users/ashwinstar/gists{/gist_id}","starred_url":"https://api.github.com/users/ashwinstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashwinstar/subscriptions","organizations_url":"https://api.github.com/users/ashwinstar/orgs","repos_url":"https://api.github.com/users/ashwinstar/repos","events_url":"https://api.github.com/users/ashwinstar/events{/privacy}","received_events_url":"https://api.github.com/users/ashwinstar/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832/commits","review_comments_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832/comments","review_comment_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/4832/comments","statuses_url":"https://api.github.com/repos/greenplum-db/gpdb/statuses/adbf3eb2c24f38f144e857931c4f155dd9f6d962","head":{"label":"bhuvnesh2703:fix-analyze-priv","ref":"fix-analyze-priv","sha":"adbf3eb2c24f38f144e857931c4f155dd9f6d962","user":{"login":"bhuvnesh2703","id":10293569,"avatar_url":"https://avatars1.githubusercontent.com/u/10293569?v=4","gravatar_id":"","url":"https://api.github.com/users/bhuvnesh2703","html_url":"https://github.com/bhuvnesh2703","followers_url":"https://api.github.com/users/bhuvnesh2703/followers","following_url":"https://api.github.com/users/bhuvnesh2703/following{/other_user}","gists_url":"https://api.github.com/users/bhuvnesh2703/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuvnesh2703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuvnesh2703/subscriptions","organizations_url":"https://api.github.com/users/bhuvnesh2703/orgs","repos_url":"https://api.github.com/users/bhuvnesh2703/repos","events_url":"https://api.github.com/users/bhuvnesh2703/events{/privacy}","received_events_url":"https://api.github.com/users/bhuvnesh2703/received_events","type":"User","site_admin":false},"repo":{"id":67822977,"name":"gpdb","full_name":"bhuvnesh2703/gpdb","owner":{"login":"bhuvnesh2703","id":10293569,"avatar_url":"https://avatars1.githubusercontent.com/u/10293569?v=4","gravatar_id":"","url":"https://api.github.com/users/bhuvnesh2703","html_url":"https://github.com/bhuvnesh2703","followers_url":"https://api.github.com/users/bhuvnesh2703/followers","following_url":"https://api.github.com/users/bhuvnesh2703/following{/other_user}","gists_url":"https://api.github.com/users/bhuvnesh2703/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuvnesh2703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuvnesh2703/subscriptions","organizations_url":"https://api.github.com/users/bhuvnesh2703/orgs","repos_url":"https://api.github.com/users/bhuvnesh2703/repos","events_url":"https://api.github.com/users/bhuvnesh2703/events{/privacy}","received_events_url":"https://api.github.com/users/bhuvnesh2703/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bhuvnesh2703/gpdb","description":"Greenplum Database","fork":true,"url":"https://api.github.com/repos/bhuvnesh2703/gpdb","forks_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/forks","keys_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/teams","hooks_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/hooks","issue_events_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/issues/events{/number}","events_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/events","assignees_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/assignees{/user}","branches_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/branches{/branch}","tags_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/tags","blobs_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/statuses/{sha}","languages_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/languages","stargazers_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/stargazers","contributors_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/contributors","subscribers_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/subscribers","subscription_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/subscription","commits_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/contents/{+path}","compare_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/merges","archive_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/downloads","issues_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/issues{/number}","pulls_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/pulls{/number}","milestones_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/milestones{/number}","notifications_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/labels{/name}","releases_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/releases{/id}","deployments_url":"https://api.github.com/repos/bhuvnesh2703/gpdb/deployments","created_at":"2016-09-09T18:33:06Z","updated_at":"2018-04-03T20:51:31Z","pushed_at":"2018-04-06T23:17:32Z","git_url":"git://github.com/bhuvnesh2703/gpdb.git","ssh_url":"git@github.com:bhuvnesh2703/gpdb.git","clone_url":"https://github.com/bhuvnesh2703/gpdb.git","svn_url":"https://github.com/bhuvnesh2703/gpdb","homepage":"http://greenplum.org","size":265221,"stargazers_count":0,"watchers_count":0,"language":"C","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":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"greenplum-db:master","ref":"master","sha":"21774bfdd5a0140a179dae690029e924758d0cf1","user":{"login":"greenplum-db","id":14097842,"avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"repo":{"id":44781140,"name":"gpdb","full_name":"greenplum-db/gpdb","owner":{"login":"greenplum-db","id":14097842,"avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greenplum-db/gpdb","description":"Greenplum Database","fork":false,"url":"https://api.github.com/repos/greenplum-db/gpdb","forks_url":"https://api.github.com/repos/greenplum-db/gpdb/forks","keys_url":"https://api.github.com/repos/greenplum-db/gpdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenplum-db/gpdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenplum-db/gpdb/teams","hooks_url":"https://api.github.com/repos/greenplum-db/gpdb/hooks","issue_events_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/events{/number}","events_url":"https://api.github.com/repos/greenplum-db/gpdb/events","assignees_url":"https://api.github.com/repos/greenplum-db/gpdb/assignees{/user}","branches_url":"https://api.github.com/repos/greenplum-db/gpdb/branches{/branch}","tags_url":"https://api.github.com/repos/greenplum-db/gpdb/tags","blobs_url":"https://api.github.com/repos/greenplum-db/gpdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenplum-db/gpdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenplum-db/gpdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenplum-db/gpdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenplum-db/gpdb/statuses/{sha}","languages_url":"https://api.github.com/repos/greenplum-db/gpdb/languages","stargazers_url":"https://api.github.com/repos/greenplum-db/gpdb/stargazers","contributors_url":"https://api.github.com/repos/greenplum-db/gpdb/contributors","subscribers_url":"https://api.github.com/repos/greenplum-db/gpdb/subscribers","subscription_url":"https://api.github.com/repos/greenplum-db/gpdb/subscription","commits_url":"https://api.github.com/repos/greenplum-db/gpdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenplum-db/gpdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenplum-db/gpdb/contents/{+path}","compare_url":"https://api.github.com/repos/greenplum-db/gpdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenplum-db/gpdb/merges","archive_url":"https://api.github.com/repos/greenplum-db/gpdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenplum-db/gpdb/downloads","issues_url":"https://api.github.com/repos/greenplum-db/gpdb/issues{/number}","pulls_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls{/number}","milestones_url":"https://api.github.com/repos/greenplum-db/gpdb/milestones{/number}","notifications_url":"https://api.github.com/repos/greenplum-db/gpdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenplum-db/gpdb/labels{/name}","releases_url":"https://api.github.com/repos/greenplum-db/gpdb/releases{/id}","deployments_url":"https://api.github.com/repos/greenplum-db/gpdb/deployments","created_at":"2015-10-23T00:25:17Z","updated_at":"2018-04-09T18:33:05Z","pushed_at":"2018-04-09T18:32:52Z","git_url":"git://github.com/greenplum-db/gpdb.git","ssh_url":"git@github.com:greenplum-db/gpdb.git","clone_url":"https://github.com/greenplum-db/gpdb.git","svn_url":"https://github.com/greenplum-db/gpdb","homepage":"http://greenplum.org","size":266545,"stargazers_count":2396,"watchers_count":2396,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":747,"mirror_url":null,"archived":false,"open_issues_count":228,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":747,"open_issues":228,"watchers":2396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832"},"html":{"href":"https://github.com/greenplum-db/gpdb/pull/4832"},"issue":{"href":"https://api.github.com/repos/greenplum-db/gpdb/issues/4832"},"comments":{"href":"https://api.github.com/repos/greenplum-db/gpdb/issues/4832/comments"},"review_comments":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832/comments"},"review_comment":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/4832/commits"},"statuses":{"href":"https://api.github.com/repos/greenplum-db/gpdb/statuses/adbf3eb2c24f38f144e857931c4f155dd9f6d962"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"bhuvnesh2703"}}