From aac486d6e51e6ebd208f2e9574be4170d58feb9c Mon Sep 17 00:00:00 2001 From: chrislusf Date: Wed, 21 Oct 2026 23:05:28 -0700 Subject: [PATCH] iam: return service failure when listing inline policies fails A ListUserInlinePolicies error in GetUserPolicy fell through to action-based reconstruction, masking a store failure as a policy document. Propagate it as ServiceFailureException instead, matching the standalone iam server and the other callers in this file. --- weed/s3api/s3api_embedded_iam.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/s3api/s3api_embedded_iam.go b/weed/s3api/s3api_embedded_iam.go index 6ac6974b05..866534730c 100644 --- a/weed/s3api/s3api_embedded_iam.go +++ b/weed/s3api/s3api_embedded_iam.go @@ -1303,7 +1303,11 @@ func (e *EmbeddedIamApi) GetUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values } // The user has stored inline policies, but none by this name if storeErr == nil { - if names, err := e.credentialManager.ListUserInlinePolicies(ctx, userName); err == nil && len(names) > 0 { + policyNames, err := e.credentialManager.ListUserInlinePolicies(ctx, userName) + if err != nil { + return resp, &iamError{Code: iam.ErrCodeServiceFailureException, Error: fmt.Errorf("list inline policies for %s: %w", userName, err)} + } + if len(policyNames) > 0 { return resp, &iamError{Code: iam.ErrCodeNoSuchEntityException, Error: fmt.Errorf("the user policy with name %s cannot be found", policyName)} } }