Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore(iam): explicit skips & must find (#9935)
p0ny9167db90677e
diff --git a/backend/api/auth/config.go b/backend/api/auth/config.goindex 4dc28de0c6..43f1880457 100644--- a/backend/api/auth/config.go+++ b/backend/api/auth/config.go@@ -1,16 +1,20 @@package auth-import "strings"+import (+ "strings"++ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"+)var authenticationAllowlistMethods = map[string]bool{- "/bytebase.v1.ActuatorService/GetActuatorInfo": true,- "/bytebase.v1.ActuatorService/DeleteCache": true,- "/bytebase.v1.SubscriptionService/GetSubscription": true,- "/bytebase.v1.SubscriptionService/GetFeatureMatrix": true,- "/bytebase.v1.AuthService/Login": true,- "/bytebase.v1.AuthService/Logout": true,- "/bytebase.v1.AuthService/CreateUser": true,- "/bytebase.v1.IdentityProviderService/ListIdentityProviders": true,+ v1pb.ActuatorService_GetActuatorInfo_FullMethodName: true,+ v1pb.ActuatorService_DeleteCache_FullMethodName: true,+ v1pb.SubscriptionService_GetSubscription_FullMethodName: true,+ v1pb.SubscriptionService_GetFeatureMatrix_FullMethodName: true,+ v1pb.AuthService_Login_FullMethodName: true,+ v1pb.AuthService_Logout_FullMethodName: true,+ v1pb.AuthService_CreateUser_FullMethodName: true,+ v1pb.IdentityProviderService_ListIdentityProviders_FullMethodName: true,}// IsAuthenticationAllowed returns whether the method is exempted from authentication.diff --git a/backend/api/v1/acl_iam.go b/backend/api/v1/acl_iam.goindex 9de3bd2a55..85a830266e 100644--- a/backend/api/v1/acl_iam.go+++ b/backend/api/v1/acl_iam.go@@ -21,7 +21,7 @@ func (in *ACLInterceptor) checkIAMPermission(ctx context.Context, fullMethod strp, ok := methodPermissionMap[fullMethod]if !ok {- return nil+ return errors.Errorf("method %q not found in method-permission map", fullMethod)}var projectIDsGetter func(context.Context, any) ([]string, error)@@ -206,16 +206,40 @@ func isSkippedMethod(fullMethod string) bool {// Below are the skipped.switch fullMethod {- // TODO(p0ny): explicit skips- // skip actuator service- // skip anomaly service- // skip auth service- // skip cel service- // skip inbox service- // skip logging service- // skip sql service- // skip subscription service-+ // skip methods that are not considered to be resource-related.+ case+ v1pb.ActuatorService_GetActuatorInfo_FullMethodName,+ v1pb.ActuatorService_UpdateActuatorInfo_FullMethodName,+ v1pb.ActuatorService_DeleteCache_FullMethodName,+ v1pb.ActuatorService_ListDebugLog_FullMethodName,+ v1pb.AnomalyService_SearchAnomalies_FullMethodName,+ v1pb.AuthService_GetUser_FullMethodName,+ v1pb.AuthService_ListUsers_FullMethodName,+ v1pb.AuthService_CreateUser_FullMethodName,+ v1pb.AuthService_UpdateUser_FullMethodName,+ v1pb.AuthService_DeleteUser_FullMethodName,+ v1pb.AuthService_UndeleteUser_FullMethodName,+ v1pb.AuthService_Login_FullMethodName,+ v1pb.AuthService_Logout_FullMethodName,+ v1pb.CelService_BatchParse_FullMethodName,+ v1pb.CelService_BatchDeparse_FullMethodName,+ v1pb.InboxService_GetInboxSummary_FullMethodName,+ v1pb.InboxService_ListInbox_FullMethodName,+ v1pb.InboxService_UpdateInbox_FullMethodName,+ v1pb.LoggingService_ListLogs_FullMethodName,+ v1pb.LoggingService_GetLog_FullMethodName,+ v1pb.LoggingService_ExportLogs_FullMethodName,+ v1pb.SQLService_Query_FullMethodName,+ v1pb.SQLService_Export_FullMethodName,+ v1pb.SQLService_AdminExecute_FullMethodName,+ v1pb.SQLService_DifferPreview_FullMethodName,+ v1pb.SQLService_Check_FullMethodName,+ v1pb.SQLService_Pretty_FullMethodName,+ v1pb.SQLService_StringifyMetadata_FullMethodName,+ v1pb.SubscriptionService_GetSubscription_FullMethodName,+ v1pb.SubscriptionService_GetFeatureMatrix_FullMethodName,+ v1pb.SubscriptionService_UpdateSubscription_FullMethodName:+ return true// skip checking for custom approval.casev1pb.IssueService_ApproveIssue_FullMethodName,