You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include role names in access denied errors (#69318)
This commit adds a User's list of current role names to access denied
error messages to aid in diagnostics.
This allows an administrator to know whether the correct course of
action is to add another role to the user (e.g. by fixing incorrect
role mappings) or by modifying a role to add more privileges.
Resolves: #42166
Copy file name to clipboardExpand all lines: x-pack/plugin/ilm/qa/with-security/src/javaRestTest/java/org/elasticsearch/xpack/security/PermissionsIT.java
+1
Original file line number
Diff line number
Diff line change
@@ -154,6 +154,7 @@ public void testCanManageIndexWithNoPermissions() throws Exception {
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java
+8-3
Original file line number
Diff line number
Diff line change
@@ -819,7 +819,10 @@ public void testLookbackWithoutPermissions() throws Exception {
Copy file name to clipboardExpand all lines: x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
+20-9
Original file line number
Diff line number
Diff line change
@@ -676,8 +676,11 @@ public void testUnknownRoleCausesDenial() throws IOException {
Copy file name to clipboardExpand all lines: x-pack/plugin/src/test/resources/rest-api-spec/test/api_key/11_invalidation.yml
+4-2
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,8 @@ teardown:
126
126
"username": "api_key_manager"
127
127
}
128
128
- match: { "error.type": "security_exception" }
129
-
- match: { "error.reason": "action [cluster:admin/xpack/security/api_key/invalidate] is unauthorized for user [api_key_user_1], this action is granted by the cluster privileges [manage_api_key,manage_security,all]" }
129
+
- match:
130
+
"error.reason": "action [cluster:admin/xpack/security/api_key/invalidate] is unauthorized for user [api_key_user_1] with roles [user_role], this action is granted by the cluster privileges [manage_api_key,manage_security,all]"
130
131
131
132
- do:
132
133
headers:
@@ -189,7 +190,8 @@ teardown:
189
190
"realm_name": "default_native"
190
191
}
191
192
- match: { "error.type": "security_exception" }
192
-
- match: { "error.reason": "action [cluster:admin/xpack/security/api_key/invalidate] is unauthorized for user [api_key_user_1], this action is granted by the cluster privileges [manage_api_key,manage_security,all]" }
193
+
- match:
194
+
"error.reason": "action [cluster:admin/xpack/security/api_key/invalidate] is unauthorized for user [api_key_user_1] with roles [user_role], this action is granted by the cluster privileges [manage_api_key,manage_security,all]"
0 commit comments