- scan-skill.sh: loopback 不算风险、命中走允许清单 - 11 个文件的 /Users/<机器名> 绝对路径去环境化(脚本 $HOME、文档 ~) - 允许清单登记运维环境地址与示例占位符(非凭据),附理由 - scan: 57 warns -> 0 warns / 0 high - 新增 .gitea/workflows/skill-gate.yml(validate --strict + scan + catalog --check + 测试)
This commit is contained in:
@@ -24,7 +24,7 @@ HIGH_PATTERNS=(
|
||||
# Warnings: machine-specific paths, plain http endpoints.
|
||||
WARN_PATTERNS=(
|
||||
'/Users/[A-Za-z0-9._-]+/'
|
||||
'http://[A-Za-z0-9.-]+'
|
||||
'http://[A-Za-z0-9.:-]+'
|
||||
'password[[:space:]]*=[[:space:]]*[^$]'
|
||||
)
|
||||
|
||||
@@ -67,6 +67,14 @@ for dir in "${targets[@]}"; do
|
||||
done
|
||||
for pattern in "${WARN_PATTERNS[@]}"; do
|
||||
while IFS= read -r hit; do
|
||||
# 本机回环地址不算风险(本地开发/测试示例)
|
||||
case "$hit" in
|
||||
*"http://localhost"*|*"http://127.0.0.1"*) continue ;;
|
||||
esac
|
||||
if is_allowlisted "${hit%%:*}" "$hit"; then
|
||||
echo "[allow] $rel: ${hit#*:}"
|
||||
continue
|
||||
fi
|
||||
echo "[warn] $rel: ${hit%%:*}:${hit#*:}"
|
||||
WARN=$((WARN + 1))
|
||||
done < <(grep -rnE --include='*.md' --include='*.sh' --include='*.py' --include='*.js' --include='*.ts' -- "$pattern" "$dir" 2>/dev/null | cut -c1-200)
|
||||
|
||||
Reference in New Issue
Block a user