From 3788c4cb32890a4fdc1196b11e3f5141646323a3 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Fri, 23 Jul 2021 17:34:38 +0300 Subject: [PATCH 01/10] bugfix for sns topic deletion upon termination --- pubsub/aws/snssqs/snssqs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 4a333a066a..c17e12fb6a 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -75,6 +75,7 @@ func NewSnsSqs(l logger.Logger) pubsub.PubSub { return &snsSqs{ logger: l, subscriptions: []*string{}, + pattern: regexp.MustCompile("[^a-zA-Z0-9_\\-]+"), } } From e0ccb33f9fee5f31019c4a07da3de666fc0cdb35 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Thu, 29 Jul 2021 21:31:24 +0300 Subject: [PATCH 02/10] removed upstream github workflow files --- .github/workflows/dapr-bot-schedule.yml | 61 ------------------------- 1 file changed, 61 deletions(-) delete mode 100644 .github/workflows/dapr-bot-schedule.yml diff --git a/.github/workflows/dapr-bot-schedule.yml b/.github/workflows/dapr-bot-schedule.yml deleted file mode 100644 index 8767dbd55b..0000000000 --- a/.github/workflows/dapr-bot-schedule.yml +++ /dev/null @@ -1,61 +0,0 @@ -# ------------------------------------------------------------ -# Copyright (c) Microsoft Corporation and Dapr Contributors. -# Licensed under the MIT License. -# ------------------------------------------------------------ - -name: dapr-schedule - -on: - schedule: - - cron: '*/10 * * * *' - workflow_dispatch: -jobs: - automerge: - if: github.repository_owner == 'dapr' - name: Automerge and update PRs. - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - name: Install dependencies - run: pip install PyGithub - - name: Automerge and update - env: - MAINTAINERS: yaron2,youngbupark,artursouza - GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }} - run: python ./.github/scripts/automerge.py - prune_stale: - name: Prune Stale - runs-on: ubuntu-latest - steps: - - name: Prune Stale - uses: actions/stale@v3.0.14 - with: - repo-token: ${{ secrets.DAPR_BOT_TOKEN }} - # Different amounts of days for issues/PRs are not currently supported but there is a PR - # open for it: https://github.com/actions/stale/issues/214 - days-before-stale: 30 - days-before-close: 7 - stale-issue-message: > - This issue has been automatically marked as stale because it has not had activity in the - last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity - occurs. Thank you for your contributions. - close-issue-message: > - This issue has been automatically closed because it has not had activity in the - last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. - Thank you for your contributions. - stale-pr-message: > - This pull request has been automatically marked as stale because it has not had - activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please - feel free to give a status update now, ping for review, or re-open when it's ready. - Thank you for your contributions! - close-pr-message: > - This pull request has been automatically closed because it has not had - activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. - Thank you for your contributions! - stale-issue-label: 'stale' - exempt-issue-labels: 'pinned,good first issue,help wanted,triaged/resolved' - stale-pr-label: 'stale' - exempt-pr-labels: 'pinned' - operations-per-run: 500 - ascending: true From 16686fb0ef686ef3765f95dd720612557ee6df40 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Thu, 18 Nov 2021 12:41:18 +0200 Subject: [PATCH 03/10] Update snssqs.go --- pubsub/aws/snssqs/snssqs.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index a5f1c33bf7..58849aaeb0 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -75,7 +75,6 @@ func NewSnsSqs(l logger.Logger) pubsub.PubSub { return &snsSqs{ logger: l, subscriptions: []*string{}, - pattern: regexp.MustCompile("[^a-zA-Z0-9_\\-]+"), } } From d7b57f86d19749baec5a40d01c9d7494ceb7327e Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Thu, 25 Nov 2021 14:29:33 +0200 Subject: [PATCH 04/10] dapr bot schedule --- .github/workflows/dapr-bot-schedule.yml | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/dapr-bot-schedule.yml diff --git a/.github/workflows/dapr-bot-schedule.yml b/.github/workflows/dapr-bot-schedule.yml new file mode 100644 index 0000000000..8767dbd55b --- /dev/null +++ b/.github/workflows/dapr-bot-schedule.yml @@ -0,0 +1,61 @@ +# ------------------------------------------------------------ +# Copyright (c) Microsoft Corporation and Dapr Contributors. +# Licensed under the MIT License. +# ------------------------------------------------------------ + +name: dapr-schedule + +on: + schedule: + - cron: '*/10 * * * *' + workflow_dispatch: +jobs: + automerge: + if: github.repository_owner == 'dapr' + name: Automerge and update PRs. + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Install dependencies + run: pip install PyGithub + - name: Automerge and update + env: + MAINTAINERS: yaron2,youngbupark,artursouza + GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }} + run: python ./.github/scripts/automerge.py + prune_stale: + name: Prune Stale + runs-on: ubuntu-latest + steps: + - name: Prune Stale + uses: actions/stale@v3.0.14 + with: + repo-token: ${{ secrets.DAPR_BOT_TOKEN }} + # Different amounts of days for issues/PRs are not currently supported but there is a PR + # open for it: https://github.com/actions/stale/issues/214 + days-before-stale: 30 + days-before-close: 7 + stale-issue-message: > + This issue has been automatically marked as stale because it has not had activity in the + last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity + occurs. Thank you for your contributions. + close-issue-message: > + This issue has been automatically closed because it has not had activity in the + last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. + Thank you for your contributions. + stale-pr-message: > + This pull request has been automatically marked as stale because it has not had + activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please + feel free to give a status update now, ping for review, or re-open when it's ready. + Thank you for your contributions! + close-pr-message: > + This pull request has been automatically closed because it has not had + activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. + Thank you for your contributions! + stale-issue-label: 'stale' + exempt-issue-labels: 'pinned,good first issue,help wanted,triaged/resolved' + stale-pr-label: 'stale' + exempt-pr-labels: 'pinned' + operations-per-run: 500 + ascending: true From e33e2b39c298cad8bd7e6e09538cdc0666ffefb1 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Thu, 25 Nov 2021 22:11:14 +0200 Subject: [PATCH 05/10] read and append queue attributes --- pubsub/aws/snssqs/snssqs.go | 104 ++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 21 deletions(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 58849aaeb0..05e056bce0 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -65,6 +65,27 @@ type snsSqsMetadata struct { messageMaxNumber int64 } +type ArnEquals struct { + AwsSourceArn string `json:"aws\:SourceArn"` +} + +type Condition struct { + ArnEquals ArnEquals +} + +type Statement struct { + Effect string + Principal string + Action string + Resource string + Condition Condition +} + +type policy struct { + Version string + Statement []Statement +} + const ( awsSqsQueueNameKey = "dapr-queue-name" awsSnsTopicNameKey = "dapr-topic-name" @@ -122,6 +143,23 @@ func nameToAWSSanitizedName(name string) string { return string(s[:j]) } +func (p *policy) statementExists(other *Statement) bool { + for _, s := range p.Statement { + if s.Effect == other.Effect && + s.Principal == other.Principal && + s.Action == other.Action && + s.Resource == other.Resource && + s.Condition.ArnEquals.AwsSourceArn == other.Condition.ArnEquals.AwsSourceArn { + return true + } + } + return false +} + +func (p *policy) addStatement(other *Statement) { + p.Statement = append(p.Statement, *other) +} + func (s *snsSqs) getSnsSqsMetatdata(metadata pubsub.Metadata) (*snsSqsMetadata, error) { md := snsSqsMetadata{} props := metadata.Properties @@ -356,7 +394,7 @@ func (s *snsSqs) Publish(req *pubsub.PublishRequest) error { }) if err != nil { - wrappedErr := fmt.Errorf("error publishing to topic: %s with topic ARN %s: %v", req.Topic, topicArn, err) + wrappedErr := fmt.Errorf("error publishing to topic: %s with topic ARN %s: %w", req.Topic, topicArn, err) s.logger.Error(wrappedErr) return wrappedErr @@ -375,12 +413,14 @@ func parseTopicArn(arn string) string { } func (s *snsSqs) acknowledgeMessage(queueURL string, receiptHandle *string) error { - _, err := s.sqsClient.DeleteMessage(&sqs.DeleteMessageInput{ + if _, err := s.sqsClient.DeleteMessage(&sqs.DeleteMessageInput{ QueueUrl: &queueURL, ReceiptHandle: receiptHandle, - }) + }); err != nil { + return fmt.Errorf("error deleting SQS message: %w", err) + } - return fmt.Errorf("error deleting SQS message: %w", err) + return nil } func (s *snsSqs) handleMessage(message *sqs.Message, queueInfo, deadLettersQueueInfo *sqsQueueInfo, handler pubsub.Handler) error { @@ -413,7 +453,7 @@ func (s *snsSqs) handleMessage(message *sqs.Message, queueInfo, deadLettersQueue "message received greater than %v times, moving this message without further processing to dead-letters queue: %v", s.metadata.messageReceiveLimit, s.metadata.sqsDeadLettersQueueName) } - // otherwise try to handle the message + // otherwise try to handle the message. var messageBody snsMessage err = json.Unmarshal([]byte(*(message.Body)), &messageBody) @@ -511,22 +551,44 @@ func (s *snsSqs) createQueueAttributesWithDeadLetters(queueInfo, deadLettersQueu func (s *snsSqs) restrictQueuePublishPolicyToOnlySNS(sqsQueueInfo *sqsQueueInfo, snsARN string) error { // only permit SNS to send messages to SQS using the created subscription. - if _, err := s.sqsClient.SetQueueAttributes(&(sqs.SetQueueAttributesInput{ + getQueueAttributesOutput, err := s.sqsClient.GetQueueAttributes(&sqs.GetQueueAttributesInput{QueueUrl: &sqsQueueInfo.url, AttributeNames: []*string{aws.String(sqs.QueueAttributeNamePolicy)}}) + if err != nil { + return fmt.Errorf("error getting queue attributes: %w", err) + } + + newStatement := &Statement{ + Effect: "Allow", + Principal: `{"Service": "sns.amazonaws.com"}`, + Action: "sqs:SendMessage", + Resource: sqsQueueInfo.arn, + Condition: Condition{ + ArnEquals: ArnEquals{ + AwsSourceArn: snsARN, + }, + }, + } + + policy := &policy{Version: "2012-11-05"} + if policyStr, ok := getQueueAttributesOutput.Attributes[sqs.QueueAttributeNamePolicy]; ok { + // look for the current statement if exists, else add it and store. + if err = json.Unmarshal([]byte(*policyStr), policy); err != nil { + return fmt.Errorf("error unmarshalling sqs policy: %w", err) + } + if policy.statementExists(newStatement) { + // nothing to do. + return nil + } + } + + policy.addStatement(newStatement) + b, uerr := json.Marshal(policy) + if uerr != nil { + return fmt.Errorf("failed serializing new sqs policy: %w", uerr) + } + + if _, err = s.sqsClient.SetQueueAttributes(&(sqs.SetQueueAttributesInput{ Attributes: map[string]*string{ - "Policy": aws.String(fmt.Sprintf(`{ - "Version": "2012-10-17", - "Statement": [{ - "Effect":"Allow", - "Principal":{"Service": "sns.amazonaws.com"}, - "Action":"sqs:SendMessage", - "Resource":"%s", - "Condition": { - "ArnEquals":{ - "aws:SourceArn":"%s" - } - } - }] - }`, sqsQueueInfo.arn, snsARN)), + "Policy": aws.String(string(b)), }, QueueUrl: &sqsQueueInfo.url, })); err != nil { @@ -594,7 +656,7 @@ func (s *snsSqs) Subscribe(req pubsub.SubscribeRequest, handler pubsub.Handler) // subscription creation is idempotent. Subscriptions are unique by topic/queue. subscribeOutput, err := s.snsClient.Subscribe(&sns.SubscribeInput{ Attributes: nil, - Endpoint: &queueInfo.arn, // create SQS queue per subscription + Endpoint: &queueInfo.arn, // create SQS queue per subscription. Protocol: aws.String("sqs"), ReturnSubscriptionArn: nil, TopicArn: &topicArn, From 754f9bfbaafd4198467254690a67b2967f4eb829 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Thu, 25 Nov 2021 22:32:58 +0200 Subject: [PATCH 06/10] unnecessary escaping in json tag --- pubsub/aws/snssqs/snssqs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 05e056bce0..6a6a819dbe 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -66,7 +66,7 @@ type snsSqsMetadata struct { } type ArnEquals struct { - AwsSourceArn string `json:"aws\:SourceArn"` + AwsSourceArn string `json:"aws:SourceArn"` } type Condition struct { From b6a96d816afa41840cc8de64133c19abe8ab7127 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Fri, 26 Nov 2021 15:02:56 +0200 Subject: [PATCH 07/10] unexporting structs --- pubsub/aws/snssqs/snssqs.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 6a6a819dbe..46cbc6dfeb 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -65,25 +65,25 @@ type snsSqsMetadata struct { messageMaxNumber int64 } -type ArnEquals struct { +type arnEquals struct { AwsSourceArn string `json:"aws:SourceArn"` } -type Condition struct { - ArnEquals ArnEquals +type condition struct { + ArnEquals arnEquals } -type Statement struct { +type statement struct { Effect string Principal string Action string Resource string - Condition Condition + Condition condition } type policy struct { Version string - Statement []Statement + Statement []statement } const ( @@ -143,7 +143,7 @@ func nameToAWSSanitizedName(name string) string { return string(s[:j]) } -func (p *policy) statementExists(other *Statement) bool { +func (p *policy) statementExists(other *statement) bool { for _, s := range p.Statement { if s.Effect == other.Effect && s.Principal == other.Principal && @@ -156,7 +156,7 @@ func (p *policy) statementExists(other *Statement) bool { return false } -func (p *policy) addStatement(other *Statement) { +func (p *policy) addStatement(other *statement) { p.Statement = append(p.Statement, *other) } @@ -556,13 +556,13 @@ func (s *snsSqs) restrictQueuePublishPolicyToOnlySNS(sqsQueueInfo *sqsQueueInfo, return fmt.Errorf("error getting queue attributes: %w", err) } - newStatement := &Statement{ + newStatement := &statement{ Effect: "Allow", Principal: `{"Service": "sns.amazonaws.com"}`, Action: "sqs:SendMessage", Resource: sqsQueueInfo.arn, - Condition: Condition{ - ArnEquals: ArnEquals{ + Condition: condition{ + ArnEquals: arnEquals{ AwsSourceArn: snsARN, }, }, From f46840efff9875e0572f59b5995dd28fe72aff2e Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Wed, 8 Dec 2021 12:16:19 +0200 Subject: [PATCH 08/10] bugfix in policy --- pubsub/aws/snssqs/policy.go | 44 +++++++++++++++++++++++++++++++++++++ pubsub/aws/snssqs/snssqs.go | 42 ++--------------------------------- 2 files changed, 46 insertions(+), 40 deletions(-) create mode 100644 pubsub/aws/snssqs/policy.go diff --git a/pubsub/aws/snssqs/policy.go b/pubsub/aws/snssqs/policy.go new file mode 100644 index 0000000000..b667deae79 --- /dev/null +++ b/pubsub/aws/snssqs/policy.go @@ -0,0 +1,44 @@ +package snssqs + +type arnEquals struct { + AwsSourceArn string `json:"aws:SourceArn"` +} + +type condition struct { + ArnEquals arnEquals +} + +type principal struct { + Service string +} + +type statement struct { + Effect string + Principal principal + Action string + Resource string + Condition condition +} + +type policy struct { + Version string + Statement []statement +} + +func (p *policy) statementExists(other *statement) bool { + for _, s := range p.Statement { + if s.Effect == other.Effect && + s.Principal.Service == other.Principal.Service && + s.Action == other.Action && + s.Resource == other.Resource && + s.Condition.ArnEquals.AwsSourceArn == other.Condition.ArnEquals.AwsSourceArn { + return true + } + } + + return false +} + +func (p *policy) addStatement(other *statement) { + p.Statement = append(p.Statement, *other) +} diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 46cbc6dfeb..e9a6f9f90a 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -65,27 +65,6 @@ type snsSqsMetadata struct { messageMaxNumber int64 } -type arnEquals struct { - AwsSourceArn string `json:"aws:SourceArn"` -} - -type condition struct { - ArnEquals arnEquals -} - -type statement struct { - Effect string - Principal string - Action string - Resource string - Condition condition -} - -type policy struct { - Version string - Statement []statement -} - const ( awsSqsQueueNameKey = "dapr-queue-name" awsSnsTopicNameKey = "dapr-topic-name" @@ -143,23 +122,6 @@ func nameToAWSSanitizedName(name string) string { return string(s[:j]) } -func (p *policy) statementExists(other *statement) bool { - for _, s := range p.Statement { - if s.Effect == other.Effect && - s.Principal == other.Principal && - s.Action == other.Action && - s.Resource == other.Resource && - s.Condition.ArnEquals.AwsSourceArn == other.Condition.ArnEquals.AwsSourceArn { - return true - } - } - return false -} - -func (p *policy) addStatement(other *statement) { - p.Statement = append(p.Statement, *other) -} - func (s *snsSqs) getSnsSqsMetatdata(metadata pubsub.Metadata) (*snsSqsMetadata, error) { md := snsSqsMetadata{} props := metadata.Properties @@ -558,7 +520,7 @@ func (s *snsSqs) restrictQueuePublishPolicyToOnlySNS(sqsQueueInfo *sqsQueueInfo, newStatement := &statement{ Effect: "Allow", - Principal: `{"Service": "sns.amazonaws.com"}`, + Principal: principal{Service: "sns.amazonaws.com"}, Action: "sqs:SendMessage", Resource: sqsQueueInfo.arn, Condition: condition{ @@ -568,7 +530,7 @@ func (s *snsSqs) restrictQueuePublishPolicyToOnlySNS(sqsQueueInfo *sqsQueueInfo, }, } - policy := &policy{Version: "2012-11-05"} + policy := &policy{Version: "2012-10-17"} if policyStr, ok := getQueueAttributesOutput.Attributes[sqs.QueueAttributeNamePolicy]; ok { // look for the current statement if exists, else add it and store. if err = json.Unmarshal([]byte(*policyStr), policy); err != nil { From d1c1d9e2b85d036d4b23621f8ba3533482871c87 Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Wed, 8 Dec 2021 12:24:48 +0200 Subject: [PATCH 09/10] bugfix in policy. merged from master --- pubsub/aws/snssqs/snssqs.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 3713a09e15..8f7fd752be 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -163,23 +163,6 @@ func nameToAWSSanitizedName(name string, isFifo bool) string { return string(s[:j]) } -func (p *policy) statementExists(other *statement) bool { - for _, s := range p.Statement { - if s.Effect == other.Effect && - s.Principal == other.Principal && - s.Action == other.Action && - s.Resource == other.Resource && - s.Condition.ArnEquals.AwsSourceArn == other.Condition.ArnEquals.AwsSourceArn { - return true - } - } - return false -} - -func (p *policy) addStatement(other *statement) { - p.Statement = append(p.Statement, *other) -} - func (s *snsSqs) getSnsSqsMetatdata(metadata pubsub.Metadata) (*snsSqsMetadata, error) { md := snsSqsMetadata{} props := metadata.Properties From afd6dfb52d1f03da0f98ef7c5c553b2d6d8d84be Mon Sep 17 00:00:00 2001 From: Amit Mor Date: Wed, 8 Dec 2021 12:26:41 +0200 Subject: [PATCH 10/10] fifo suffix as const --- pubsub/aws/snssqs/snssqs.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pubsub/aws/snssqs/snssqs.go b/pubsub/aws/snssqs/snssqs.go index 8f7fd752be..23a31409c7 100644 --- a/pubsub/aws/snssqs/snssqs.go +++ b/pubsub/aws/snssqs/snssqs.go @@ -77,6 +77,7 @@ type snsSqsMetadata struct { const ( awsSqsQueueNameKey = "dapr-queue-name" awsSnsTopicNameKey = "dapr-topic-name" + awsSqsFifoSuffix = ".fifo" maxAWSNameLength = 80 ) @@ -125,13 +126,11 @@ func parseBool(input string, propertyName string) (bool, error) { // sanitize topic/queue name to conform with: // https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-queues.html func nameToAWSSanitizedName(name string, isFifo bool) string { - suffix := ".fifo" - // first remove suffix if exists, and user requested a FIFO name, then sanitize the passed in name. hasFifoSuffix := false - if strings.HasSuffix(name, suffix) && isFifo { + if strings.HasSuffix(name, awsSqsFifoSuffix) && isFifo { hasFifoSuffix = true - name = name[:len(name)-len(suffix)] + name = name[:len(name)-len(awsSqsFifoSuffix)] } s := []byte(name) @@ -153,11 +152,11 @@ func nameToAWSSanitizedName(name string, isFifo bool) string { // reattach/add the suffix to the sanitized name, trim more if adding the suffix would exceed the maxLength. if hasFifoSuffix || isFifo { - delta := j + len(suffix) - maxAWSNameLength + delta := j + len(awsSqsFifoSuffix) - maxAWSNameLength if delta > 0 { j -= delta } - return string(s[:j]) + suffix + return string(s[:j]) + awsSqsFifoSuffix } return string(s[:j])