Skip to content
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 @@ -515,14 +515,6 @@ void checkCanRevokeRoles(SecurityContext context,
*/
void checkCanSetCatalogRole(SecurityContext context, String role, String catalogName);

/**
* Check if identity is allowed to show role authorization descriptors (i.e. RoleGrants).
*
* @param catalogName if present, the role catalog; otherwise the role is a system role
* @throws AccessDeniedException if not allowed
*/
void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName);

/**
* Check if identity is allowed to show roles on the specified catalog.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,22 +1137,6 @@ public void checkCanSetCatalogRole(SecurityContext securityContext, String role,
catalogAuthorizationCheck(catalogName, securityContext, (control, context) -> control.checkCanSetRole(context, role));
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext securityContext, Optional<String> catalogName)
{
requireNonNull(securityContext, "securityContext is null");
requireNonNull(catalogName, "catalogName is null");

if (catalogName.isPresent()) {
checkCanAccessCatalog(securityContext, catalogName.get());
checkCatalogRoles(securityContext, catalogName.get());
catalogAuthorizationCheck(catalogName.get(), securityContext, ConnectorAccessControl::checkCanShowRoleAuthorizationDescriptors);
}
else {
systemAuthorizationCheck(control -> control.checkCanShowRoleAuthorizationDescriptors(securityContext.toSystemSecurityContext()));
}
}

@Override
public void checkCanShowRoles(SecurityContext securityContext, Optional<String> catalogName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,6 @@ public void checkCanSetCatalogRole(SecurityContext context, String role, String
{
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName)
{
}

@Override
public void checkCanShowRoles(SecurityContext context, Optional<String> catalogName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
import static io.trino.spi.security.AccessDeniedException.denyShowCreateSchema;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateTable;
import static io.trino.spi.security.AccessDeniedException.denyShowCurrentRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleAuthorizationDescriptors;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleGrants;
import static io.trino.spi.security.AccessDeniedException.denyShowRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowSchemas;
Expand Down Expand Up @@ -490,12 +489,6 @@ public void checkCanSetCatalogRole(SecurityContext context, String role, String
denySetRole(role);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName)
{
denyShowRoleAuthorizationDescriptors();
}

@Override
public void checkCanShowRoles(SecurityContext context, Optional<String> catalogName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,6 @@ public void checkCanSetCatalogRole(SecurityContext context, String role, String
delegate().checkCanSetCatalogRole(context, role, catalogName);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName)
{
delegate().checkCanShowRoleAuthorizationDescriptors(context, catalogName);
}

@Override
public void checkCanShowRoles(SecurityContext context, Optional<String> catalogName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
accessControl.checkCanSetCatalogRole(securityContext, role, catalogName);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
checkArgument(context == null, "context must be null");
accessControl.checkCanShowRoleAuthorizationDescriptors(securityContext, Optional.of(catalogName));
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ public void checkCanRevokeRoles(SecurityContext context, Set<String> roles, Set<
@Override
public void checkCanSetCatalogRole(SecurityContext context, String role, String catalogName) {}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName) {}

@Override
public void checkCanShowRoles(SecurityContext context, Optional<String> catalogName) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,6 @@ public void checkCanSetCatalogRole(SecurityContext context, String role, String
}
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SecurityContext context, Optional<String> catalogName)
{
Span span = startSpan("checkCanShowRoleAuthorizationDescriptors");
try (var ignored = scopedSpan(span)) {
delegate.checkCanShowRoleAuthorizationDescriptors(context, catalogName);
}
}

@Override
public void checkCanShowRoles(SecurityContext context, Optional<String> catalogName)
{
Expand Down
10 changes: 10 additions & 0 deletions core/trino-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@
</old>
</item>
<!-- Backwards incompatible changes since the previous release -->
<item>
<ignore>true</ignore>
<code>java.method.removed</code>
<old>method void io.trino.spi.connector.ConnectorAccessControl::checkCanShowRoleAuthorizationDescriptors(io.trino.spi.connector.ConnectorSecurityContext)</old>
</item>
<item>
<ignore>true</ignore>
<code>java.method.removed</code>
<old>method void io.trino.spi.security.SystemAccessControl::checkCanShowRoleAuthorizationDescriptors(io.trino.spi.security.SystemSecurityContext)</old>
</item>
<!-- Any exclusions below can be deleted after each release -->
</differences>
</revapi.differences>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
import static io.trino.spi.security.AccessDeniedException.denyShowCreateSchema;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateTable;
import static io.trino.spi.security.AccessDeniedException.denyShowCurrentRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleAuthorizationDescriptors;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleGrants;
import static io.trino.spi.security.AccessDeniedException.denyShowRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowSchemas;
Expand Down Expand Up @@ -586,16 +585,6 @@ default void checkCanSetRole(ConnectorSecurityContext context, String role)
denySetRole(role);
}

/**
* Check if identity is allowed to show role authorization descriptors (i.e. RoleGrants).
*
* @throws io.trino.spi.security.AccessDeniedException if not allowed
*/
default void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
denyShowRoleAuthorizationDescriptors();
}

