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

HIVE-28286: Add filtering support for get_table_metas (Naveen Gangam) #5269

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

nrg4878
Copy link
Contributor

@nrg4878 nrg4878 commented May 29, 2024

What changes were proposed in this pull request?

Currently the filterTableMetas() method in the HiveMetastoreAuthorizer is a no-op. It returns the full set of tables that are passed into it. This prevents any filtering that is to be done.

This PR adds logic to be able to filter out the ones that the user does not have access to.

Why are the changes needed?

To enhance security in HMS.

Does this PR introduce any user-facing change?

No

Is the change a dependency upgrade?

No

How was this patch tested?

Tested manually in a Ranger enabled environment.

@nrg4878
Copy link
Contributor Author

nrg4878 commented May 29, 2024

@jfsii Could you review this change please?

return tableMetas;
String catName = null;
String dbName = null;
if (tableMetas != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If "tableMetas" is empty, can it throw ArrayOutOfBound exception?

throws MetaException {
return filterTableMetas(tableMetas);
if (LOG.isDebugEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to check LOG.isDebugEnabled(), since LOG.debug will only output, when debug level logging is enabled.

Copy link
Contributor

@jfsii jfsii left a comment

Choose a reason for hiding this comment

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

Left a few comments on structure and code, I didn't see any incorrect functionality - I agree with the other comments around the log lines.

Copy link

sonarcloud bot commented Jun 5, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Member

@dengzhhu653 dengzhhu653 left a comment

Choose a reason for hiding this comment

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

I think we have addressed the comments, it would be nice if someone can take an extra eye, cc @jfsii @mayankkunwar @zratkai. Thank you in advance!

Copy link
Contributor

@mayankkunwar mayankkunwar left a comment

Choose a reason for hiding this comment

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

LGTM

@dengzhhu653 dengzhhu653 merged commit 21be22f into apache:master Jun 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants