Skip to content

Commit a402a94

Browse files
authored
Merge pull request #13 from wgpsec/copilot/add-sensitive-info-check
Add automated secret scanning for AK/SK/passwords
2 parents f3ceeb0 + 6535957 commit a402a94

5 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/push-redc-templates.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,19 @@ jobs:
2828
repo-token: ${{ secrets.GITHUB_TOKEN }}
2929
wait-interval: 10
3030

31+
wait-for-secret-scan:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Wait for secret scanning to complete
35+
uses: lewagon/wait-on-check-action@v1.3.4
36+
with:
37+
ref: ${{ github.ref }}
38+
check-name: 'Scan for Secrets (AK/SK/Passwords)'
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
wait-interval: 10
41+
3142
build-and-deploy:
32-
needs: wait-for-validation
43+
needs: [wait-for-validation, wait-for-secret-scan]
3344
runs-on: ubuntu-latest
3445
steps:
3546
# 1. 拉取源码 (最新版)

.github/workflows/secret-scan.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Secret Scanning
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
secret-scan:
15+
name: Scan for Secrets (AK/SK/Passwords)
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Source
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Fetch all history for better scanning
22+
23+
- name: TruffleHog Secret Scanning
24+
uses: trufflesecurity/trufflehog@v3.82.13
25+
with:
26+
# Scan the entire repository for secrets
27+
path: ./
28+
base: ${{ github.event.repository.default_branch }}
29+
head: HEAD
30+
# Scan for both verified and unverified secrets
31+
# Focus on detecting: Access Keys, Secret Keys, Passwords, API Tokens
32+
# Note: --fail is added automatically by the action
33+
extra_args: --exclude-paths=.trufflehogignore --json

.trufflehogignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TruffleHog exclusion patterns
2+
# Exclude docker-compose files with placeholder passwords
3+
aws/md/docker-compose\.yml

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ Recommended to use with the redc tool
4545
Static resources required at runtime are downloaded through proxy links defined in github_proxy in the template. AWS scenarios do not need to consider proxies.
4646

4747
Files generated after execution are stored on R2 storage, implemented through the upload_r2 module of the redc engine
48+
49+
## Security
50+
51+
This repository uses GitHub Actions to automatically check for sensitive information:
52+
53+
- **Secret Scanning**: Automatically detects access keys (AK), secret keys (SK), passwords, and other sensitive information in the code
54+
- **CI/CD Integration**: Scanning is triggered on every push and pull request
55+
- **Leak Prevention**: CI fails and blocks merging when sensitive information is detected
56+
57+
⚠️ **Important**: Do not write real AK/SK, passwords, or other sensitive information directly into the code. Use environment variables or configuration files to manage sensitive information.

README_CN.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ vultr (不推荐使用)
4545
运行时所需的静态资源通过模板中 github_proxy 的定义的代理链接去下载,aws 场景无需考虑代理
4646

4747
运行后的文件存储在 R2 存储上,通过 redc 引擎的 upload_r2 模块实现上传功能
48+
49+
## 安全检查
50+
51+
本仓库使用 GitHub Actions 自动检查敏感信息:
52+
53+
- **敏感信息扫描**: 自动检测代码中的访问密钥(AK)、秘密密钥(SK)、密码等敏感信息
54+
- **CI/CD 集成**: 每次推送和 Pull Request 都会触发自动扫描
55+
- **防止泄露**: 检测到敏感信息时,CI 会失败并阻止合并
56+
57+
⚠️ **重要**: 请勿将真实的 AK/SK、密码等敏感信息直接写入代码中。应使用环境变量或配置文件管理敏感信息。

0 commit comments

Comments
 (0)