-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x-pack/filebeat/inputs/awss3 - Handle SQS notification without region (…
…#40628) When a region is not specified in the SQS notification then reuse the existing S3 client instead of creating a new one based on an empty (unspecified) AWS region name. This problem affected custom SQS notification formats that did not specify a region name (like Crowdstrike FDR notifications). This addresses errors like: S3 download failure: s3 GetObject failed: operation error S3: GetObject, resolve auth scheme: resolve endpoint: endpoint rule error, Invalid region: region was not a valid DNS name. Fixes: elastic/integrations/#10647 Relates: #40309
- Loading branch information
1 parent
cc561ff
commit 6d25d46
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package awss3 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/s3" | ||
) | ||
|
||
func TestAWSS3API_clientFor(t *testing.T) { | ||
// When SQS notifications do not contain a region (like Crowdstrike FDR's | ||
// custom notifications), then the default pre-made S3 client should be used. | ||
t.Run("empty_region_uses_pre_made_client", func(t *testing.T) { | ||
want := s3.New(s3.Options{Region: "us-east-1"}) | ||
api := newAWSs3API(want) | ||
got := api.clientFor("") | ||
|
||
if want != got { | ||
t.Errorf("Empty region should return the default premade client: want %p, got %p", want, got) | ||
} | ||
}) | ||
} |