Skip to content

Statement IDs (SID) must be alpha-numeric #708

@felipe1982

Description

@felipe1982

cfn-lint version: cfn-lint 0.15.0

When creating a AWS::IAM::ManagedPolicy and using the Sid statement, cfn-lint is not detecting an invalidly-formed Sid statement

Please provide as much information as possible:

  • Template linting issues:
    • Please provide a CloudFormation sample that generated the issue.
  ManagedPolicyCodeSuiteKmsKey:
    Type: AWS::IAM::ManagedPolicy
    Condition: CreateCodePipelineRole
    Properties:
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Sid: Allow use of KMS key in Operations Production Account
            Effect: Allow
            Resource: !Sub 'arn:aws:kms::123123123123:key/*'
            Action:
              - "kms:Encrypt"
              - "kms:Decrypt"
              - "kms:ReEncrypt*"
              - "kms:GenerateDataKey*"
              - "kms:DescribeKey"

sid_string

Provides a way to include information about an individual statement. For IAM policies, basic alphanumeric characters (A-Z,a-z,0-9) are the only allowed characters in the Sid value. Other AWS services that support resource policies may have other requirements for the Sid value. For example, some services require this value to be unique within an AWS account, and some services allow additional characters such as spaces in the Sid value.

  • Validate if the issue still exists with the latest version of cfn-lint and/or the latest Spec files
    I do not know how to install latest version, I just ran pip install

  • Feature request:

    • My CloudFormation template fails to Create or Update because the Sid uses invalid characters, and cfn-lint does not detect that.

**NOTE: I have executed cfn-lint -u and it downloaded updates, but the problem remains.


Below is the output from CloudFormation:

The following resource(s) failed to update: [ManagedPolicyCodeSuiteKmsKey].
--
  | 11:20:11 UTC+1000 | UPDATE_FAILED | AWS::IAM::ManagedPolicy | ManagedPolicyCodeSuiteKmsKey | Statement IDs (SID) must be alpha-numeric. Check that your input satisfies the regular expression [0-9A-Za-z]* (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: a632726a-42d2-11e9-8725-21992a944eb3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    new ruleNew rulep0High Priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions