Skip to content

Commit a9b5c63

Browse files
authored
feat(authz): Add support for additional RBAC configruation via YAML configuration (#3285)
* feat(authz): Add support for additional RBAC permissions via YAML configuration * feat: allowed operations
1 parent 3f50be4 commit a9b5c63

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

api/v1/server/authz/middleware.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func NewAuthZ(config *server.ServerConfig) (*AuthZ, error) {
2424
if err != nil {
2525
return nil, err
2626
}
27+
2728
return &AuthZ{
2829
config: config,
2930
l: config.Logger,
@@ -163,6 +164,10 @@ func (a *AuthZ) ensureVerifiedEmail(c echo.Context, r *middleware.RouteInfo) err
163164
}
164165

165166
func (a *AuthZ) authorizeTenantOperations(tenantMemberRole sqlcv1.TenantMemberRole, r *middleware.RouteInfo) error {
167+
// if the operation is in the allowed operations, skip the RBAC check this is needed for extensions
168+
if rbac.OperationIn(r.OperationID, a.config.Auth.AllowedOperations) {
169+
return nil
170+
}
166171

167172
// at the moment, tenant members are only restricted from creating other tenant users.
168173
if !a.rbac.IsAuthorized(tenantMemberRole, r.OperationID) {

pkg/config/server/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ type AuthConfig struct {
561561
JWTManager token.JWTManager
562562

563563
CustomAuthenticator CustomAuthenticator
564+
565+
// Operations listed here bypass the tenant RBAC check. Use this for
566+
// extension operations (e.g. cloud) that handle their own authorization
567+
// in handlers. OSS operations in rbac.yaml are still fully checked.
568+
AllowedOperations []string
564569
}
565570

566571
type PylonConfig struct {

0 commit comments

Comments
 (0)