Skip to content

panic in s3/endpoint_auth_resolver.go #3234

@davidflanagan

Description

@davidflanagan

Acknowledgements

Describe the bug

I'm seeing a panic on line 22 of service/s3/endpoint_auth_resolver.go (using v1.90.2)

A recent change in bindEndpointParams() in s3/endpoints.go makes it so that if options.Region is invalid (like if it has an underscore) then bindEndpointParams() returns an error.

The problem is that it returns this error before binding the endpoint params. So in endpoint_auth_resolver.go, we end up with params.endpointParams being nil and then we try to dereference that nil and panic.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

It should not have panicked

Current Behavior

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x16df984]

goroutine 682 [running]:
github.com/aws/aws-sdk-go-v2/service/s3.(*endpointAuthResolver).ResolveAuthSchemes(0x400570eac0?, {0x48ad3b8?, 0x400578bbf0?}, 0x0?)
github.com/aws/aws-sdk-go-v2/service/[email protected]/endpoint_auth_resolver.go:22 +0x24
github.com/aws/aws-sdk-go-v2/service/s3.(*resolveAuthSchemeMiddleware).HandleFinalize(0x4005147888, {0x48ad3b8, 0x400578bbf0}, {{0x3f1a420?, 0x400578bb30?}}, {0x4859ee0, 0x400570f0c0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/auth.go:190 +0x158
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/aws-sdk-go-v2/aws/retry.MetricsHeader.HandleFinalize({}, {0x48ad3b8, 0x400578bbf0}, {{0x3f1a420?, 0x400578bb30?}}, {0x4859ee0, 0x400570f0e0})
github.com/aws/[email protected]/aws/retry/middleware.go:359 +0x3b0
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/smithy-go/transport/http.(*InterceptAttempt).HandleFinalize(0x400578b620, {0x48ad3b8, 0x400578bbf0}, {{0x3f1a420?, 0x400578bb30?}}, {0x4859ee0, 0x400570f100})
github.com/aws/[email protected]/transport/http/interceptor_middleware.go:316 +0x108
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/aws-sdk-go-v2/aws/retry.(*Attempt).handleAttempt(0x400578b530, {0x48ad3b8, 0x400578bbf0}, {{0x3f1a420?, 0x400578bb30?}}, 0x41b8908, {0x4859ee0, 0x400570f120})
github.com/aws/[email protected]/aws/retry/middleware.go:208 +0x310
github.com/aws/aws-sdk-go-v2/aws/retry.(*Attempt).HandleFinalize(0x400578b530, {0x48ad3b8, 0x400578bad0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859ee0, 0x400570f120})
github.com/aws/[email protected]/aws/retry/middleware.go:121 +0x3bc
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/smithy-go/transport/http.(*InterceptBeforeRetryLoop).HandleFinalize(0x40054d95d8?, {0x48ad3b8, 0x400578bad0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859ee0, 0x400570f140})
github.com/aws/[email protected]/transport/http/interceptor_middleware.go:131 +0xfc
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/aws-sdk-go-v2/service/s3.(*spanRetryLoop).HandleFinalize(0x40054d96b8?, {0x48ad3b8, 0x400578bad0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859ee0, 0x400570f160})
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:712 +0xec
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding.(*DisableGzip).HandleFinalize(0x40054d9778?, {0x48ad3b8, 0x400578bad0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859ee0, 0x400570f180})
github.com/aws/aws-sdk-go-v2/service/internal/[email protected]/accept_encoding_gzip.go:67 +0x11c
github.com/aws/smithy-go/middleware.decoratedFinalizeHandler.HandleFinalize(...)
github.com/aws/[email protected]/middleware/step_finalize.go:201
github.com/aws/smithy-go/middleware.(*FinalizeStep).HandleMiddleware(0x40054d98c8?, {0x48ad3b8, 0x400578bad0}, {0x3f1a420, 0x400578b8c0}, {0x4852e40, 0x400570ec00})
github.com/aws/[email protected]/middleware/step_finalize.go:115 +0x228
github.com/aws/smithy-go/middleware.decoratedHandler.Handle(...)
github.com/aws/[email protected]/middleware/middleware.go:57
github.com/aws/smithy-go/middleware.buildWrapHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:184
github.com/aws/aws-sdk-go-v2/aws/middleware.(*RecursionDetection).HandleBuild(0x40054d99e8?, {0x48ad3b8, 0x400578bad0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859f40, 0x4001754ba0})
github.com/aws/[email protected]/aws/middleware/recursion_detection.go:46 +0x1e4
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/aws-sdk-go-v2/internal/middleware.AddTimeOffsetMiddleware.HandleBuild({0x3ff1eba?}, {0x48ad3b8?, 0x400578b9b0?}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859f60?, 0x400570ef00?})
github.com/aws/[email protected]/internal/middleware/middleware.go:30 +0xa8
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/aws-sdk-go-v2/aws/middleware.(*RequestUserAgent).HandleBuild(0x40054d9b78?, {0x48ad3b8, 0x400578b9b0}, {{0x3f1a420, 0x400578b8c0}}, {0x4859f60, 0x400570ef20})
github.com/aws/[email protected]/aws/middleware/user_agent.go:343 +0x8c
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/aws-sdk-go-v2/service/s3.setCredentialSourceMiddleware.HandleBuild({0x400758ce58, {{0x400570eac0, 0x4, 0x4}, {0x0, 0x0}, 0x4000d38340, 0x0, 0x0, {0x4852aa0, ...}, ...}}, ...)
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:935 +0x124
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/aws-sdk-go-v2/service/internal/checksum.(*ResponseChecksumMetricsTracking).HandleBuild(0x40054da3e8?, {0x48ad3b8, 0x400578b9b0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859f60, 0x400570ef60})
github.com/aws/aws-sdk-go-v2/service/internal/[email protected]/middleware_checksum_metrics_tracking.go:89 +0x10c
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/smithy-go/transport/http.(*ComputeContentLength).HandleBuild(0xa24c8eeeb5ea6701?, {0x48ad3b8, 0x400578b9b0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859f60, 0x400570ef80})
github.com/aws/[email protected]/transport/http/middleware_content_length.go:49 +0x10c
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/aws-sdk-go-v2/aws/middleware.ClientRequestID.HandleBuild({}, {0x48ad3b8, 0x400578b9b0}, {{0x3f1a420?, 0x400578b8c0?}}, {0x4859f60, 0x400570efa0})
github.com/aws/[email protected]/aws/middleware/middleware.go:42 +0x19c
github.com/aws/smithy-go/middleware.decoratedBuildHandler.HandleBuild(...)
github.com/aws/[email protected]/middleware/step_build.go:200
github.com/aws/smithy-go/middleware.(*BuildStep).HandleMiddleware(0x2004d2738?, {0x48ad3b8, 0x400578b9b0}, {0x3f1a420, 0x400578b8c0}, {0x4852e40, 0x400570ec20})
github.com/aws/[email protected]/middleware/step_build.go:114 +0x228
github.com/aws/smithy-go/middleware.decoratedHandler.Handle(...)
github.com/aws/[email protected]/middleware/middleware.go:57
github.com/aws/smithy-go/middleware.serializeWrapHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:192
github.com/aws/aws-sdk-go-v2/service/s3.(*isExpressUserAgent).HandleSerialize(0x4006770198, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e40, 0x4001754b50})
github.com/aws/aws-sdk-go-v2/service/[email protected]/express_user_agent.go:33 +0xd8
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.(*removeBucketFromPathMiddleware).HandleSerialize(0x40054d2908?, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570eda0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/internal/customizations/remove_bucket_middleware.go:26 +0x1a8
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.(*updateEndpoint).HandleSerialize(0x400758ce88, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570edc0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/internal/customizations/update_endpoint.go:145 +0x3f0
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3.(*awsRestxml_serializeOpGetObject).HandleSerialize(0x1?, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ede0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/serializers.go:4128 +0x688
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3.(*serializeImmutableHostnameBucketMiddleware).HandleSerialize(0x400570062d, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ee00})
github.com/aws/aws-sdk-go-v2/service/[email protected]/serialize_immutable_hostname_bucket.go:53 +0x2ec
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.(*s3ObjectLambdaEndpoint).HandleSerialize(0x40055082a0, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ee20})
github.com/aws/aws-sdk-go-v2/service/[email protected]/internal/customizations/s3_object_lambda.go:34 +0x52c
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.(*processARNResource).HandleSerialize(0x4005508240, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ee40})
github.com/aws/aws-sdk-go-v2/service/[email protected]/internal/customizations/process_arn_resource.go:54 +0xdc4
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3.(*ResolveEndpoint).HandleSerialize(0x4006fc9db0, {0x48ad3b8, 0x400578b9b0}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ee60})
github.com/aws/aws-sdk-go-v2/service/[email protected]/endpoints.go:89 +0x59c
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3.(*setOperationInputMiddleware).HandleSerialize(0x3422260?, {0x48ad3b8?, 0x400578b950?}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570ee80})
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:374 +0x9c
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/aws-sdk-go-v2/service/s3.(*putBucketContextMiddleware).HandleSerialize(0x1?, {0x48ad3b8, 0x400578b890}, {{0x35af400?, 0x4000247d40?}, {0x3f1a420?, 0x400578b8c0?}}, {0x4859e60, 0x400570eea0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/bucket_context.go:26 +0xbc
github.com/aws/smithy-go/middleware.decoratedSerializeHandler.HandleSerialize(...)
github.com/aws/[email protected]/middleware/step_serialize.go:208
github.com/aws/smithy-go/middleware.(*SerializeStep).HandleMiddleware(0x4001754a90, {0x48ad3b8, 0x400578b890}, {0x35af400, 0x4000247d40}, {0x4852e40, 0x400570ec40})
github.com/aws/[email protected]/middleware/step_serialize.go:122 +0x25c
github.com/aws/smithy-go/middleware.decoratedHandler.Handle(...)
github.com/aws/[email protected]/middleware/middleware.go:57
github.com/aws/smithy-go/middleware.initializeWrapHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:184
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws.otelMiddlewares.initializeMiddlewareAfter.func1({0x48ad3b8, 0x400578b830}, {{0x35af400?, 0x4000247d40?}}, {0x4859e80, 0x4001754b10})
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/[email protected]/aws.go:72 +0x69c
github.com/aws/smithy-go/middleware.initializeMiddlewareFunc.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:67
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/aws-sdk-go-v2/service/s3.(*validateOpGetObject).HandleInitialize(0x40054d4028?, {0x48ad3b8, 0x400578b830}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0, 0x400570eca0})
github.com/aws/aws-sdk-go-v2/service/[email protected]/validators.go:1050 +0xb8
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/smithy-go/middleware.(*setLogger).HandleInitialize(0x4006770188?, {0x48ad3b8?, 0x400578b800?}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0, 0x400570ecc0})
github.com/aws/[email protected]/middleware/logging.go:45 +0x88
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/aws-sdk-go-v2/service/internal/s3shared.(*ARNLookup).HandleInitialize(0x40054d4218?, {0x48ad3b8, 0x400578b800}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0, 0x400570ece0})
github.com/aws/aws-sdk-go-v2/service/internal/[email protected]/arn_lookup.go:39 +0x19c
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/aws-sdk-go-v2/service/s3.(*legacyEndpointContextSetter).HandleInitialize(0x40054d42c8?, {0x48ad3b8?, 0x400578b800?}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0?, 0x400570ed00?})
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:437 +0x9c
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/aws-sdk-go-v2/aws/middleware.RegisterServiceMetadata.HandleInitialize({{0x3fe17be, 0x2}, {0x0, 0x0}, {0x40014b10c0, 0xe}, {0x3fef158, 0x9}}, {0x48ad3b8?, 0x400578b6e0?}, ...)
github.com/aws/[email protected]/aws/middleware/metadata.go:41 +0x1c0
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/aws-sdk-go-v2/service/internal/checksum.(*setupOutputContext).HandleInitialize(0x400758ce70, {0x48ad3b8, 0x400578b680}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0, 0x400570ed40})
github.com/aws/aws-sdk-go-v2/service/internal/[email protected]/middleware_setup_context.go:100 +0x134
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws.otelMiddlewares.initializeMiddlewareBefore.func1({0x48ad3b8, 0x400578b650}, {{0x35af400?, 0x4000247d40?}}, {0x4859ea0, 0x400570ed60})
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/[email protected]/aws.go:44 +0xa8
github.com/aws/smithy-go/middleware.initializeMiddlewareFunc.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:67
github.com/aws/smithy-go/middleware.decoratedInitializeHandler.HandleInitialize(...)
github.com/aws/[email protected]/middleware/step_initialize.go:200
github.com/aws/smithy-go/middleware.(*InitializeStep).HandleMiddleware(0x48ad2b8?, {0x48ad3b8, 0x400578b650}, {0x35af400, 0x4000247d40}, {0x4852e40, 0x400570ec60})
github.com/aws/[email protected]/middleware/step_initialize.go:114 +0x228
github.com/aws/smithy-go/middleware.decoratedHandler.Handle(...)
github.com/aws/[email protected]/middleware/middleware.go:57
github.com/aws/smithy-go/middleware.(*Stack).HandleMiddleware(0x40054d4828?, {0x48ad3b8, 0x400578b650}, {0x35af400, 0x4000247d40}, {0x4852de0?, 0x400570ebc0?})
github.com/aws/[email protected]/middleware/stack.go:109 +0x110
github.com/aws/smithy-go/middleware.decoratedHandler.Handle(...)
github.com/aws/[email protected]/middleware/middleware.go:57
github.com/aws/aws-sdk-go-v2/service/s3.(*Client).invokeOperation(0x4005146708, {0x48ad3b8?, 0x400578b2c0?}, {0x3fef158, 0x9}, {0x35af400, 0x4000247d40}, {0x0, 0x0, 0x4005129490?}, ...)
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:324 +0x838
github.com/aws/aws-sdk-go-v2/service/s3.(*Client).GetObject(0x7d5d2bf558ca?, {0x48ad3b8?, 0x400578b2c0?}, 0x691fc386?, {0x0?, 0xc698c?, 0x4005129528?})
github.com/aws/aws-sdk-go-v2/service/[email protected]/api_op_GetObject.go:176 +0xb8

Reproduction Steps

sorry

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

s3: 1.90.2

Compiler and Version used

go version go1.25.4 darwin/arm64

Operating System and version

darwin

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p1This is a high priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions