Skip to content

Commit 093dc1d

Browse files
Merge pull request #9007 from mandy-chessell/oak2026
Prevent non-administrators from updating their own secirity account
2 parents 55ecf9e + 4580d9d commit 093dc1d

File tree

4 files changed

+51
-28
lines changed

4 files changed

+51
-28
lines changed

open-metadata-implementation/common-services/metadata-security/metadata-security-server/src/main/java/org/odpi/openmetadata/metadatasecurity/server/OpenMetadataPlatformSecurityVerifier.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,7 @@ public static synchronized void updateUserAccount(String userId
254254
/*
255255
* Validate that someone has authority to update the user's account details.
256256
*/
257-
if (delegatingUserId.equals(userAccount.getUserId()))
258-
{
259-
/*
260-
* The caller is updating their own account.
261-
*/
262-
validatePlatformOperator(userId, null);
263-
}
264-
else
265-
{
266-
validatePlatformOperator(userId, delegatingUserId);
267-
}
268-
257+
validatePlatformOperator(userId, delegatingUserId);
269258
userSecurityConnector.setUserAccount(userAccount);
270259
}
271260
}
@@ -284,7 +273,7 @@ public static synchronized void deleteUserAccount(String userId,
284273
String accountUserId) throws UserNotAuthorizedException
285274
{
286275
/*
287-
* Validate that someone has authority to update the user's account details.
276+
* Validate that someone has authority to delete the user's account details.
288277
*/
289278
validatePlatformOperator(userId, delegatingUserId);
290279

open-metadata-implementation/governance-server-services/integration-daemon-services/integration-daemon-services-spring/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/server/spring/IntegrationDaemonResource.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,12 @@ public VoidResponse updateConnectorConnection(@PathVariable String serverNa
243243

244244

245245
/**
246-
* Issue a refresh() request on all connectors running in the integration daemon, or a specific connector if the connector name is specified.
246+
* Issue a refresh() request on all connectors running in the integration daemon or a specific connector if the connector name is specified.
247247
*
248248
* @param serverName integration daemon server name
249249
* @param delegatingUserId external userId making request
250250
* @param requestBody optional name of the connector to target - if no connector name is specified, all
251-
* connectors managed by this integration service are refreshed.
251+
* connectors managed by this integration daemon are refreshed.
252252
*
253253
* @return void or
254254
* InvalidParameterException one of the parameters is null or invalid or
@@ -272,12 +272,12 @@ public VoidResponse refreshConnectors(@PathVariable String
272272

273273

274274
/**
275-
* Restart all connectors running in the integration daemon, or restart a specific connector if the connector name is specified.
275+
* Restart all connectors running in the integration daemon or restart a specific connector if the connector name is specified.
276276
*
277277
* @param serverName integration daemon server name
278278
* @param delegatingUserId external userId making request
279279
* @param requestBody optional name of the connector to target - if no connector name is specified, all
280-
* connectors managed by this integration service are refreshed.
280+
* connectors managed by this integration daemon are refreshed.
281281
*
282282
* @return void or
283283
* InvalidParameterException one of the parameters is null or invalid or
@@ -305,8 +305,8 @@ public VoidResponse restartConnectors(@PathVariable String
305305
*
306306
* @param serverName integration daemon server name
307307
* @param delegatingUserId external userId making request
308-
* @param integrationGroupName name of integration group of interest
309-
* @return list of statuses - on for each assigned integration groups or
308+
* @param integrationGroupName name of the integration group of interest
309+
* @return integration group status, or
310310
* InvalidParameterException one of the parameters is null or invalid or
311311
* UserNotAuthorizedException the user is not authorized to issue this request or
312312
*/
@@ -327,11 +327,11 @@ public IntegrationGroupSummaryResponse getIntegrationGroupSummary(@PathVariable
327327

328328

329329
/**
330-
* Return a summary of each of the integration groups running in the integration daemon.
330+
* Return a summary of the integration groups running in the integration daemon.
331331
*
332332
* @param serverName integration daemon server name
333333
* @param delegatingUserId external userId making request
334-
* @return list of statuses - one for each assigned integration groups
334+
* @return list of statuses - one for each integration group, or
335335
* InvalidParameterException one of the parameters is null or invalid or
336336
* UserNotAuthorizedException the user is not authorized to issue this request or
337337
*/

open-metadata-implementation/view-services/security-officer/Egeria-api-security-officer.http

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Content-Type: application/json
2929
###
3030
# @name: setUserAccount
3131
# Set up or update a user account in the platform metadata security connector
32-
# The user requires operator permission for the platform unless it is their own user account they are retrieving.
32+
# The user requires operator permission for the platform.
3333
#
3434
# @param serverName name of called server
3535
# @param platformGUID unique identifier of the platform
3636
# @param requestBody requestBody used to create and configure the connector that performs platform security
3737
# @return void response
38-
#/
38+
#
3939
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/security-officer/platforms/{{platformGUID}}/user-accounts
4040
Authorization: Bearer {{token}}
4141
Content-Type: application/json
@@ -80,13 +80,13 @@ Content-Type: application/json
8080
"clearPassword" : "newSecret1"
8181
}
8282
}
83-
8483
}
8584

