-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from fingerprintjs/feature/rollout-as-code-re…
…based CloudFront integration v2
- Loading branch information
Showing
48 changed files
with
3,523 additions
and
1,591 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Rules to check CloudFormation template | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- cloudformation/* | ||
|
||
jobs: | ||
validate: | ||
name: Validate template | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install cfn-guard | ||
run: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/aws-cloudformation/cloudformation-guard/main/install-guard.sh | sh | ||
|
||
- name: Validate | ||
run: ~/.guard/bin/cfn-guard validate --rules cloudformation/rules.guard --data cloudformation/template.yml | ||
|
||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
20 |
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 was deleted.
Oops, something went wrong.
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,101 @@ | ||
let SecretName = "FingerprintIntegrationSettings" | ||
let DistributionId = "ABCDEF123456" | ||
let FpjsBehaviorPath = "fpjs" | ||
let FpjsGetResultPath = "result" | ||
let FpjsAgentDownloadPath = "agent" | ||
let FpjsPreSharedSecret = "secret-string-123" | ||
|
||
rule check_conditions { | ||
Conditions.CreateCloudFrontDistribution exists | ||
Conditions.CreateCloudFrontDistribution is_struct | ||
|
||
Conditions.AttachDomainToCloudFront exists | ||
Conditions.AttachDomainToCloudFront is_struct | ||
} | ||
|
||
rule check_secret { | ||
Resources.FingerprintIntegrationSettingsSecret { | ||
Type == "AWS::SecretsManager::Secret" | ||
Properties { | ||
SecretString !empty | ||
} | ||
} | ||
} | ||
|
||
rule check_lambda { | ||
Resources.FingerprintProCloudFrontLambda { | ||
Type == "AWS::Serverless::Function" | ||
Properties { | ||
Handler == "fingerprintjs-pro-cloudfront-lambda-function.handler" | ||
Runtime == "nodejs20.x" | ||
CodeUri == "s3://fingerprint-pro-cloudfront-integration-lambda-function/releaseV2/lambda_latest.zip" | ||
Timeout == 10 | ||
} | ||
} | ||
} | ||
|
||
rule check_lambda_role { | ||
Resources.FpIntLambdaFunctionExecutionRole { | ||
Properties { | ||
AssumeRolePolicyDocument { | ||
some Statement[*].Principal.Service == "lambda.amazonaws.com" | ||
some Statement[*].Principal.Service == "edgelambda.amazonaws.com" | ||
} | ||
} | ||
} | ||
} | ||
|
||
rule check_lambda_version { | ||
Resources.FingerprintProCloudFrontLambdaVersion { | ||
Type == "AWS::Lambda::Version" | ||
} | ||
} | ||
|
||
rule check_mgmt_lambda { | ||
Resources.FingerprintProMgmtLambda { | ||
Type == "AWS::Serverless::Function" | ||
Properties { | ||
Handler == "fingerprintjs-pro-cloudfront-mgmt-lambda-function.handler" | ||
Runtime == "nodejs20.x" | ||
CodeUri == "s3://fingerprint-pro-cloudfront-integration-lambda-function/releaseV2/mgmt_lambda_latest.zip" | ||
Timeout == 120 | ||
} | ||
} | ||
} | ||
|
||
rule check_mgmt_lambda_role { | ||
Resources.FpMgmtLambdaFunctionExecutionRole { | ||
Properties { | ||
AssumeRolePolicyDocument { | ||
some Statement[*].Principal.Service == "lambda.amazonaws.com" | ||
} | ||
} | ||
} | ||
} | ||
|
||
rule check_cache_policy { | ||
Resources.FingerprintProCDNCachePolicy { | ||
Type == "AWS::CloudFront::CachePolicy" | ||
Properties { | ||
CachePolicyConfig.MinTTL == 0 | ||
CachePolicyConfig.MaxTTL == 180 | ||
CachePolicyConfig.DefaultTTL == 180 | ||
} | ||
} | ||
} | ||
|
||
rule check_cloudfront_distribution { | ||
Resources.CloudFrontDistribution { | ||
Type == "AWS::CloudFront::Distribution" | ||
Condition exists | ||
} | ||
} | ||
|
||
rule check_output { | ||
Outputs { | ||
LambdaFunctionName exists | ||
CachePolicyName exists | ||
CloudFrontDistributionId exists | ||
IsCloudFrontDistributionCreatedByDeployment exists | ||
} | ||
} |
Oops, something went wrong.