/**
* Check if identity is allowed to show roles.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
import static io.trino.spi.security.AccessDeniedException.denyShowCreateSchema;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateTable;
import static io.trino.spi.security.AccessDeniedException.denyShowCurrentRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleAuthorizationDescriptors;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleGrants;
import static io.trino.spi.security.AccessDeniedException.denyShowRoles;
import static io.trino.spi.security.AccessDeniedException.denyShowSchemas;
Expand Down Expand Up @@ -814,16 +813,6 @@ default void checkCanRevokeRoles(SystemSecurityContext context, Set<String> role
denyRevokeRoles(roles, grantees);
}

/**
* Check if identity is allowed to show role authorization descriptors (i.e. RoleGrants).
*
* @throws AccessDeniedException if not allowed
*/
default void checkCanShowRoleAuthorizationDescriptors(SystemSecurityContext context)
{
denyShowRoleAuthorizationDescriptors();
}

/**
* Check if identity is allowed to show current roles.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
}
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
delegate.checkCanShowRoleAuthorizationDescriptors(context);
}
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
{
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,6 @@ public void checkCanRevokeRoles(
{
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SystemSecurityContext context)
{
}

@Override
public void checkCanShowCurrentRoles(SystemSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
denySetRole(role);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
// allow, no roles are supported so show will always be empty
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
import static io.trino.spi.security.AccessDeniedException.denyShowColumns;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateSchema;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateTable;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleAuthorizationDescriptors;
import static io.trino.spi.security.AccessDeniedException.denyShowSchemas;
import static io.trino.spi.security.AccessDeniedException.denyShowTables;
import static io.trino.spi.security.AccessDeniedException.denyTruncateTable;
Expand Down Expand Up @@ -910,12 +909,6 @@ public void checkCanRevokeRoles(SystemSecurityContext context,
denyRevokeRoles(roles, grantees);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SystemSecurityContext context)
{
denyShowRoleAuthorizationDescriptors();
}

@Override
public void checkCanShowCurrentRoles(SystemSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
delegate().checkCanSetRole(context, role);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
delegate().checkCanShowRoleAuthorizationDescriptors(context);
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,6 @@ public void checkCanRevokeRoles(SystemSecurityContext context, Set<String> roles
delegate().checkCanRevokeRoles(context, roles, grantees, adminOption, grantor);
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SystemSecurityContext context)
{
delegate().checkCanShowRoleAuthorizationDescriptors(context);
}

@Override
public void checkCanShowCurrentRoles(SystemSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,6 @@ public void checkCanRevokeTablePrivilege(ConnectorSecurityContext context, Privi
denyRevokeTablePrivilege(privilege.name(), tableName.toString());
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
// allow
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ public void checkCanShowRoles(SystemSecurityContext context)
{
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(SystemSecurityContext context)
{
}

@Override
public void checkCanShowCurrentRoles(SystemSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public void testEmptyFile()
assertDenied(() -> accessControl.checkCanSetRole(ADMIN, "role"));

// showing roles and permissions is hard coded to allow
accessControl.checkCanShowRoleAuthorizationDescriptors(UNKNOWN);
accessControl.checkCanShowRoles(UNKNOWN);
accessControl.checkCanShowCurrentRoles(UNKNOWN);
accessControl.checkCanShowRoleGrants(UNKNOWN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
{
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
import static io.trino.spi.security.AccessDeniedException.denyShowColumns;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateSchema;
import static io.trino.spi.security.AccessDeniedException.denyShowCreateTable;
import static io.trino.spi.security.AccessDeniedException.denyShowRoleAuthorizationDescriptors;
import static io.trino.spi.security.AccessDeniedException.denyShowRoles;
import static io.trino.spi.security.AccessDeniedException.denyTruncateTable;
import static io.trino.spi.security.AccessDeniedException.denyUpdateTableColumns;
Expand Down Expand Up @@ -570,14 +569,6 @@ public void checkCanSetRole(ConnectorSecurityContext context, String role)
}
}

@Override
public void checkCanShowRoleAuthorizationDescriptors(ConnectorSecurityContext context)
{
if (!isAdmin(context)) {
denyShowRoleAuthorizationDescriptors();
}
}

@Override
public void checkCanShowRoles(ConnectorSecurityContext context)
{
Expand Down