Skip to content

Date-shaped strings break cloudformation templates #438

Description

@mklenbw

When putting a string in the configuration that is shaped like a date ("2020-12-12") the yaml-parser converts this to a datetime and prints a isodate to the output ("2020-12-12T00:00:00.00Z").

This is especially bad if it is done in cloudformation templates as it can contain identifier like policy-versions. Having an isodate here will break the template.

Even putting quotest or an explicit "!!str" does not help.

The relevant OSLS path is lib/configuration/read.js → yaml.load(..., { schema: cloudformationSchema }), where that schema extends js-yaml’s date-coercing default schema.

Example:

      BucketEncryption:
        Type: AWS::KMS::Key
        Properties:
          Description: "Key for encryption of ${self:service} test bucket"
          EnableKeyRotation: true
          KeyPolicy:
            Version: "2012-10-17"
            Statement: []
          PendingWindowInDays: 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions