Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secrets checks #8209

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"build": "turbo run build",
"changeset": "changeset",
"check-secrets": "sh ./scripts/check_secrets.sh",
"check-secrets": "sh ./scripts/check-secrets.sh",
"clean:modules": "rm -rf node_modules && rm -rf protocol-dashboard/node_modules && rm -rf packages/*/node_modules",
"clean:dist": "rm -rf packages/*/dist",
"install-git-secrets": "sh ./scripts/install-git-secrets.sh",
Expand Down
File renamed without changes.
131 changes: 119 additions & 12 deletions scripts/install-git-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,124 @@ fi

git config --remove-section secrets

git secrets --add --allowed 'dev-tools/config.json'
git secrets --add --allowed 'scripts/install-git-secrets.sh'
git secrets --add --allowed 'package.json'

git secrets --register-aws
# these are the match rules to add. by default the aws rules only match AWS access id's and keys
# add any additional match strings here
# rds urls
git secrets --add '.*[a-z0-9]*.rds.amazonaws.com:[0-9]*\/.*'
git secrets --add --allowed 'packages/ddex/.*/README.md:.*'

# match any postgres db with an IP hostname
# Postgres
git secrets --add 'postgres:\/\/.*\:.*@([0-9]*\.?)*:[0-9]{4}\/.*'
git secrets --add --allowed 'postgres:postgres@1\.2\.3\.4:[0-9]{4}\/.*'

# Cloudinary
git secrets --add "cloudinary://.*"

# Firebase URL
git secrets --add ".*firebaseio\.com"

# Slack Token
git secrets --add "(xox[p|b|o|a]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"

# RSA private key
git secrets --add "\-\-\-\-\-BEGIN RSA PRIVATE KEY\-\-\-\-\-"

# SSH (DSA) private key
git secrets --add "\-\-\-\-\-BEGIN DSA PRIVATE KEY\-\-\-\-\-"

# SSH (EC) private key
git secrets --add "\-\-\-\-\-BEGIN EC PRIVATE KEY\-\-\-\-\-"

# PGP private key block
git secrets --add "\-\-\-\-\-BEGIN PGP PRIVATE KEY BLOCK\-\-\-\-\-"

# Amazon AWS
git secrets --add '.*[a-z0-9]*.rds.amazonaws.com:[0-9]*\/.*'
git secrets --add '(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'

# Amazon MWS Auth Token
git secrets --add "amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"

# AWS API Key
git secrets --add "AKIA[0-9A-Z]{16}"

# Facebook Access Token
git secrets --add "EAACEdEose0cBA[0-9A-Za-z]+"

# Facebook OAuth
git secrets --add "[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|\"][0-9a-f]{32}['|\"]"

# GitHub
git secrets --add "[g|G][i|I][t|T][h|H][u|U][b|B].*['|\"][0-9a-zA-Z]{35,40}['|\"]"

# Generic API Key
git secrets --add "[a|A][p|P][i|I][_]?[k|K][e|E][y|Y].*['|\"][0-9a-zA-Z]{32,45}['|\"]"

# Generic Secret
git secrets --add "[s|S][e|E][c|C][r|R][e|E][t|T].*['|\"][0-9a-zA-Z]{32,45}['|\"]"

# Google API Key
git secrets --add "AIza[0-9A-Za-z\\-_]{35}"

# Google Cloud Platform API Key
git secrets --add "AIza[0-9A-Za-z\\-_]{35}"

# Google Cloud Platform OAuth
git secrets --add "[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"

# Google Drive API Key
git secrets --add "AIza[0-9A-Za-z\\-_]{35}"

# Google Drive OAuth
git secrets --add "[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"

# Google (GCP) Service-account
git secrets --add "\"type\": \"service_account\""

# Google Gmail API Key
git secrets --add "AIza[0-9A-Za-z\\-_]{35}"

# Google Gmail OAuth
git secrets --add "[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"

# Google OAuth Access Token
git secrets --add "ya29\\.[0-9A-Za-z\\-_]+"

# Google YouTube API Key
git secrets --add "AIza[0-9A-Za-z\\-_]{35}"

# Google YouTube OAuth
git secrets --add "[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"

# Heroku API Key
git secrets --add "[h|H][e|E][r|R][o|O][k|K][u|U].*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}"

# MailChimp API Key
git secrets --add "[0-9a-f]{32}-us[0-9]{1,2}"

# Mailgun API Key
git secrets --add "key-[0-9a-zA-Z]{32}"

# Password in URL
git secrets --add "[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}[\"'\\s]"

# Picatic API Key
git secrets --add "sk_live_[0-9a-z]{32}"

# Slack Webhook
git secrets --add "https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}"

# Stripe API Key
git secrets --add "sk_live_[0-9a-zA-Z]{24}"

# Stripe Restricted API Key
git secrets --add "rk_live_[0-9a-zA-Z]{24}"

# Square Access Token
git secrets --add "sq0atp-[0-9A-Za-z\\-_]{22}"

# Square OAuth Secret
git secrets --add "sq0csp-[0-9A-Za-z\\-_]{43}"

# Twilio API Key
git secrets --add "SK[0-9a-fA-F]{32}"

# Twitter Access Token
git secrets --add "[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*[1-9][0-9]+-[0-9a-zA-Z]{40}"

# Twitter OAuth
git secrets --add "[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*['|\"][0-9a-zA-Z]{35,44}['|\"]"