8685

8786
###
8887
# @name: getUserAccount
89-
# Return the user account object for the requested user from the platform metadata security connector. Null is returned if no platform security or user account has been set up.
88+
# Return the user account object for the requested user from the platform metadata security connector.
89+
# Null is returned if no platform security or user account has been set up.
9090
# The user requires operator permission for the platform unless it is their own user account they are retrieving.
9191
#
9292
# @param serverName name of called server

open-metadata-implementation/view-services/security-officer/Egeria-coco-manage-users.http

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Content-Type: application/json
3636

3737
###
3838
# =====================================================================================================================
39-
# Get access the the platform
39+
# Retrieve the platform GUID
4040
# https://egeria-project.org/types/0037-Software-Server-Platforms/
4141

4242
###
@@ -91,9 +91,14 @@ Authorization: Bearer {{callieToken}}
9191
GET {{baseURL}}/servers/{{viewServer}}/api/open-metadata/security-officer/platforms/{{omagServerPlatformGUID}}/user-accounts/garygeeke
9292
Authorization: Bearer {{callieToken}}
9393

94+
###
95+
## Gary can see his account
96+
GET {{baseURL}}/servers/{{viewServer}}/api/open-metadata/security-officer/platforms/{{omagServerPlatformGUID}}/user-accounts/garygeeke
97+
Authorization: Bearer {{garyToken}}
98+
9499
###
95100
# ========================================================================================
96-
# Setting up new user account got Freddie Mercury
101+
# Setting up new user account for Freddie Mercury
97102
#
98103
###
99104

@@ -108,7 +113,7 @@ Authorization: Bearer {{garyToken}}
108113

109114
# @name: setUserAccount
110115
# Set up or update a user account in the platform metadata security connector
111-
# The user requires operator permission for the platform unless it is their own user account they are retrieving.
116+
# The user requires operator permission for the platform.
112117
#
113118
# @param serverName name of called server
114119
# @param platformGUID unique identifier of the platform
@@ -246,4 +251,33 @@ Authorization: Bearer {{freddieToken}}
246251
Content-Type: application/json
247252

248253

254+
###
255+
# ========================================================================================
256+
# Can Callie update her own User Account? She attempts to give herself admin privileges
257+
#
258+
###
259+
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/security-officer/platforms/{{omagServerPlatformGUID}}/user-accounts
260+
Authorization: Bearer {{callieToken}}
261+
Content-Type: application/json
262+
263+
{
264+
"class": "UserAccountResponse",
265+
"requestId": "a30a2090-cf6f-4d9a-8b5c-633f88707763",
266+
"relatedHTTPCode": 200,
267+
"userAccount": {
268+
"userName": "Callie Quartile",
269+
"securityRoles": [
270+
"serverAdministrator",
271+
"dataScientist",
272+
"clinicalTrials",
273+
"openMetadataMember"
274+
],
275+
"userAccountStatus": "AVAILABLE",
276+
"secrets": {
277+
"clearPassword": "secret"
278+
},
279+
"userId": "calliequartile"
280+
}
281+
}
282+
249283

0 commit comments

Comments
 (0)