-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better NoEcho validation and Fn::Sub fixes (#3068)
- Loading branch information
Showing
19 changed files
with
498 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"allOf": [ | ||
{ | ||
"type": [ | ||
"object", | ||
"array" | ||
] | ||
}, | ||
{ | ||
"additionalProperties": true, | ||
"properties": { | ||
"AWS::CloudFormation::Init": { | ||
"properties": { | ||
"config": { | ||
"properties": { | ||
"commands": { | ||
"awsType": "CfnInitCommands" | ||
}, | ||
"files": { | ||
"awsType": "CfnInitFiles" | ||
}, | ||
"groups": { | ||
"awsType": "CfnInitGroups" | ||
}, | ||
"packages": { | ||
"awsType": "CfnInitPackages" | ||
}, | ||
"services": { | ||
"awsType": "CfnInitServices" | ||
}, | ||
"sources": { | ||
"awsType": "CfnInitSources" | ||
}, | ||
"users": { | ||
"awsType": "CfnInitUsers" | ||
} | ||
}, | ||
"type": "object" | ||
} | ||
}, | ||
"type": "object" | ||
} | ||
}, | ||
"type": "object" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: MIT-0 | ||
""" | ||
|
||
from typing import Any | ||
|
||
from cfnlint.jsonschema import ValidationError, Validator | ||
from cfnlint.rules import CloudFormationLintRule | ||
|
||
|
||
class DynamicReferenceSecret(CloudFormationLintRule): | ||
""" | ||
Check if Dynamic Reference Secure Strings are | ||
only used in the correct locations | ||
""" | ||
|
||
id = "W1011" | ||
shortdesc = "Instead of REFing a parameter for a secret use a dynamic reference" | ||
description = ( | ||
"Instead of REFing a parameter for a secret use a dynamic reference. " | ||
"Solutions like SSM parameter store and secrets manager provide " | ||
"better security of sercrets" | ||
) | ||
source_url = "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/security-best-practices.html#creds" | ||
tags = ["functions", "dynamic reference", "ref"] | ||
|
||
def validate(self, validator: Validator, _, instance: Any, schema: Any): | ||
value = instance.get("Ref") | ||
|
||
if not validator.is_type(value, "string"): | ||
return | ||
|
||
if value in validator.context.parameters: | ||
yield ValidationError( | ||
"Use dynamic references over parameters for secrets", rule=self | ||
) |
Oops, something went wrong.