Skip to content

Commit f182794

Browse files
renetapopovajackwaudbyNataliaIvakinaHannesSandbergAlexicaWright
authored
Merge dev into 5.x (neo4j#2003)
Co-authored-by: Jack Waudby <[email protected]> Co-authored-by: NataliaIvakina <[email protected]> Co-authored-by: Hannes Sandberg <[email protected]> Co-authored-by: Jessica Wright <[email protected]> Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Nick Giles <[email protected]> Co-authored-by: Aleksey Karasavov <[email protected]> Co-authored-by: Lasse Heemann <[email protected]> Co-authored-by: Love Kristofer Leifland <[email protected]> Co-authored-by: Lidia Zuin <[email protected]> Co-authored-by: Nathan Smith <[email protected]> Co-authored-by: Phil Wright <[email protected]> Co-authored-by: Balazs Lendvai <[email protected]> Co-authored-by: Jenny <[email protected]> Co-authored-by: Sum <[email protected]> Co-authored-by: sumyiren <[email protected]> Co-authored-by: David Pond <[email protected]> Co-authored-by: Stefano Ottolenghi <[email protected]> Co-authored-by: Frannie-Ludmilla <[email protected]> Co-authored-by: Fábio Botelho <[email protected]> Co-authored-by: Stefanos Giagkiozis <[email protected]> Co-authored-by: Nacho Cordon <[email protected]> Co-authored-by: tselmeg <[email protected]> Co-authored-by: Tony Butterfield <[email protected]> Co-authored-by: Anna Sjerling <[email protected]> Co-authored-by: Therese Magnusson <[email protected]> Co-authored-by: Mark Dixon <[email protected]> Co-authored-by: Tselmeg Baasan <[email protected]> Co-authored-by: Therese Magnusson <[email protected]> Co-authored-by: Jack Waudby <[email protected]> Co-authored-by: Wilco <[email protected]> Co-authored-by: Ragnar Wernersson <[email protected]> Co-authored-by: Aurélien Arena <[email protected]> Co-authored-by: Fi Quick <[email protected]> Co-authored-by: Jens Pryce-Åklundh <[email protected]> Co-authored-by: Lasse Heemann <[email protected]> Co-authored-by: Florent Biville <[email protected]> Co-authored-by: Gerrit Meier <[email protected]> Co-authored-by: iamolegga <[email protected]> Co-authored-by: LinneaAndersson <[email protected]>
1 parent d26d65b commit f182794

35 files changed

+3049
-2935
lines changed

antora.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ nav:
77
asciidoc:
88
attributes:
99
neo4j-version: '5'
10-
neo4j-version-minor: '5.25'
11-
neo4j-version-exact: '5.25.1'
12-
neo4j-buildnumber: '5.25'
10+
neo4j-version-minor: '5.26'
11+
neo4j-version-exact: '5.26.0'
12+
neo4j-buildnumber: '5.26'
1313
neo4j-debian-package-version: '1:5.22.0@'

modules/ROOT/content-nav.adoc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
*** xref:database-administration/composite-databases/querying-composite-databases.adoc[]
126126
*** xref:database-administration/composite-databases/sharding-with-copy.adoc[]
127127
** xref:database-administration/syntax.adoc[]
128+
** xref:database-administration/routing-decisions.adoc[]
128129
129130
* xref:database-internals/index.adoc[]
130131
** xref:database-internals/transaction-management.adoc[]
@@ -183,9 +184,9 @@
183184
*** xref:authentication-authorization/dbms-administration.adoc[]
184185
*** xref:authentication-authorization/load-privileges.adoc[]
185186
*** xref:authentication-authorization/limitations.adoc[]
186-
*** xref:authentication-authorization/privileges-immutable.adoc[]
187187
*** xref:authentication-authorization/manage-execute-permissions.adoc[]
188188
** xref:authentication-authorization/built-in-roles.adoc[]
189+
** xref:authentication-authorization/immutable-roles-privileges.adoc[]
189190
** Integration with auth systems
190191
*** xref:authentication-authorization/auth-providers.adoc[]
191192
*** xref:authentication-authorization/ldap-integration.adoc[]
@@ -236,20 +237,17 @@
236237
*** xref:tools/neo4j-admin/validate-config.adoc[]
237238
** xref:tools/cypher-shell.adoc[]
238239
240+
* xref:procedures.adoc[]
241+
239242
* xref:tutorial/index.adoc[]
240243
//** xref:tutorial/local-causal-cluster.adoc[]
241244
//** xref:tutorial/causal-backup-restore-db.adoc[]
242245
** xref:tutorial/neo4j-admin-import.adoc[]
243246
** xref:tutorial/tutorial-composite-database.adoc[]
244247
** xref:tutorial/access-control.adoc[]
245248
** xref:tutorial/tutorial-sso-configuration.adoc[]
246-
** xref:tutorial/tutorial-immutable-privileges.adoc[]
247249
** xref:tutorial/tutorial-clustering-docker.adoc[]
248250
249-
* Appendix
250-
** xref:reference/procedures.adoc[]
251-
** xref:routing-decisions.adoc[]
252-
253251
// ** xref:clustering-advanced/index.adoc[]
254252
// *** xref:clustering-advanced/lifecycle.adoc[]
255253
// *** xref:clustering-advanced/multi-data-center/index.adoc[]

modules/ROOT/images/privileges_grant_and_deny_syntax.svg

Lines changed: 1 addition & 1 deletion
Loading

modules/ROOT/pages/authentication-authorization/database-administration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The components of the database privilege commands are:
2727
* _mutability_:
2828
** `IMMUTABLE` - When used in conjunction with `GRANT` or `DENY`, specifies that a privilege cannot subsequently be removed unless auth is disabled.
2929
Contrastingly, when `IMMUTABLE` is specified in conjunction with a `REVOKE` command, it will act as a filter and only remove matching _immutable_ privileges.
30-
See also xref:authentication-authorization/privileges-immutable.adoc[].
30+
See also xref:authentication-authorization/immutable-roles-privileges.adoc[].
3131

3232
* _database-privilege_
3333
** `ACCESS` - allows access to a specific database or remote database alias.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
[role=enterprise-edition not-on-aura]
2+
[[immutable-roles-and-privileges]]
3+
= Immutable roles and privileges
4+
:description: This section explains how to use Cypher to manage immutable roles and privileges.
5+
6+
7+
Immutable privileges are useful for restricting the actions of users who can themselves administer xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-privilege-management[privileges].
8+
Starting with Neo4j 5.26, Neo4j also introduces immutable roles.
9+
Immutable roles are useful for providing _system roles_, which appear as permanent parts of the DBMS.
10+
11+
12+
[CAUTION]
13+
====
14+
Immutable privileges and roles should only be used in situations where changes are rare.
15+
They are intentionally difficult to modify, so changes should be undertaken with caution (e.g., when the DBMS has been isolated by some other means and unauthorized access can be reliably prevented).
16+
Typically, this type of modification should only be made once during the commissioning phase of a DBMS.
17+
====
18+
19+
[[administer-immutable-roles-and-privileges]]
20+
== Administer immutable roles and privileges
21+
22+
After the DBMS is safely isolated from external connections, follow these steps to administer immutable roles and privileges:
23+
24+
. Change the config setting xref:configuration/configuration-settings.adoc#config_dbms.security.auth_enabled[`dbms.security.auth_enabled`] to `false`.
25+
. Restart the DBMS.
26+
. Create or remove immutable privileges and roles in the same way as regular privileges and roles but with the addition of the `IMMUTABLE` keyword.
27+
See <<immutable-roles-privileges-examples, Examples>>.
28+
. Change the config setting xref:configuration/configuration-settings.adoc#config_dbms.security.auth_enabled[`dbms.security.auth_enabled`] back to `true`.
29+
. Restart the DBMS.
30+
31+
Privileges and roles created in this way now appear as an immutable part of the DBMS.
32+
If you want to change or remove them, you must repeat the process of setting xref:configuration/configuration-settings.adoc#config_dbms.security.auth_enabled[`dbms.security.auth_enabled`] to `false`.
33+
34+
[[immutable-roles-privileges-examples]]
35+
== Examples
36+
37+
The following examples demonstrate how to use Cypher to manage immutable roles and privileges.
38+
39+
=== Restricting the actions of users who can manage privileges
40+
41+
To prevent all users (including those with `PRIVILEGE MANAGEMENT` privileges) from performing *database management*, attach an immutable privilege to the `PUBLIC` role.
42+
The `PUBLIC` role implicitly and irrevocably applies to all users.
43+
44+
. Ensure that you have completed steps 1 and 2 from <<administer-immutable-roles-and-privileges>>.
45+
. Run the following command to deny the `IMMUTABLE DATABASE MANAGEMENT` privilege to the `PUBLIC` role:
46+
+
47+
[source, cypher, role=test-skip]
48+
----
49+
DENY IMMUTABLE DATABASE MANAGEMENT ON DBMS TO PUBLIC
50+
----
51+
52+
. Verify that the `IMMUTABLE` keyword has been added to the privilege:
53+
+
54+
[source, cypher, role=noplay]
55+
----
56+
SHOW PRIVILEGES WHERE IMMUTABLE
57+
----
58+
+
59+
.Result
60+
[options="header,footer", width="100%", cols="1m,2m,1m,1m,1m,1m,1m"]
61+
|===
62+
|access
63+
|action
64+
|resource
65+
|graph
66+
|segment
67+
|role
68+
|immutable
69+
70+
|"DENIED"
71+
|"database_management"
72+
|"database"
73+
|"*"
74+
|"database"
75+
|"PUBLIC"
76+
|true
77+
78+
7+a|Rows: 2
79+
|===
80+
+
81+
The result shows that all users are restricted from adding or removing privileges, including the `admin` user.
82+
. Ensure you have completed steps 4 and 5 from <<administer-immutable-roles-and-privileges>>.
83+
84+
=== Creating permanent roles that cannot be changed
85+
86+
You can use immutable roles to create permanent built-in system roles that cannot be modified even by users who have xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-role-management[`ROLE MANAGEMENT` privileges].
87+
88+
For example, you want to create an `analyst` role that cannot be dropped, renamed, or have any of its privileges changed (even by users with the `ROLE MANAGEMENT` and `PRIVILEGE MANAGEMENT` privileges).
89+
90+
91+
. Ensure that you have completed steps 1 and 2 from <<administer-immutable-roles-and-privileges>>.
92+
. Create an immutable role to hold the immutable privileges:
93+
+
94+
[source, cypher, role=noplay]
95+
----
96+
CREATE IMMUTABLE ROLE analyst
97+
----
98+
99+
. Immutably grant the `MATCH` privilege:
100+
+
101+
[source, cypher, role=noplay]
102+
----
103+
GRANT IMMUTABLE MATCH {*} ON GRAPH * ELEMENTS * TO analyst
104+
----
105+
106+
. Ensure you have completed steps 4 and 5 from <<administer-immutable-roles-and-privileges>>.
107+
+
108+
Now, even users with `ROLE MANAGEMENT` and `PRIVILEGE MANAGEMENT` privileges will not be able do any of the following:
109+
+
110+
.Drop the `analyst` role
111+
[source, cypher, role=noplay]
112+
----
113+
DROP ROLE analyst
114+
----
115+
+
116+
.Revoke the `MATCH` privilege from the `analyst` role
117+
[source, cypher, role=noplay]
118+
----
119+
REVOKE MATCH {*} ON GRAPH * ELEMENTS * FROM analyst
120+
----
121+
+
122+
.Rename the `analyst` role
123+
[source, cypher, role=noplay]
124+
----
125+
RENAME ROLE analyst TO dataReader
126+
----
127+
128+
[NOTE]
129+
====
130+
While the make-up (name, existence, associated privileges) of immutable roles is immutable, their assignment to users is not.
131+
This means that an immutable role can itself be granted to or revoked from a user by any user with `ROLE MANAGEMENT` privileges.
132+
====
133+
[NOTE]
134+
====
135+
Only immutable privileges (e.g. `GRANT IMMUTABLE MATCH {*} ON GRAPH * ELEMENTS * TO analyst` in the example above) can be assigned to immutable roles.
136+
This is to make sure that an immutable role and all of its privileges is explicitly and completely immutable.
137+
====
138+

modules/ROOT/pages/authentication-authorization/ldap-integration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ this LDAP group will fail authentication, even if their credentials are correct.
6565
|===
6666

6767
All settings are defined at server startup time in the default configuration file _xref:configuration/neo4j-conf.adoc[neo4j.conf]_ or can be modified at
68-
runtime using xref:reference/procedures.adoc#procedure_dbms_setconfigvalue[`dbms.setConfigValue()`].
68+
runtime using xref:procedures.adoc#procedure_dbms_setconfigvalue[`dbms.setConfigValue()`].
6969

7070

7171
[[auth-ldap-configure-provider]]

modules/ROOT/pages/authentication-authorization/manage-privileges.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ The components of the graph privilege commands are:
4545
** `REVOKE` – removes granted or denied privileges from roles.
4646

4747
* _mutability_:
48-
** `IMMUTABLE` can optionally be specified when performing a `GRANT` or `DENY` to indicate that the privilege cannot be subsequently removed unless auth is disabled. Auth must also be disabled in order to `GRANT` or `DENY` an immutable privilege. Contrastingly, when `IMMUTABLE` is specified in conjunction with a `REVOKE` command, it will act as a filter and only remove matching _immutable_ privileges. See also xref:authentication-authorization/privileges-immutable.adoc[].
48+
** `IMMUTABLE` can optionally be specified when performing a `GRANT` or `DENY` to indicate that the privilege cannot be subsequently removed unless auth is disabled.
49+
Auth must also be disabled in order to `GRANT` or `DENY` an immutable privilege.
50+
Contrastingly, when `IMMUTABLE` is specified in conjunction with a `REVOKE` command, it will act as a filter and only remove matching _immutable_ privileges.
51+
Starting from Neo4j 5.26, immutable privileges can also be used together with immutable roles.
52+
See xref:authentication-authorization/immutable-roles-privileges.adoc[] for more information.
4953

5054
* _graph-privilege_:
5155
** Can be either a xref:authentication-authorization/privileges-reads.adoc[read privilege] or xref:authentication-authorization/privileges-writes.adoc[write privilege].

modules/ROOT/pages/authentication-authorization/manage-roles.adoc

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ GRANT SHOW ROLE
6262
----
6363

6464

65-
(see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-role-management[DBMS ROLE MANAGEMENT privileges]).
65+
See xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-role-management[DBMS ROLE MANAGEMENT privileges].
6666
|===
6767

6868

@@ -140,7 +140,7 @@ a|
140140
GRANT SHOW PRIVILEGE
141141
----
142142

143-
(see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-privilege-management[DBMS PRIVILEGE MANAGEMENT privileges])
143+
See xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-privilege-management[DBMS PRIVILEGE MANAGEMENT privileges].
144144

145145
|===
146146

@@ -150,7 +150,7 @@ GRANT SHOW PRIVILEGE
150150

151151

152152
| Command
153-
m| CREATE ROLE
153+
m| CREATE [IMMUTABLE] ROLE
154154

155155
| Syntax
156156
a|
@@ -339,7 +339,9 @@ For more information, see xref:authentication-authorization/dbms-administration.
339339
== Listing roles
340340

341341

342-
You can view all available roles using the Cypher command `SHOW ROLES`, which returns a single column.
342+
You can view all available roles using the Cypher command `SHOW ROLES`, which returns a single column by default.
343+
Starting from 5.26, you can optionally use `SHOW ROLES YIELD *` to see if the role is immutable.
344+
See <<access-control-immutable-roles, Immutable roles>> for more information.
343345

344346
.`SHOW ROLES` output
345347
[options="header", width="100%", cols="2a,4,2m"]
@@ -351,6 +353,10 @@ You can view all available roles using the Cypher command `SHOW ROLES`, which re
351353
| role
352354
| Role name
353355
| STRING
356+
357+
| immutable
358+
| `true` if the role is immutable, otherwise `false`.
359+
| BOOLEAN
354360
|===
355361

356362
.List all roles
@@ -481,18 +487,18 @@ It is also possible to use `SKIP` and `LIMIT` to paginate the results.
481487
[[access-control-create-roles]]
482488
== Creating roles
483489

484-
Roles can be created using `CREATE ROLE`:
490+
Roles can be created using `CREATE [IMMUTABLE] ROLE`:
485491

486492
[source, syntax]
487493
----
488-
CREATE ROLE name [IF NOT EXISTS] [AS COPY OF otherName]
494+
CREATE [IMMUTABLE] ROLE name [IF NOT EXISTS] [AS COPY OF otherName]
489495
----
490496

491-
Roles can be created or replaced by using `CREATE OR REPLACE ROLE`:
497+
Roles can be created or replaced by using `CREATE OR REPLACE [IMMUTABLE] ROLE`:
492498

493499
[source, syntax]
494500
----
495-
CREATE OR REPLACE ROLE name [AS COPY OF otherName]
501+
CREATE OR REPLACE [IMMUTABLE] ROLE name [AS COPY OF otherName]
496502
----
497503

498504
[NOTE]
@@ -504,7 +510,7 @@ The following naming rules apply:
504510
* Role names are case sensitive.
505511
====
506512

507-
A role can be copied, keeping its privileges, using `CREATE ROLE name AS COPY OF otherName`.
513+
A role can be copied, keeping its privileges, using `CREATE [IMMUTABLE] ROLE name AS COPY OF otherName`.
508514

509515
.Copy a role
510516
======
@@ -573,9 +579,19 @@ This is equivalent to running `DROP ROLE myrole IF EXISTS` followed by `CREATE R
573579

574580
[NOTE]
575581
====
576-
* The `CREATE OR REPLACE ROLE` command does not allow you to use the `IF NOT EXISTS`.
582+
The `CREATE OR REPLACE ROLE` command does not allow you to use the `IF NOT EXISTS`.
577583
====
578584

585+
[role=new-in-5.26]
586+
[[access-control-immutable-roles]]
587+
== Immutable roles
588+
589+
Immutable roles are those that cannot be modified in the usual way.
590+
This means they cannot be created, renamed, dropped, or have privileges granted to or revoked from them under normal operating conditions.
591+
See xref:authentication-authorization/immutable-roles-privileges.adoc[Immutable roles and privileges] for details of when and how the `IMMUTABLE` keyword may be used.
592+
593+
They are useful in cases where you need a permanent built-in system role that cannot be modified even by users who have xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-role-management[`ROLE MANAGEMENT` privileges] but yet can be granted to and revoked from users in the same way as an ordinary role.
594+
579595

580596
[[access-control-rename-roles]]
581597
== Renaming roles

modules/ROOT/pages/authentication-authorization/privileges-immutable.adoc

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)