Skip to content

Commit 653f849

Browse files
ci: add secrecy check workflow for PR descriptions and source files (MLT-OSS#188)
Automatically scans PR title, description, branch name, and source files for confidential internal tool names. Fails the check if any are found. Banned terms: langfuse, insight pipeline, gitlab, code.mlamp.cn, codex.mlamp.cn, glab, im.deepminer, im-test.xming Fixes: - Use bash [[ ]] pattern match instead of echo|grep (no subshell issue) - Unified BANNED_TERMS list between PR metadata and source file checks - Added glab to source file scan
1 parent cc2712d commit 653f849

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Secrecy Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
check-secrecy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check PR metadata for confidential terms
12+
env:
13+
PR_BODY: ${{ github.event.pull_request.body }}
14+
PR_TITLE: ${{ github.event.pull_request.title }}
15+
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
16+
run: |
17+
BANNED_TERMS=(
18+
"langfuse"
19+
"insight pipeline"
20+
"gitlab"
21+
"code.mlamp.cn"
22+
"codex.mlamp.cn"
23+
"glab"
24+
"im.deepminer"
25+
"im-test.xming"
26+
)
27+
28+
found=0
29+
30+
check_field() {
31+
local label="$1"
32+
local text="$2"
33+
local lower_text
34+
lower_text=$(printf '%s' "$text" | tr '[:upper:]' '[:lower:]')
35+
36+
for term in "${BANNED_TERMS[@]}"; do
37+
lower_term=$(printf '%s' "$term" | tr '[:upper:]' '[:lower:]')
38+
if [[ "$lower_text" == *"$lower_term"* ]]; then
39+
echo "::error::🔴 BLOCKED: '$term' found in $label"
40+
found=1
41+
fi
42+
done
43+
}
44+
45+
check_field "branch name" "$PR_BRANCH"
46+
check_field "PR title" "$PR_TITLE"
47+
check_field "PR description" "$PR_BODY"
48+
49+
if [ "$found" -eq 1 ]; then
50+
echo "::error::PR contains confidential term(s). Remove internal tool references before merging."
51+
exit 1
52+
fi
53+
54+
echo "✅ PR metadata secrecy check passed."
55+
56+
- name: Checkout code
57+
uses: actions/checkout@v4
58+
59+
- name: Check source files for confidential terms
60+
run: |
61+
BANNED_TERMS=("langfuse" "insight pipeline" "gitlab" "code.mlamp.cn" "codex.mlamp.cn" "glab" "im.deepminer" "im-test.xming")
62+
found=0
63+
64+
for term in "${BANNED_TERMS[@]}"; do
65+
matches=$(grep -ril "$term" firstdata/sources/ 2>/dev/null || true)
66+
if [ -n "$matches" ]; then
67+
echo "::error::🔴 '$term' found in source files: $matches"
68+
found=1
69+
fi
70+
done
71+
72+
if [ "$found" -eq 1 ]; then
73+
echo "::error::Source files contain confidential terms."
74+
exit 1
75+
fi
76+
77+
echo "✅ Source files secrecy check passed."

0 commit comments

Comments
 (0)