hanicz opened a new pull request, #1343: URL: https://github.com/apache/knox/pull/1343
…rization [KNOX-3410](https://issues.apache.org/jira/browse/KNOX-3410) - KnoxToken enable/disable endpoints perform no caller authorization ## What changes were proposed in this pull request? The KnoxToken enable/disable endpoints (enable, disable, enableTokens, disableTokens) flipped any token's enabled flag with no authorization check — any authenticated user could disable/re-enable another user's tokens. Fixed by gating `setTokenEnabledFlag` on the same check `revoke()` already uses: caller must own the token (`triesToRevokeOwnToken`) or be in the renewer/group whitelist (`tokenRenewalOrRevocationAuthorized`), else 403. ## How was this patch tested? Unit tests Tested locally by adding KNOXTOKEN to sandbox topology ``` curl -vku admin:admin-password -X "GET" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token?lifespan=P0DT1H0M" curl -vku guest:guest-password -X "GET" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token?lifespan=P0DT1H0M" curl -vk -d "tokenId" -u admin:admin-password -X "PUT" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/disable" curl -vk -d "tokenId" -u admin:admin-password -X "DELETE" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/revoke" curl -vk -d "tokenId" -u guest:guest-password -X "DELETE" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/revoke" curl -vk -d "tokenId" -u guest:guest-password -X "PUT" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/disable" ``` ## Integration Tests N/A ## UI changes N/A -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
