Skip to content

Add gitleaks Action configuration #4

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

Merged
merged 1 commit into from
Apr 25, 2025
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
19 changes: 19 additions & 0 deletions .github/workflows/secret-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Secret Scan

on:
pull_request:
push:
jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Gitleaks to scan for secrets
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to use the GITHUB_TOKEN here, as a GitHub action can inject one for us to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to use the GITHUB_TOKEN here, as a GitHub action can inject one for us to use.

As gitleaks README.md mentioned, this environment variable is automatically injected when the Action is executed, and no additional configuration is required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

GITLEAKS_CONFIG: .gitleaks.toml
67 changes: 67 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[extend]
useDefault = true

[[rules]]
id = "aklt-key-pattern"
description = "AKLT key pattern"
regex = '''AKLT\w{40,70}'''

[[rules]]
id = "akap-key-pattern"
description = "AKAP key pattern"
regex = '''AKAP\w{40,70}'''

[[rules]]
id = "akip-key-pattern"
description = "AKIP key pattern"
regex = '''AKI\w{40,70}'''

[[rules]]
id = "token-transformer-id-pattern"
description = "Tokenizer/Transformer/Token ID patterns"
regex = '''(tokenizer|transformer|token_id|tokenid|attention_head).{0,20}'''

[[rules]]
id = "aws-style-key-pattern"
description = "AWS-style key pattern"
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''

[[rules]]
id = "alibaba-ltai-pattern"
description = "Alibaba LTAI key pattern"
regex = '''(LTAI)[a-z0-9]{20}'''

[[rules]]
id = "aktp-key-pattern"
description = "AKTP key pattern"
regex = '''AKTP\w{40,70}'''

[[rules]]
id = "app-id-pattern"
description = "App ID patterns"
regex = '''([^*<\s|:>]{0,7})(app_id|appid)([^]()!<>;/@&,]{0,10}[(=:]\s{0,6}["']{0,1}[0-9]{6,32}["']{0,1})'''

[[rules]]
id = "byted-org-domains"
description = "byted.org domains"
regex = '''.{0,15}\.?byted.org.{0,20}'''

[[rules]]
id = "bytedance-net-domains"
description = "bytedance.net domains"
regex = '''.{0,15}\.?bytedance.net.{0,20}'''

[[rules]]
id = "feishu-cn-domains"
description = "bytedance.feishu.cn domains"
regex = '''.{0,20}.bytedance\.feishu\.cn.{0,50}'''

[[rules]]
id = "larkoffice-com-domains"
description = "bytedance.larkoffice.com domains"
regex = '''.{0,20}.bytedance\.larkoffice\.com.{0,50}'''

[[rules]]
id = "private-ip-10-range"
description = "Private IP address pattern (10.x.x.x)"
regex = '''(10\.\d{1,3}\.\d{1,3}\.\d{1,3})'''