Skip to content
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

IT Security Tests for model access control #1095

Merged
merged 3 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void validateRequestForAccessControl(MLUpdateModelGroupInput input, User
&& !modelAccessControlHelper.isAdmin(user)
&& !modelAccessControlHelper.isOwnerStillHasPermission(user, mlModelGroup)) {
throw new IllegalArgumentException(
"You don’t have the specified backend role to update access control data. For more information, contact your administrator."
"You don’t have the specified backend role to update this model group. For more information, contact your administrator."
);
}
AccessMode accessMode = input.getModelAccessMode();
Expand Down Expand Up @@ -258,7 +258,9 @@ private boolean hasAccessControlChange(MLUpdateModelGroupInput input) {
}

private void validateSecurityDisabledOrModelAccessControlDisabled(MLUpdateModelGroupInput input) {
if (input.getModelAccessMode() != null || input.getIsAddAllBackendRoles() != null || input.getBackendRoles() != null) {
if (input.getModelAccessMode() != null
|| input.getIsAddAllBackendRoles() != null
|| !CollectionUtils.isEmpty(input.getBackendRoles())) {
throw new IllegalArgumentException(
"You cannot specify model access control parameters because the Security plugin or model access control is disabled on your cluster."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void test_OwnerNoMoreHasPermissionException() {
ArgumentCaptor<Exception> argumentCaptor = ArgumentCaptor.forClass(Exception.class);
verify(actionListener).onFailure(argumentCaptor.capture());
assertEquals(
"You don’t have the specified backend role to update access control data. For more information, contact your administrator.",
"You don’t have the specified backend role to update this model group. For more information, contact your administrator.",
argumentCaptor.getValue().getMessage()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,14 @@ public MLRegisterModelInput createRegisterModelInput(String modelGroupID) {
}

public MLRegisterModelGroupInput createRegisterModelGroupInput(
String name,
List<String> backendRoles,
AccessMode modelAccessMode,
Boolean isAddAllBackendRoles
) {
return MLRegisterModelGroupInput
.builder()
.name("modelGroupName")
.name(name)
.description("This is a test model group")
.backendRoles(backendRoles)
.modelAccessMode(modelAccessMode)
Expand Down
Loading
Loading