Skip to content

Conversation

@Sanket-Shelar
Copy link
Contributor

…users running the cmd instead of service users.

What changes were proposed in this pull request?

When grant policies are created the created and updated by should show user running the cmd, instead of service user. For this we have updated the logic which is setting the created by and updated by during policy creation.

How was this patch tested?

Local build passed, tested by creating grant policy and normal policy from ranger UI

…users running the cmd instead of service users.

private Long resolveUserId(String userLoginId) {
Long userId = null;
if (Objects.equals(userLoginId, ContextUtil.getCurrentUserLoginId())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userLoginId paramter name is misleading. The value sent is the name provided in the view object - which can be specified by callers of REST API to create/update policy/role/sevice/service-def, etc. This name should not be trusted.

The challenge with grant/revoke scenario is that the authenticated user (ContextUtil.getCurrentUserId()) can be the service-account, while the policy changes should be recorded as the grantor user - the payload value in GrantRevokeRequest.grantor. One approach to consider is to update grant/revoke calls to reset RangerSecurityContext with the identity of the grantor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants