Merge pull request #1475 from versity/sis/bucket-logging-actions-not-implemented

feat: adds not implemented routes for bucket logging actions
This commit is contained in:
Ben McClelland
2025-08-20 17:10:32 -07:00
committed by GitHub
5 changed files with 83 additions and 0 deletions

View File

@@ -70,6 +70,8 @@ const (
GetInventoryConfigurationAction Action = "s3:GetInventoryConfiguration"
PutLifecycleConfigurationAction Action = "s3:PutLifecycleConfiguration"
GetLifecycleConfigurationAction Action = "s3:GetLifecycleConfiguration"
PutBucketLoggingAction Action = "s3:PutBucketLogging"
GetBucketLoggingAction Action = "s3:GetBucketLogging"
AllActions Action = "s3:*"
)

View File

@@ -94,6 +94,8 @@ var (
ActionPutBucketLifecycleConfiguration = "s3_PutBucketLifecycleConfiguration"
ActionGetBucketLifecycleConfiguration = "s3_GetBucketLifecycleConfiguration"
ActionDeleteBucketLifecycle = "s3_DeleteBucketLifecycle"
ActionPutBucketLogging = "s3_PutBucketLogging"
ActionGetBucketLogging = "s3_GetBucketLogging"
// Admin actions
ActionAdminCreateUser = "admin_CreateUser"

View File

@@ -272,6 +272,20 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend, iam auth.IAMServ
middlewares.ParseAcl(be),
),
)
bucketRouter.Put("",
middlewares.MatchQueryArgs("logging"),
controllers.ProcessHandlers(
ctrl.HandleErrorRoute(s3err.GetAPIError(s3err.ErrNotImplemented)),
metrics.ActionPutBucketLogging,
services,
middlewares.BucketObjectNameValidator(),
middlewares.AuthorizePublicBucketAccess(be, metrics.ActionPutBucketLogging, auth.PutBucketLoggingAction, auth.PermissionWrite),
middlewares.VerifyPresignedV4Signature(root, iam, region, debug),
middlewares.VerifyV4Signature(root, iam, region, debug),
middlewares.VerifyMD5Body(),
middlewares.ParseAcl(be),
),
)
bucketRouter.Put("",
controllers.ProcessHandlers(
ctrl.CreateBucket,
@@ -681,6 +695,20 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend, iam auth.IAMServ
middlewares.ParseAcl(be),
),
)
bucketRouter.Get("",
middlewares.MatchQueryArgs("logging"),
controllers.ProcessHandlers(
ctrl.HandleErrorRoute(s3err.GetAPIError(s3err.ErrNotImplemented)),
metrics.ActionGetBucketLogging,
services,
middlewares.BucketObjectNameValidator(),
middlewares.AuthorizePublicBucketAccess(be, metrics.ActionGetBucketLogging, auth.GetBucketLoggingAction, auth.PermissionRead),
middlewares.VerifyPresignedV4Signature(root, iam, region, debug),
middlewares.VerifyV4Signature(root, iam, region, debug),
middlewares.VerifyMD5Body(),
middlewares.ParseAcl(be),
),
)
bucketRouter.Get("",
middlewares.MatchQueryArgWithValue("list-type", "2"),
controllers.ProcessHandlers(

View File

@@ -645,6 +645,9 @@ func TestNotImplementedActions(s *S3Conf) {
PutBucketLifecycleConfiguration_not_implemented(s)
GetBucketLifecycleConfiguration_not_implemented(s)
DeleteBucketLifecycle_not_implemented(s)
// bucket logging actions
PutBucketLogging_not_implemented(s)
GetBucketLogging_not_implemented(s)
}
func TestWORMProtection(s *S3Conf) {
@@ -1397,6 +1400,8 @@ func GetIntTests() IntTests {
"PutBucketLifecycleConfiguration_not_implemented": PutBucketLifecycleConfiguration_not_implemented,
"GetBucketLifecycleConfiguration_not_implemented": GetBucketLifecycleConfiguration_not_implemented,
"DeleteBucketLifecycle_not_implemented": DeleteBucketLifecycle_not_implemented,
"PutBucketLogging_not_implemented": PutBucketLogging_not_implemented,
"GetBucketLogging_not_implemented": GetBucketLogging_not_implemented,
"WORMProtection_bucket_object_lock_configuration_compliance_mode": WORMProtection_bucket_object_lock_configuration_compliance_mode,
"WORMProtection_bucket_object_lock_configuration_governance_mode": WORMProtection_bucket_object_lock_configuration_governance_mode,
"WORMProtection_bucket_object_lock_governance_bypass_delete": WORMProtection_bucket_object_lock_governance_bypass_delete,

View File

@@ -15712,6 +15712,52 @@ func DeleteBucketLifecycle_not_implemented(s *S3Conf) error {
})
}
func PutBucketLogging_not_implemented(s *S3Conf) error {
testName := "PutBucketLogging_not_implemented"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
_, err := s3client.PutBucketLogging(ctx,
&s3.PutBucketLoggingInput{
Bucket: &bucket,
BucketLoggingStatus: &types.BucketLoggingStatus{
LoggingEnabled: &types.LoggingEnabled{
TargetBucket: &bucket,
TargetGrants: []types.TargetGrant{
{
Grantee: &types.Grantee{
Type: types.TypeCanonicalUser,
ID: getPtr("grt1"),
},
Permission: types.BucketLogsPermissionRead,
},
},
TargetObjectKeyFormat: &types.TargetObjectKeyFormat{
SimplePrefix: &types.SimplePrefix{},
},
TargetPrefix: getPtr("prefix"),
},
},
})
cancel()
return checkApiErr(err, s3err.GetAPIError(s3err.ErrNotImplemented))
})
}
func GetBucketLogging_not_implemented(s *S3Conf) error {
testName := "GetBucketLogging_not_implemented"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
_, err := s3client.GetBucketLogging(ctx,
&s3.GetBucketLoggingInput{
Bucket: &bucket,
})
cancel()
return checkApiErr(err, s3err.GetAPIError(s3err.ErrNotImplemented))
})
}
func WORMProtection_bucket_object_lock_configuration_compliance_mode(s *S3Conf) error {
testName := "WORMProtection_bucket_object_lock_configuration_compliance_mode"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {