{"action":"closed","number":1964,"pull_request":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/1964","id":87916043,"html_url":"https://github.com/hashicorp/vault/pull/1964","diff_url":"https://github.com/hashicorp/vault/pull/1964.diff","patch_url":"https://github.com/hashicorp/vault/pull/1964.patch","issue_url":"https://api.github.com/repos/hashicorp/vault/issues/1964","number":1964,"state":"closed","locked":false,"title":"Nested secrets handling fix for zookeeper and file based backend.","user":{"login":"vespian","id":2124609,"avatar_url":"https://avatars.githubusercontent.com/u/2124609?v=3","gravatar_id":"","url":"https://api.github.com/users/vespian","html_url":"https://github.com/vespian","followers_url":"https://api.github.com/users/vespian/followers","following_url":"https://api.github.com/users/vespian/following{/other_user}","gists_url":"https://api.github.com/users/vespian/gists{/gist_id}","starred_url":"https://api.github.com/users/vespian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vespian/subscriptions","organizations_url":"https://api.github.com/users/vespian/orgs","repos_url":"https://api.github.com/users/vespian/repos","events_url":"https://api.github.com/users/vespian/events{/privacy}","received_events_url":"https://api.github.com/users/vespian/received_events","type":"User","site_admin":false},"body":"Hi!\r\n\r\nSome time ago we discovered that nested secrets (e.g. \"foo/bar/baz\") are inproperly handled in zookeeper backend, after some research it turned out that:\r\n* zookeeper's backend `List` method improperly calssifies nodes, basing only on the number of children given node has. This was causing \"ghost\" entries in `List` call results for ZK nodes which were not removed when all their children were\r\n* the reason for for not removing empty node is that Zookeeper was based on officially supported consul backend. Consul takes care of removing \"empty\" nodes itself, without the need of extra logic in the code.\r\n\r\nWhile rebasing, I have noticed that there was already some patching in file based backend (https://github.com/hashicorp/vault/pull/1821/files). Unfortunately neither the fix nor the extra tests are not recursive. Lets assume that we have following hierarchy:\r\n```\r\nfoo\r\n  |- suz -> val==\"ffz\"\r\n```\r\nnow let's create secret `foo/bar/baz/gaz/naz` with value `test1234`, elements `bar`, `baz`, `gaz` are empty, `foo/suz` and `naz` hold a secret. We have following hierarchy now:\r\n```\r\nfoo\r\n  |- suz -> val==\"ffz\"\r\n  |- bar\r\n      |- baz\r\n         |- gaz\r\n            |- naz -> val == `test1234`\r\n```\r\nRemoving `foo/bar/baz/gaz/naz` will result in directories `bar`, `baz`, `gaz` left on the disk. In case of the Zookeeper, user would get additional entry of `foo/bar/baz/az` in the result of `List` call (first character is stripped as the backend thinks this is a data node with `_` prefix). \r\n\r\nSo this PR refactors tests in order to cover mentioned corner-cases and adds recursive deletion of directoires/nodes that are empty. It has been verified/tested on Zookeeper, Consul and File backend. I am not sure if other backends do not share this bug (i.e. PSQL, MySQL, ETCd, S3, etc...).\r\n\r\nThanks in advance for feedback.\r\npr","created_at":"2016-10-04T15:20:38Z","updated_at":"2016-10-05T02:45:38Z","closed_at":"2016-10-05T02:45:37Z","merged_at":"2016-10-05T02:45:37Z","merge_commit_sha":"2711249e08a2448be4b58a1734630c549884c4a8","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/hashicorp/vault/milestones/11","html_url":"https://github.com/hashicorp/vault/milestones/0.6.2","labels_url":"https://api.github.com/repos/hashicorp/vault/milestones/11/labels","id":1834013,"number":11,"title":"0.6.2","description":null,"creator":{"login":"jefferai","id":28627,"avatar_url":"https://avatars.githubusercontent.com/u/28627?v=3","gravatar_id":"","url":"https://api.github.com/users/jefferai","html_url":"https://github.com/jefferai","followers_url":"https://api.github.com/users/jefferai/followers","following_url":"https://api.github.com/users/jefferai/following{/other_user}","gists_url":"https://api.github.com/users/jefferai/gists{/gist_id}","starred_url":"https://api.github.com/users/jefferai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jefferai/subscriptions","organizations_url":"https://api.github.com/users/jefferai/orgs","repos_url":"https://api.github.com/users/jefferai/repos","events_url":"https://api.github.com/users/jefferai/events{/privacy}","received_events_url":"https://api.github.com/users/jefferai/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":97,"state":"open","created_at":"2016-06-17T08:54:26Z","updated_at":"2016-10-05T02:45:38Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hashicorp/vault/pulls/1964/commits","review_comments_url":"https://api.github.com/repos/hashicorp/vault/pulls/1964/comments","review_comment_url":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/vault/issues/1964/comments","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/3156098a5bf47e402043f4c3a8c4dcd0ecb17ba7","head":{"label":"mesosphere:prozlach/nested_secrets_handling_fix","ref":"prozlach/nested_secrets_handling_fix","sha":"3156098a5bf47e402043f4c3a8c4dcd0ecb17ba7","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":62200076,"name":"vault","full_name":"mesosphere/vault","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/vault","description":"A tool for managing secrets.","fork":true,"url":"https://api.github.com/repos/mesosphere/vault","forks_url":"https://api.github.com/repos/mesosphere/vault/forks","keys_url":"https://api.github.com/repos/mesosphere/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/vault/teams","hooks_url":"https://api.github.com/repos/mesosphere/vault/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/vault/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/vault/events","assignees_url":"https://api.github.com/repos/mesosphere/vault/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/vault/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/vault/tags","blobs_url":"https://api.github.com/repos/mesosphere/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/vault/languages","stargazers_url":"https://api.github.com/repos/mesosphere/vault/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/vault/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/vault/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/vault/subscription","commits_url":"https://api.github.com/repos/mesosphere/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/vault/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/vault/merges","archive_url":"https://api.github.com/repos/mesosphere/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/vault/downloads","issues_url":"https://api.github.com/repos/mesosphere/vault/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/vault/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/vault/releases{/id}","deployments_url":"https://api.github.com/repos/mesosphere/vault/deployments","created_at":"2016-06-29T06:07:26Z","updated_at":"2016-09-07T15:36:10Z","pushed_at":"2016-10-04T19:56:49Z","git_url":"git://github.com/mesosphere/vault.git","ssh_url":"git@github.com:mesosphere/vault.git","clone_url":"https://github.com/mesosphere/vault.git","svn_url":"https://github.com/mesosphere/vault","homepage":"https://www.vaultproject.io/","size":18799,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"a72b7698bbd85dd2aa38dc8ec2a80ee463c76626","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":31288958,"name":"vault","full_name":"hashicorp/vault","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/vault","description":"A tool for managing secrets.","fork":false,"url":"https://api.github.com/repos/hashicorp/vault","forks_url":"https://api.github.com/repos/hashicorp/vault/forks","keys_url":"https://api.github.com/repos/hashicorp/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/vault/teams","hooks_url":"https://api.github.com/repos/hashicorp/vault/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/vault/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/vault/events","assignees_url":"https://api.github.com/repos/hashicorp/vault/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/vault/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/vault/tags","blobs_url":"https://api.github.com/repos/hashicorp/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/vault/languages","stargazers_url":"https://api.github.com/repos/hashicorp/vault/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/vault/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/vault/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/vault/subscription","commits_url":"https://api.github.com/repos/hashicorp/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/vault/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/vault/merges","archive_url":"https://api.github.com/repos/hashicorp/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/vault/downloads","issues_url":"https://api.github.com/repos/hashicorp/vault/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/vault/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/vault/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/vault/deployments","created_at":"2015-02-25T00:15:59Z","updated_at":"2016-10-04T19:28:19Z","pushed_at":"2016-10-05T02:45:37Z","git_url":"git://github.com/hashicorp/vault.git","ssh_url":"git@github.com:hashicorp/vault.git","clone_url":"https://github.com/hashicorp/vault.git","svn_url":"https://github.com/hashicorp/vault","homepage":"https://www.vaultproject.io/","size":20523,"stargazers_count":5365,"watchers_count":5365,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":582,"mirror_url":null,"open_issues_count":167,"forks":582,"open_issues":167,"watchers":5365,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1964"},"html":{"href":"https://github.com/hashicorp/vault/pull/1964"},"issue":{"href":"https://api.github.com/repos/hashicorp/vault/issues/1964"},"comments":{"href":"https://api.github.com/repos/hashicorp/vault/issues/1964/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1964/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1964/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/vault/statuses/3156098a5bf47e402043f4c3a8c4dcd0ecb17ba7"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"vishalnayak","id":3053672,"avatar_url":"https://avatars.githubusercontent.com/u/3053672?v=3","gravatar_id":"","url":"https://api.github.com/users/vishalnayak","html_url":"https://github.com/vishalnayak","followers_url":"https://api.github.com/users/vishalnayak/followers","following_url":"https://api.github.com/users/vishalnayak/following{/other_user}","gists_url":"https://api.github.com/users/vishalnayak/gists{/gist_id}","starred_url":"https://api.github.com/users/vishalnayak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishalnayak/subscriptions","organizations_url":"https://api.github.com/users/vishalnayak/orgs","repos_url":"https://api.github.com/users/vishalnayak/repos","events_url":"https://api.github.com/users/vishalnayak/events{/privacy}","received_events_url":"https://api.github.com/users/vishalnayak/received_events","type":"User","site_admin":false},"comments":2,"review_comments":8,"commits":3,"additions":119,"deletions":37,"changed_files":4}}
{"actor":{"display_login":"vishalnayak"}}