-
Notifications
You must be signed in to change notification settings - Fork 64
Add SHOW SETTING clause and privileges #440
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
Changes from all commits
729b704
8f58cfb
95386c3
9adee28
bf7de13
401376d
498a0ec
d514bb3
f718ef3
7059d7f
f3c4036
81e0317
bbb60ed
9262650
588d4db
5f21656
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -55,6 +55,8 @@ CREATE ROLE globbing4 IF NOT EXISTS; | |||||||||||
| CREATE ROLE globbing5 IF NOT EXISTS; | ||||||||||||
| CREATE ROLE globbing6 IF NOT EXISTS; | ||||||||||||
| CREATE ROLE dbmsManager IF NOT EXISTS; | ||||||||||||
| CREATE ROLE configurationViewer IF NOT EXISTS; | ||||||||||||
| CREATE ROLE deniedConfigurationViewer IF NOT EXISTS; | ||||||||||||
| ---- | ||||||||||||
| //// | ||||||||||||
|
|
||||||||||||
|
|
@@ -1953,82 +1955,88 @@ a|Rows: 2 | |||||||||||
| |=== | ||||||||||||
| ====== | ||||||||||||
|
|
||||||||||||
| [[access-control-name-globbing]] | ||||||||||||
| === Procedure and user-defined function name-globbing | ||||||||||||
|
|
||||||||||||
| The name-globbing for procedure and user defined function names is a simplified version of globbing for filename expansions. | ||||||||||||
| It only allows two wildcard characters: `+*+` and `?`, which are used for multiple and single character matches. | ||||||||||||
| In this case, `+*+` means 0 or more characters and `?` matches exactly one character. | ||||||||||||
| [[access-control-dbms-administration-setting]] | ||||||||||||
| == The DBMS `SETTING` privileges | ||||||||||||
|
|
||||||||||||
| The ability to show configuration settings can be granted via the `SHOW SETTING` privilege. | ||||||||||||
| A role with this privilege is allowed to query the configuration settings matched by the xref::access-control/dbms-administration.adoc#access-control-name-globbing[name-globbing]. | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| [NOTE] | ||||||||||||
| ==== | ||||||||||||
| The name-globbing is subject to the xref::syntax/naming.adoc[standard Cypher restrictions on valid identifiers], | ||||||||||||
| with the exception that it may include dots, stars, and question marks without the need for escaping using backticks. | ||||||||||||
|
|
||||||||||||
| Each part of the name-globbing separated by dots may be individually escaped, for example, `++mine.`procedureWith%`++` but not `++mine.procedure`With%`++`. | ||||||||||||
| It is also good to keep in mind that wildcard characters behave as wildcards even when escaped. | ||||||||||||
| As an example, using `++`*`++` is equivalent to using `+*+`, and thus allows executing all functions or procedures and not only the procedure or function named `+*+`. | ||||||||||||
| The syntax descriptions use xref:access-control/index.adoc#access-control-syntax[the style] from access control. | ||||||||||||
| ==== | ||||||||||||
|
|
||||||||||||
| The examples below only use procedures, but the same rules apply to user defined function names: | ||||||||||||
|
|
||||||||||||
| * `mine.public.exampleProcedure` | ||||||||||||
| * `mine.public.exampleProcedure1` | ||||||||||||
| * `mine.public.exampleProcedure2` | ||||||||||||
| * `mine.public.with#Special§Characters` | ||||||||||||
| * `mine.private.exampleProcedure` | ||||||||||||
| * `mine.private.exampleProcedure1` | ||||||||||||
| * `mine.private.exampleProcedure2` | ||||||||||||
| * `mine.private.with#Special§Characters` | ||||||||||||
| * `your.exampleProcedure` | ||||||||||||
| .Setting privileges command syntax | ||||||||||||
| [options="header", width="100%", cols="3a,2"] | ||||||||||||
| |=== | ||||||||||||
| | Command | ||||||||||||
| | Description | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE * ON DBMS TO globbing1 | ||||||||||||
| ---- | ||||||||||||
| | [source, syntax, role=noheader] | ||||||||||||
| GRANT [IMMUTABLE] SHOW SETTING[S] name-globbing[, ...] | ||||||||||||
| ON DBMS | ||||||||||||
| TO role[, ...] | ||||||||||||
| | Enables the specified roles to query given configuration settings. | ||||||||||||
| |=== | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing1` can thus run all the procedures. | ||||||||||||
| The following query shows an example of how to grant this privilege: | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE mine.*.exampleProcedure ON DBMS TO globbing2 | ||||||||||||
| GRANT SHOW SETTING server.bolt.* ON DBMS TO configurationViewer | ||||||||||||
| ---- | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing2` can thus run procedures `mine.public.exampleProcedure` and `mine.private.exampleProcedure`, but none of the others. | ||||||||||||
| Users with the role `configurationViewer` can then query any setting in the `server.bolt` namespace. | ||||||||||||
|
|
||||||||||||
| The updated role `configurationViewer` has privileges that only allow querying settings in the `server.bolt` namespace. | ||||||||||||
| List all privileges for the role `configurationViewer` as commands by using the following query: | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE mine.*.exampleProcedure? ON DBMS TO globbing3 | ||||||||||||
| SHOW ROLE configurationViewer PRIVILEGES AS COMMANDS | ||||||||||||
| ---- | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing3` can thus run procedures `mine.public.exampleProcedure1`, `mine.private.exampleProcedure1` and `mine.private.exampleProcedure2`, but none of the others. | ||||||||||||
| .Result | ||||||||||||
| [options="header,footer", width="100%", cols="m"] | ||||||||||||
| |=== | ||||||||||||
| |command | ||||||||||||
| |"GRANT SHOW SETTING server.bolt.* ON DBMS TO `configurationViewer`" | ||||||||||||
ali-ince marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| a|Rows: 1 | ||||||||||||
| |=== | ||||||||||||
|
|
||||||||||||
| To deny a specific setting from a role, first grant `SHOW SETTINGS *`, and then deny the unwanted setting. | ||||||||||||
| For example, the following queries allow the querying of all settings, except those starting with `dbms.security`: | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE *.exampleProcedure ON DBMS TO globbing4 | ||||||||||||
| GRANT SHOW SETTINGS * ON DBMS TO deniedConfigurationViewer | ||||||||||||
| ---- | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing4` can thus run procedures `your.exampleProcedure`, `mine.public.exampleProcedure` and `mine.private.exampleProcedure`, but none of the others. | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE mine.public.exampleProcedure* ON DBMS TO globbing5 | ||||||||||||
| DENY SHOW SETTING dbms.security* ON DBMS TO deniedConfigurationViewer | ||||||||||||
| ---- | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing5` can thus run procedures `mine.public.exampleProcedure`, `mine.public.exampleProcedure1` and `mine.public.exampleProcedure42`, but none of the others. | ||||||||||||
| The resulting role has privileges that allow querying all settings except those starting with `dbms.security`. | ||||||||||||
| List all privileges for the role `deniedConfigurationViewer` as commands by using the following query: | ||||||||||||
|
|
||||||||||||
| [source, cypher, role=noplay] | ||||||||||||
| ---- | ||||||||||||
| GRANT EXECUTE PROCEDURE `mine.public.with#*§Characters`, mine.private.`with#Spec???§Characters` ON DBMS TO globbing6 | ||||||||||||
| SHOW ROLE deniedConfigurationViewer PRIVILEGES AS COMMANDS | ||||||||||||
| ---- | ||||||||||||
|
|
||||||||||||
| Users with the role `globbing6` can thus run procedures `mine.public.with#Special§Characters` and `mine.private.with#Special§Characters`, but none of the others. | ||||||||||||
| .Result | ||||||||||||
| [options="header,footer", width="100%", cols="m"] | ||||||||||||
| |=== | ||||||||||||
| |command | ||||||||||||
| |"DENY SHOW SETTING dbms.security* ON DBMS TO `deniedConfigurationViewer`" | ||||||||||||
| |"GRANT SHOW SETTING * ON DBMS TO `deniedConfigurationViewer`" | ||||||||||||
| a|Rows: 2 | ||||||||||||
| |=== | ||||||||||||
|
|
||||||||||||
| [NOTE] | ||||||||||||
| ==== | ||||||||||||
| The name-globbing may be fully or partially escaped. | ||||||||||||
| Both `+*+` and `+?+` are interpreted as wildcards either way. | ||||||||||||
| ==== | ||||||||||||
| As the query result shows, access to any setting starting with `dbms.security` are blocked, but the rest can still be queried. | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| [[access-control-dbms-administration-all]] | ||||||||||||
|
|
@@ -2043,6 +2051,7 @@ The right to perform the following privileges can be achieved with a single comm | |||||||||||
| * Show, assign, and remove privileges. | ||||||||||||
| * Execute all procedures with elevated privileges. | ||||||||||||
| * Execute all user defined functions with elevated privileges. | ||||||||||||
| * Show all configuration settings. | ||||||||||||
|
|
||||||||||||
| [NOTE] | ||||||||||||
| ==== | ||||||||||||
|
|
@@ -2077,3 +2086,85 @@ SHOW ROLE dbmsManager PRIVILEGES AS COMMANDS | |||||||||||
| |"GRANT ALL DBMS PRIVILEGES ON DBMS TO `dbmsManager`" | ||||||||||||
| a|Rows: 1 | ||||||||||||
| |=== | ||||||||||||
|
|
||||||||||||
| [[access-control-name-globbing]] | ||||||||||||
| == Name-globbing for procedures, user-defined functions, and settings | ||||||||||||
|
|
||||||||||||
| The name-globbing for procedure, user defined function, and setting names is a simplified version of globbing for filename expansions. | ||||||||||||
| It only allows two wildcard characters: `+*+` and `?`, which are used for multiple and single character matches. | ||||||||||||
| In this case, `+*+` means 0 or more characters and `?` matches exactly one character. | ||||||||||||
|
|
||||||||||||
| [NOTE] | ||||||||||||
| ==== | ||||||||||||
| The name-globbing is subject to the xref::syntax/naming.adoc[standard Cypher restrictions on valid identifiers], | ||||||||||||
| with the exception that it may include dots, stars, and question marks without the need for escaping using backticks. | ||||||||||||
|
|
||||||||||||
| Each part of the name-globbing separated by dots may be individually escaped. | ||||||||||||
| For example, `++mine.`procedureWith%`++` is allowed, but not `++mine.procedure`With%`++`. | ||||||||||||
| Also, note that wildcard characters behave as wildcards even when escaped. | ||||||||||||
| For example, using `++`*`++` is equivalent to using `+*+`, and thus allows executing all functions or procedures and not only the procedure or function named `+*+`. | ||||||||||||
| ==== | ||||||||||||
|
|
||||||||||||
| Given the following list of procedures: | ||||||||||||
|
|
||||||||||||
| * `mine.public.exampleProcedure` | ||||||||||||
| * `mine.public.exampleProcedure1` | ||||||||||||
| * `mine.public.exampleProcedure2` | ||||||||||||
| * `mine.public.with#Special§Characters` | ||||||||||||
| * `mine.private.exampleProcedure` | ||||||||||||
| * `mine.private.exampleProcedure1` | ||||||||||||
| * `mine.private.exampleProcedure2` | ||||||||||||
| * `mine.private.with#Special§Characters` | ||||||||||||
| * `your.exampleProcedure` | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| * `your.exampleProcedure` | |
| * `your.exampleProcedure` | |
| The following examples demonstrate how procedures with valid name-globbing patterns can be used in queries. | |
| Note that the same rules apply to user-defined functions and settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about switching them? Have this first, then the comment on given these procedures (and then maybe an additional comment to clarify where the examples start?) As the procedure list is more set-up to the examples it feels like we should have clarified why we only look at procedures before it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I find Jens' approach a bit more clear, but suggest we slightly change the last block;
The following examples demonstrate how name-globbing patterns can be used in queries.
Note that the same rules apply to user-defined functions and settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any difference between your block and his?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, copy-paste error. fixed it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still want to mention something about the examples only using procedures?
Uh oh!
There was an error while loading. Please reload this page.