fix(s3): keep anonymous access working with EnableIam default (fixes #9557) (#9567)

fix(s3): keep anonymous access working with EnableIam default

`docker run seaweedfs` (and `weed mini` with no config) start with
EnableIam=true but no IAM config file and no identities. The advanced-IAM
init path was failing in 4.25 because of the missing STS signing key,
which masked a latent bug: SetIAMIntegration unconditionally flipped
isAuthEnabled to true, and isEnabled() also treated a non-nil
iamIntegration as auth-on. Once the mini SSE-S3 KEK landed in 4.26 the
STS fallback started succeeding, the integration got installed end to
end, and every anonymous S3 request bounced as AccessDenied.

Separate the two concerns: SetIAMIntegration just plumbs in the OIDC /
embedded-IAM machinery, and a new EnableAuthEnforcement opts in to
enforcement. The startup path calls it only when -s3.iam.config is
actually provided, so operators with explicit IAM configs still get auth
(preserves #7726). isEnabled() now reads isAuthEnabled only.
This commit is contained in:
Chris Lu authored and GitHub committed 2026-05-19 13:03:30 -07:00
1 parent 4476cb282b
commit d57de6dc20
4 files changed
+78 -16

No files matched your search

+9 -1
View File
@@ -317,8 +317,16 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl
// Set IAM integration in server
s3ApiServer.iamIntegration = s3iam
// Set the integration in the traditional IAM for compatibility
// Set the integration in the traditional IAM for compatibility.
// SetIAMIntegration no longer auto-enables auth — see the function comment.
// Only force isAuthEnabled when the operator actually pointed us at an
// IAM config file. Without one, EnableIam is the implicit mini default
// and we must keep the "no credentials = allow all" startup behavior so
// `docker run seaweedfs` works out of the box (fixes #9557).
iam.SetIAMIntegration(s3iam)
if option.IamConfig != "" {
iam.EnableAuthEnforcement()
}
// Initialize STS HTTP handlers for AssumeRoleWithWebIdentity endpoint
if stsService := iamManager.GetSTSService(); stsService != nil {