Skip to content
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
8 changes: 4 additions & 4 deletions .github/engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@

## 凭据泄漏预防

不得提交凭据;使用 GitHub Secrets 或环境变量注入。必需的 `Gitleaks` 检查保留原名,使用 `.gitleaks.toml` 扫描新增提交,补充 MongoDB 带密码 URI、Alibaba AccessKey Secret 和配置赋值规则。测试目录只豁免明确合成的值,不整体跳过测试代码。
不得提交凭据;使用 GitHub Secrets 或环境变量注入。必需的 `Gitleaks` 检查保留原名,由组织统一门禁 `GdeiAssistant/.github/pr-governance` 随包提供 `.gitleaks.toml`,扫描新增提交,补充 MongoDB 带密码 URI、Alibaba AccessKey Secret 和配置赋值规则。测试目录只豁免明确合成的值,不整体跳过测试代码。

每周一 UTC 04:23 和手动触发的 `secret-scan-weekly.yml` 获取所有分支并扫描完整历史。`.gitleaks-baseline.json` 仅保存既有发现的规则、路径、提交、行号、fingerprint 和固定脱敏标记;它不豁免新提交。历史凭据仍须由所有者轮换,baseline 不代表凭据安全。
组织统一门禁提供完整历史扫描,要求仓库 Secret `SECRET_SCAN_BASELINE_B64`。本仓库尚未配置该 Secret,因此定时历史扫描保持关闭;新增提交仍由 `Gitleaks` 检查覆盖。历史凭据仍须由所有者轮换,baseline 不代表凭据安全。

Gitleaks 8.30.1 的原生 baseline 还比较作者、日期及位置元数据,不能直接使用精简记录。`secret_scan.py` 从本次脱敏扫描中按完整身份匹配已知项,临时补齐原生 baseline,再用 `--baseline-path` 复扫。原始报告和临时文件不上传;摘要仅含路径、规则和短提交号,保留三天。新增或修改 baseline 必须单独核对,不自动扩大历史豁免。
Gitleaks 8.30.1 的原生 baseline 还比较作者、日期及位置元数据,不能直接使用精简记录。统一门禁的 统一门禁的 统一门禁的 统一门禁的 `secret_scan.py` 从本次脱敏扫描中按完整身份匹配已知项,临时补齐原生 baseline,再用 `--baseline-path` 复扫。原始报告和临时文件不上传;摘要仅含路径、规则和短提交号,保留三天。新增或修改 baseline 必须单独核对,不自动扩大历史豁免。

每次上传报告、日志或混合产物前,先用同一配置扫描上传的精确路径;发现凭据或扫描错误则阻止该次上传。缺失路径沿用原上传步骤的缺失文件行为。只含 APK/AAB、已编译模拟器应用 ZIP、IPA/dSYM 的步骤不做无意义的二进制文本扫描;二进制安全仍须独立的制品分析。不要将明文日志或配置加入这些例外。

本地验证:`python3 .github/scripts/test_secret_scan.py`,以及 `python3 .github/scripts/secret_scan.py history --summary /tmp/secret-summary.json`。新规则需要用运行时生成的合成凭据测试;不得把真实值放进测试或终端输出。Gitleaks 安装固定 8.30.1,并按平台校验已固定的 SHA-256。
本地验证:在组织治理仓库检出中运行 `python3 pr-governance/scripts/test_secret_scan.py`;仓库内的 `.github/scripts/secret_scan.py` 只用于上传前扫描精确制品路径。新规则需要用运行时生成的合成凭据测试;不得把真实值放进测试或终端输出。Gitleaks 安装固定 8.30.1,并按平台校验已固定的 SHA-256。
14 changes: 14 additions & 0 deletions .github/governance/policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "pr-governance/v3",
"mode": "enforce",
"reviewer": {
"provider": "codex",
"app_id": 1144995,
"user_id": 199175422,
"login": "chatgpt-codex-connector[bot]"
},
"r0_paths": [],
"r2_paths": [],
"dependabot_template_exemption": true,
"max_evidence_age_hours": 168
}
29 changes: 29 additions & 0 deletions .github/workflows/codex-nudge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Shared governance action: GdeiAssistant/.github/pr-governance@b25f3dd3e5c78905c2302b342af984f6ef186466.
# Keep the job names; they are required status check contexts.

name: Review request

on:
schedule:
- cron: '*/30 * * * *'
workflow_dispatch:

permissions:
contents: read
pull-requests: read
issues: write

concurrency:
group: review-request
cancel-in-progress: false

jobs:
nudge:
name: Request a review
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Request
uses: GdeiAssistant/.github/pr-governance@b25f3dd3e5c78905c2302b342af984f6ef186466
with:
mode: nudge
32 changes: 0 additions & 32 deletions .github/workflows/engineering-governance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,6 @@ permissions:
contents: read

jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install verified Gitleaks CLI
run: bash .github/scripts/install-gitleaks.sh
- name: Test secret detection and baseline behavior
env:
GITLEAKS_BIN: ${{ runner.temp }}/gitleaks-bin/gitleaks
run: python3 .github/scripts/test_secret_scan.py
- name: Scan added commits with redacted findings
shell: bash
env:
PR_BASE: ${{ github.event.pull_request.base.sha }}
PR_HEAD: ${{ github.event.pull_request.head.sha }}
PUSH_BASE: ${{ github.event.before }}
PUSH_HEAD: ${{ github.sha }}
run: |
set -euo pipefail
base="${PR_BASE:-$PUSH_BASE}"
head="${PR_HEAD:-$PUSH_HEAD}"
if [[ -z "$base" || "$base" =~ ^0+$ ]]; then
echo "No base commit is available for this event" >&2
exit 1
fi
"$RUNNER_TEMP/gitleaks-bin/gitleaks" git . --config .gitleaks.toml --redact --no-banner --log-opts="$base..$head"

commitlint:
name: Commit message convention
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Shared governance action: GdeiAssistant/.github/pr-governance@b25f3dd3e5c78905c2302b342af984f6ef186466.
# Keep the job names; they are required status check contexts.

name: Secret scan

on:
pull_request:
push:
branches: [main, master]

permissions:
contents: read

jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Scan added commits
uses: GdeiAssistant/.github/pr-governance@b25f3dd3e5c78905c2302b342af984f6ef186466
with:
mode: scan
22 changes: 22 additions & 0 deletions .github/workflows/pr-review-signal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Shared governance action: GdeiAssistant/.github/pr-governance@b25f3dd3e5c78905c2302b342af984f6ef186466.
# Keep the job names; they are required status check contexts.

name: PR review signal

on:
pull_request_review:
types: [submitted, edited, dismissed]
Comment thread
Pigbibi marked this conversation as resolved.
Resolved
pull_request_review_comment:
types: [created, edited, deleted]

permissions:
contents: read

jobs:
signal:
name: Signal review change
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Signal
run: echo "review event recorded"
Loading
Loading