Skip to content

Add configuration property for Hive view security mode#12221

Merged
findepi merged 1 commit intotrinodb:masterfrom
joechu1:default-view-mode
May 6, 2022
Merged

Add configuration property for Hive view security mode#12221
findepi merged 1 commit intotrinodb:masterfrom
joechu1:default-view-mode

Conversation

@joechu1
Copy link
Copy Markdown
Member

@joechu1 joechu1 commented May 3, 2022

Description

This PR provides a configuration property to set the security mode used for Hive views. Hive views are hard-coded to use the DEFINER mode, which may not always be the desired mode for checking user permissions.

Is this change a fix, improvement, new feature, refactoring, or other?

Improvement

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

Hive connector

How would you describe this change to a non-technical end user or system administrator?

The configuration property determines whether access to a Hive view is granted based on the permissions of the user who created the view, or the user who is querying the view, assuming that the security permission checks are enabled.

Related issues, pull requests, and links

  • Based on the work done in #7358

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
( ) Release notes entries required with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why does this have a hard coded true but the next line is configurable? If this is correct, add a comment explaining what is happening here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, this appears to be the only caller of this in the PR, and it is hard coded to true. Does this needt to be a parameter at all?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had the wrong approach; re-wrote this based on findepi's guidance

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This formatting change doesn't seem right

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Misread this; thought I was fixing the indentation but the original was correct.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a 3rd config toggle pertaining to Hive Views translation.
I think we should group the configs together under one namespace: hive.hive-views.*.

I posted a PR to discuss that: #12238

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated the config name to follow what is being proposed in #12238

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

per above, pass the configuration to createViewReader and don't pass it to decodeViewData()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, re-wrote this based on your guidance.

@joechu1 joechu1 requested review from dain and findepi May 5, 2022 07:15
@findepi
Copy link
Copy Markdown
Member

findepi commented May 5, 2022

@joechu1 since there is an agreement to rename configs as in #12238

unfortunately, this will cause conflicts here. can you please rebase your PR on that one, or wait for the other one to be merged?

@joechu1 joechu1 force-pushed the default-view-mode branch from ecc7106 to cee0284 Compare May 6, 2022 07:25
@github-actions github-actions bot added the docs label May 6, 2022
@joechu1
Copy link
Copy Markdown
Member Author

joechu1 commented May 6, 2022

PR has been rebased

@findepi findepi force-pushed the default-view-mode branch from cee0284 to c9931f2 Compare May 6, 2022 09:04
@findepi
Copy link
Copy Markdown
Member

findepi commented May 6, 2022

(rebased after #12238 merged)

@findepi findepi force-pushed the default-view-mode branch from e802af1 to f5ac41a Compare May 6, 2022 09:07
@findepi findepi merged commit 235ad76 into trinodb:master May 6, 2022
@github-actions github-actions bot added this to the 380 milestone May 6, 2022
@mosabua
Copy link
Copy Markdown
Member

mosabua commented May 6, 2022

Documentation was missed. I created a PR for adding that in.. please review #12272

Optional.ofNullable(table.getParameters().get(TABLE_COMMENT)),
Optional.empty(),
false);
hiveViewsRunAsInvoker);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it work, if owner is always Optional.empty() (line above)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This does work; although the ConnectorViewDefinition returns without an owner, that information is then added again in HiveMetadata#getView.

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

Development

Successfully merging this pull request may close these issues.

4 participants