404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.144.128.235: ~ $
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from cfnlint.rules import CloudFormationLintRule, RuleMatch


class PropertiesTemplated(CloudFormationLintRule):
    """Check Base Resource Configuration"""

    id = "W3002"
    shortdesc = (
        "Warn when properties are configured to only work with the package command"
    )
    description = (
        "Some properties can be configured to only work with the CloudFormation"
        "package command. Warn when this is the case so user is aware."
    )
    source_url = (
        "https://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html"
    )
    tags = ["resources"]

    templated_exceptions = {
        "AWS::ApiGateway::RestApi": ["BodyS3Location"],
        "AWS::Lambda::Function": ["Code"],
        "AWS::Lambda::LayerVersion": ["Content"],
        "AWS::ElasticBeanstalk::ApplicationVersion": ["SourceBundle"],
        "AWS::StepFunctions::StateMachine": ["DefinitionS3Location"],
        "AWS::AppSync::GraphQLSchema": ["DefinitionS3Location"],
        "AWS::AppSync::Resolver": [
            "RequestMappingTemplateS3Location",
            "ResponseMappingTemplateS3Location",
        ],
        "AWS::AppSync::FunctionConfiguration": [
            "RequestMappingTemplateS3Location",
            "ResponseMappingTemplateS3Location",
        ],
        "AWS::CloudFormation::Stack": ["TemplateURL"],
        "AWS::CodeCommit::Repository": ["S3"],
    }

    def __init__(self):
        """Init"""
        super().__init__()
        self.resource_property_types.extend(self.templated_exceptions.keys())

    def check_value(self, value, path):
        """Check the value"""
        matches = []
        if isinstance(value, str):
            if not value.startswith("s3://") and not value.startswith("https://"):
                message = f'This code may only work with `package` cli command as the property ({"/".join(map(str, path))}) is a string'
                matches.append(RuleMatch(path, message))

        return matches

    def match_resource_properties(self, properties, resourcetype, path, cfn):
        """Check CloudFormation Properties"""
        matches = []

        for key in self.templated_exceptions.get(resourcetype, []):
            matches.extend(
                cfn.check_value(
                    obj=properties, key=key, path=path[:], check_value=self.check_value
                )
            )

        return matches

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
AllowedPattern.py File 5.76 KB 0644
AllowedValue.py File 4.8 KB 0644
AtLeastOne.py File 4.11 KB 0644
AvailabilityZone.py File 3.41 KB 0644
BasedOnValue.py File 6.33 KB 0644
Exclusive.py File 3.98 KB 0644
ImageId.py File 2.37 KB 0644
Inclusive.py File 3.7 KB 0644
JsonSize.py File 6.08 KB 0644
ListDuplicates.py File 4.39 KB 0644
ListDuplicatesAllowed.py File 4.76 KB 0644
ListSize.py File 4.88 KB 0644
NumberSize.py File 4.88 KB 0644
OnlyOne.py File 3.89 KB 0644
Password.py File 3.63 KB 0644
Properties.py File 27.49 KB 0644
PropertiesTemplated.py File 2.44 KB 0644
Required.py File 4.1 KB 0644
RequiredBasedOnValue.py File 831 B 0644
StringSize.py File 4.52 KB 0644
UnwantedBasedOnValue.py File 837 B 0644
ValuePrimitiveType.py File 11.6 KB 0644
ValueRefGetAtt.py File 11.96 KB 0644
__init__.py File 106 B 0644