{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/comments/186753757","pull_request_review_id":118393181,"id":186753757,"diff_hunk":"@@ -1247,8 +1262,63 @@ func (m *ExpirationManager) removeIndexByToken(token, leaseID string) error {\n \treturn nil\n }\n \n-// lookupByToken is used to lookup all the leaseID's via the\n-func (m *ExpirationManager) lookupByToken(token string) ([]string, error) {\n+// CreateOrFetchRevocationLeaseByToken is used to create or fetch the matching\n+// leaseID for a particular token. The lease is set to expire immediately after\n+// it's created.\n+func (m *ExpirationManager) CreateOrFetchRevocationLeaseByToken(te *TokenEntry) (string, error) {\n+\t// Fetch the saltedID of the token and construct the leaseID\n+\tsaltedID, err := m.tokenStore.SaltID(m.quitContext, te.ID)\n+\tif err != nil {\n+\t\treturn \"\", err\n+\t}\n+\tleaseID := path.Join(te.Path, saltedID)\n+\n+\t// Load the entry\n+\tle, err := m.loadEntry(leaseID)\n+\tif err != nil {\n+\t\treturn \"\", err\n+\t}\n+\n+\t// If there's no associated leaseEntry for the token, we create one\n+\tif le == nil {\n+\t\tauth := &logical.Auth{\n+\t\t\tClientToken: te.ID,\n+\t\t\tLeaseOptions: logical.LeaseOptions{\n+\t\t\t\tTTL: time.Nanosecond,\n+\t\t\t},\n+\t\t}\n+\n+\t\tif strings.Contains(te.Path, \"..\") {\n+\t\t\treturn \"\", consts.ErrPathContainsParentReferences\n+\t\t}\n+\n+\t\tsaltedID, err := m.tokenStore.SaltID(m.quitContext, auth.ClientToken)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\n+\t\t// Create a lease entry\n+\t\tnow := time.Now()\n+\t\tle = &leaseEntry{\n+\t\t\tLeaseID:     path.Join(te.Path, saltedID),","path":"vault/expiration.go","position":91,"original_position":91,"commit_id":"0383875a04083134d965c650a7ac2e870d061632","original_commit_id":"0383875a04083134d965c650a7ac2e870d061632","user":{"login":"vishalnayak","id":3053672,"avatar_url":"https://avatars0.githubusercontent.com/u/3053672?v=4","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},"body":"`leaseID` is also computed earlier in the function.","created_at":"2018-05-08T14:45:38Z","updated_at":"2018-05-08T14:56:32Z","html_url":"https://github.com/hashicorp/vault/pull/4512#discussion_r186753757","pull_request_url":"https://api.github.com/repos/hashicorp/vault/pulls/4512","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments/186753757"},"html":{"href":"https://github.com/hashicorp/vault/pull/4512#discussion_r186753757"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/4512"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/4512","id":186005030,"html_url":"https://github.com/hashicorp/vault/pull/4512","diff_url":"https://github.com/hashicorp/vault/pull/4512.diff","patch_url":"https://github.com/hashicorp/vault/pull/4512.patch","issue_url":"https://api.github.com/repos/hashicorp/vault/issues/4512","number":4512,"state":"open","locked":false,"title":"Token revocation refactor","user":{"login":"calvn","id":1883212,"avatar_url":"https://avatars0.githubusercontent.com/u/1883212?v=4","gravatar_id":"","url":"https://api.github.com/users/calvn","html_url":"https://github.com/calvn","followers_url":"https://api.github.com/users/calvn/followers","following_url":"https://api.github.com/users/calvn/following{/other_user}","gists_url":"https://api.github.com/users/calvn/gists{/gist_id}","starred_url":"https://api.github.com/users/calvn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvn/subscriptions","organizations_url":"https://api.github.com/users/calvn/orgs","repos_url":"https://api.github.com/users/calvn/repos","events_url":"https://api.github.com/users/calvn/events{/privacy}","received_events_url":"https://api.github.com/users/calvn/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-04T14:45:05Z","updated_at":"2018-05-08T14:56:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04cff1e8bf4bb0c6c1eac369c3427272106d85b5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/hashicorp/vault/milestones/35","html_url":"https://github.com/hashicorp/vault/milestone/35","labels_url":"https://api.github.com/repos/hashicorp/vault/milestones/35/labels","id":3281750,"number":35,"title":"0.10.2","description":null,"creator":{"login":"jefferai","id":28627,"avatar_url":"https://avatars0.githubusercontent.com/u/28627?v=4","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":21,"closed_issues":20,"state":"open","created_at":"2018-04-19T19:03:22Z","updated_at":"2018-05-07T20:47:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hashicorp/vault/pulls/4512/commits","review_comments_url":"https://api.github.com/repos/hashicorp/vault/pulls/4512/comments","review_comment_url":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/vault/issues/4512/comments","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/0383875a04083134d965c650a7ac2e870d061632","head":{"label":"hashicorp:f-ts-issue","ref":"f-ts-issue","sha":"0383875a04083134d965c650a7ac2e870d061632","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","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://avatars2.githubusercontent.com/u/761456?v=4","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 secrets management, encryption as a service, and privileged access management","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":"2018-05-08T14:26:41Z","pushed_at":"2018-05-08T14:49:27Z","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":50097,"stargazers_count":9135,"watchers_count":9135,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1346,"mirror_url":null,"archived":false,"open_issues_count":252,"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":1346,"open_issues":252,"watchers":9135,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"d831e5207f1c7a64722b19325d3b116d17d12d26","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","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://avatars2.githubusercontent.com/u/761456?v=4","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 secrets management, encryption as a service, and privileged access management","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":"2018-05-08T14:26:41Z","pushed_at":"2018-05-08T14:49:27Z","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":50097,"stargazers_count":9135,"watchers_count":9135,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1346,"mirror_url":null,"archived":false,"open_issues_count":252,"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":1346,"open_issues":252,"watchers":9135,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/4512"},"html":{"href":"https://github.com/hashicorp/vault/pull/4512"},"issue":{"href":"https://api.github.com/repos/hashicorp/vault/issues/4512"},"comments":{"href":"https://api.github.com/repos/hashicorp/vault/issues/4512/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/4512/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/4512/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/vault/statuses/0383875a04083134d965c650a7ac2e870d061632"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"vishalnayak"}}