Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS::S3::Bucket.BucketName AllowedPattern #1208

Merged
merged 4 commits into from
Nov 26, 2019
Merged

AWS::S3::Bucket.BucketName AllowedPattern #1208

merged 4 commits into from
Nov 26, 2019

Conversation

PatMyron
Copy link
Contributor

@PatMyron PatMyron commented Nov 19, 2019

https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules

Increasing coverage of allowed BucketName rules:

✅ Bucket names must be at least 3 and no more than 63 characters long.

✅ Bucket names must not contain uppercase characters or underscores.

✅ Bucket names must start with a lowercase letter or number.

❌ Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.). Bucket names can contain lowercase letters, numbers, and hyphens. Each label must start and end with a lowercase letter or a number.

❌ Bucket names must not be formatted as an IP address (for example, 192.168.5.4).

❌ When you use virtual hosted–style buckets with Secure Sockets Layer (SSL), the SSL wildcard certificate only matches buckets that don't contain periods. To work around this, use HTTP or write your own certificate verification logic. We recommend that you do not use periods (".") in bucket names when using virtual hosted–style buckets.

https://regex101.com/r/6N7QXB/3


Could use this as a DisallowedPatternRegex if that's ever supported:

https://github.com/aws-cloudformation/cfn-python-lint/blob/71b6848fe0137f3492bb615284ac7541bfeb1596/src/cfnlint/helpers.py#L66-L67

Last rule should probably only be a warning anyways

@PatMyron PatMyron requested a review from kddejong November 19, 2019 23:41
@codecov

This comment has been minimized.

Copy link
Contributor

@kddejong kddejong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add

{
    "op": "add",
    "path": "/ResourceTypes/AWS::S3::Bucket/Properties/BucketName/Value",
    "value": {
      "ValueType": "AWS::S3::Bucket.BucketName"
    }
  }

to src/cfnlint/data/ExtendedSpecs/all/04_property_values/aws_s3.json

Then run cfn-lint --update-specs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants