From 765babd0cce3c9a133c4bd9083ae8d057f213e04 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Wed, 13 Sep 2023 15:24:39 -0400 Subject: [PATCH] Fix endpoint matcher host label validation --- gems/aws-sdk-core/CHANGELOG.md | 2 ++ .../lib/aws-sdk-core/endpoints/matchers.rb | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index eaaaef73bc4..e4f4de54b7c 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Issue - Fix host label validation in endpoint matchers. + 3.181.0 (2023-08-22) ------------------ diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/endpoints/matchers.rb b/gems/aws-sdk-core/lib/aws-sdk-core/endpoints/matchers.rb index 5c6bf2c04d7..9ae20e18d59 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/endpoints/matchers.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/endpoints/matchers.rb @@ -79,11 +79,11 @@ def self.valid_host_label?(value, allow_sub_domains = false) return false if value.empty? if allow_sub_domains - labels = value.split('.') + labels = value.split('.', -1) return labels.all? { |l| valid_host_label?(l) } end - value =~ /\A(?!-)[a-zA-Z0-9-]{1,63}(?