Fix code scanning alerts (#6551)

* Escape period in URL regex

* Fix capital letter range

* Fix unintentional range and duplicate period in regex

* Formatting
This commit is contained in:
Brian Pandola 2023-07-22 03:55:57 -07:00 committed by GitHub
parent 77a09b71b7
commit d05eae7fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -110,9 +110,12 @@ backend_url_patterns = [
),
(
"meteringmarketplace",
re.compile("https?://metering.marketplace.(.+).amazonaws.com"),
re.compile("https?://metering.marketplace\\.(.+)\\.amazonaws.com"),
),
(
"meteringmarketplace",
re.compile("https?://aws-marketplace\\.(.+)\\.amazonaws.com"),
),
("meteringmarketplace", re.compile("https?://aws-marketplace.(.+).amazonaws.com")),
("mq", re.compile("https?://mq\\.(.+)\\.amazonaws\\.com")),
("opsworks", re.compile("https?://opsworks\\.us-east-1\\.amazonaws.com")),
("organizations", re.compile("https?://organizations\\.(.+)\\.amazonaws\\.com")),

View File

@ -39,7 +39,7 @@ SCHEMA_VERSION_ID_PATTERN = re.compile(
r"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
)
MIN_SCHEMA_VERSION_ID_LENGTH = 36
SCHEMA_VERSION_METADATA_PATTERN = re.compile(r"^[a-zA-Z0-9+-=._./@]+$")
SCHEMA_VERSION_METADATA_PATTERN = re.compile(r"^[a-zA-Z0-9+=._/@-]+$")
MAX_SCHEMA_VERSION_METADATA_ALLOWED = 10
MAX_SCHEMA_VERSION_METADATA_LENGTH = 128
METADATA_KEY = "MetadataKey"

View File

@ -1981,7 +1981,7 @@ class SimpleSystemManagerBackend(BaseBackend):
label.startswith("aws")
or label.startswith("ssm")
or label[:1].isdigit()
or not re.match(r"^[a-zA-z0-9_\.\-]*$", label)
or not re.match(r"^[a-zA-Z0-9_\.\-]*$", label)
):
invalid_labels.append(label)
continue