Skip to content

Add definers for views (Attempt 2) - #60439

Merged
pufit merged 67 commits into
masterfrom
pufit/views-sql-security
Feb 28, 2024
Merged

pufit merged 67 commits into
masterfrom
pufit/views-sql-security

Conversation

@pufit

@pufit pufit commented Feb 27, 2024

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Added new syntax which allows to specify definer user in View/Materialized View. This allows to execute selects/inserts from views without explicit grants for underlying tables.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Closes #19228
Original PR: #54901

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

pufit added 30 commits October 11, 2023 21:07
# Conflicts:
#	docs/en/operations/settings/settings.md
#	src/Core/Settings.h
# Conflicts:
#	docs/en/operations/settings/settings.md
#	src/Core/Settings.h
#	src/Processors/Transforms/buildPushingToViewsChain.cpp
# Conflicts:
#	src/Processors/Transforms/buildPushingToViewsChain.cpp
#	src/Storages/StorageMaterializedView.cpp
# Conflicts:
#	docs/en/sql-reference/statements/create/view.md
# Conflicts:
#	docs/en/operations/settings/settings.md
#	src/Core/Settings.h
#	src/Parsers/ASTAlterQuery.cpp
#	src/Processors/Transforms/buildPushingToViewsChain.cpp
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-feature Pull request with new product feature label Feb 27, 2024
@robot-ch-test-poll3

robot-ch-test-poll3 commented Feb 27, 2024 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit e0891b9 with description of existing statuses. It's updated for the latest CI running

⏳ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
A SyncThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending

@vitlibar vitlibar self-assigned this Feb 27, 2024
# Conflicts:
#	src/Core/SettingsChangesHistory.h
@pufit
pufit merged commit 330a206 into master Feb 28, 2024
@pufit
pufit deleted the pufit/views-sql-security branch February 28, 2024 00:00
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 28, 2024
@tavplubix

Copy link
Copy Markdown
Member

@pufit, please pay attention to the CI status

tavplubix added a commit that referenced this pull request Feb 28, 2024
user1="user02884_1_$RANDOM$RANDOM"
user2="user02884_2_$RANDOM$RANDOM"
user3="user02884_3_$RANDOM$RANDOM"
db="db02884_$RANDOM$RANDOM"

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 isn't this using the database that's created for each test? CLICKHOUSE_DATABASE.

Having it's custom database makes things harder to track and clean up (specially since the test is slow and might be killed in local envs).

@vitlibar vitlibar Mar 6, 2024 •

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 we could use this idea even for objects which are not databases:

user2="user2_02884_${CLICKHOUSE_DATABASE}_$RANDOM"

@clickgapai

Copy link
Copy Markdown
Contributor

Hi @pufit @vitlibar — while reviewing this PR I found the following:

Could you review the test PR and add the can be tested label if it looks good?
Happy to discuss — close anything that's wrong or already addressed.

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

Labels

pr-feature Pull request with new product feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RBAC: Stored Object Access Control / DEFINER / SQL SECURITY

7 participants