Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive security context information when security plugin fails to populate user info #204

Merged

Conversation

saikaranam-amazon
Copy link
Member

@saikaranam-amazon saikaranam-amazon commented Oct 18, 2021

Description

Derive security context information when security plugin fails to populate user info

Issues Resolved

#203

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

@naveenpajjuri naveenpajjuri left a comment

Choose a reason for hiding this comment

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

LGTM

@saikaranam-amazon saikaranam-amazon merged commit a9d9c6f into opensearch-project:main Oct 19, 2021
Comment on lines +59 to 65
if(userInfo == null && userObj != null) {
// Case: When admin certs are used, security plugin skips populating the user info in thread context.
// If userObj(obj) is present and userInfo(String) is not populated, assuming admin role for the user and
// only passed role(use_roles) in the request is stored after checks (as admin should have access to all roles)
userInfo = "adminDN|"
}
return User.parse(userInfo)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this safe? Should anything be parsed from userObj?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, and we don't have direct access to userObj.

This is to make sure, we have place holder for user and doesn't assume that security context is not passed. All the checks are performed in the security plugin.

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.

4 participants