Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update role expiration validator checks (#12185)

boojack009e362055ae
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index c4de2ee1e0..15eb3429e0 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -2076,8 +2076,9 @@ func (*ProjectService) validateBindings(bindings []*v1pb.Binding, roles []*v1pb.
return err
}
+ // Only validate when maximumRoleExpiration is set and the role is ProjectQuerier or ProjectExporter.
rolesToValidate := []string{fmt.Sprintf("roles/%s", api.ProjectQuerier), fmt.Sprintf("roles/%s", api.ProjectExporter)}
- if binding.Condition != nil && binding.Condition.Expression != "" && slices.Contains(rolesToValidate, binding.Role) {
+ if maximumRoleExpiration != nil && binding.Condition != nil && binding.Condition.Expression != "" && slices.Contains(rolesToValidate, binding.Role) {
if err := validateIAMPolicyExpression(binding.Condition.Expression, maximumRoleExpiration); err != nil {
return err
}