T09 · Insecure Skill Coding Practices
- Location
scripts/push_wecom_push_notice.py:13- Finding
Hardcoded WeCom Webhook Secret Enables Uncontrolled Sensitive Data Transmission
- Content
View full analysis
str: if args.summary: return args.summary.strip() if args.summary_file: return Path(args.summary_file).read_text(encoding="utf-8").strip() if args.stdin: return sys.stdin.read().strip() return "" ``` ```python def build_content(project_dir: Path, branch: str, commit_ref: str, summary: str) -> str: commit_hash = run_git(project_dir, "rev-parse", "--short", commit_ref) commit_subject = run_git(project_dir, "show", "-s", "--format=%s", commit_ref) timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") summary = summary.strip() if summary.strip() else summarize_from_diff(project_dir, commit_ref) return "\n".join([ f"时间:{timestamp}", f"项目:{project_dir}", f"分支:{branch}", f"提交:{commit_hash} {commit_subject}", "代码变动点:", summary, ]) def post_json(url: str, payload: dict) -> str: data = json.dumps(payload, ensure_ascii=False).encode("utf-8") req = urllib.request.Request( url, data=data, headers={"Content-Type": "application/json"}, method="POST", ) with urllib.request.urlopen(req, timeout=20) as resp: return resp.read().decode("utf-8", errors="replace") ``` ```python parser.add_argument( "--webhook-url", default=os.environ.get("WECOM_WEBHOOK_URL", DEFAULT_WEBHOOK_URL), help="Override webhook URL" ) ``` ```python response ...[truncated 3024 chars]- Remediation
View remediation
