GitHub repository set to public
This product is not supported for your selected
Datadog site. (
).
Id: 5906092d-5f74-490d-9a03-78febe0f65e1
Cloud Provider: AWS
Platform: CloudFormation
Severity: Medium
Category: Insecure Configurations
Learn More
Description
Public code repositories can expose source code, credentials, and intellectual property, increasing risk of data leakage and supply-chain compromise.
In CloudFormation, AWS::CodeStar::GitHubRepository resources must include the IsPrivate property and set it to true. Resources that omit IsPrivate or have IsPrivate set to a non-true value will be flagged.
Secure configuration example:
MyRepo:
Type: AWS::CodeStar::GitHubRepository
Properties:
RepositoryName: my-repo
IsPrivate: true
Compliant Code Examples
AWSTemplateFormatVersion: "2010-09-09"
Resources:
MyRepo1:
Type: AWS::CodeStar::GitHubRepository
Properties:
Code:
S3:
Bucket: "my-bucket"
Key: "sourcecode.zip"
ObjectVersion: "1"
EnableIssues: true
IsPrivate: true
RepositoryAccessToken: '{{resolve:secretsmanager:your-secret-manager-name:SecretString:your-secret-manager-key}}'
RepositoryDescription: a description
RepositoryName: my-github-repo
RepositoryOwner: my-github-account
{
"Resources": {
"MyRepo2": {
"Type": "AWS::CodeStar::GitHubRepository",
"Properties": {
"Code": {
"S3": {
"Bucket": "my-bucket",
"Key": "sourcecode.zip",
"ObjectVersion": "1"
}
},
"EnableIssues": true,
"IsPrivate": true,
"RepositoryAccessToken": "{{resolve:secretsmanager:your-secret-manager-name:SecretString:your-secret-manager-key}}",
"RepositoryDescription": "a description",
"RepositoryName": "my-github-repo",
"RepositoryOwner": "my-github-account"
}
}
}
}
Non-Compliant Code Examples
AWSTemplateFormatVersion: "2010-09-09"
Resources:
MyRepo4:
Type: AWS::CodeStar::GitHubRepository
Properties:
Code:
S3:
Bucket: "my-bucket"
Key: "sourcecode.zip"
ObjectVersion: "1"
EnableIssues: true
RepositoryAccessToken: '{{resolve:secretsmanager:your-secret-manager-name:SecretString:your-secret-manager-key}}'
RepositoryDescription: a description
RepositoryName: my-github-repo
RepositoryOwner: my-github-account
{
"Resources": {
"MyRepo5": {
"Type": "AWS::CodeStar::GitHubRepository",
"Properties": {
"Code": {
"S3": {
"Bucket": "my-bucket",
"Key": "sourcecode.zip",
"ObjectVersion": "1"
}
},
"EnableIssues": true,
"RepositoryAccessToken": "{{resolve:secretsmanager:your-secret-manager-name:SecretString:your-secret-manager-key}}",
"RepositoryDescription": "a description",
"RepositoryName": "my-github-repo",
"RepositoryOwner": "my-github-account"
}
}
}
}
{
"Resources": {
"MyRepo6": {
"Type": "AWS::CodeStar::GitHubRepository",
"Properties": {
"Code": {
"S3": {
"Bucket": "my-bucket",
"Key": "sourcecode.zip",
"ObjectVersion": "1"
}
},
"EnableIssues": true,
"IsPrivate": false,
"RepositoryAccessToken": "{{resolve:secretsmanager:your-secret-manager-name:SecretString:your-secret-manager-key}}",
"RepositoryDescription": "a description",
"RepositoryName": "my-github-repo",
"RepositoryOwner": "my-github-account"
}
}
}
}