T09 · Insecure Skill Coding Practices
- Location
scripts/acceptance_runner.py:14- Finding
Acceptance and release decisions are fabricated using random values
- Content
View full analysis
Dict: """执行验收测试""" import random stories_data = [ {'id': 'US-001', 'name': '用户注册', 'passed': random.random() > 0.1}, {'id': 'US-002', 'name': '用户登录', 'passed': random.random() > 0.1}, {'id': 'US-003', 'name': '商品购买', 'passed': random.random() > 0.1}, ] passed = sum(1 for s in stories_data if s['passed']) return { 'environment': env, 'stories': stories_data, 'total': len(stories_data), 'passed': passed, 'failed': len(stories_data) - passed, 'pass_rate': round(passed / len(stories_data) * 100, 1), 'approved': passed == len(stories_data) } ``` `scripts/bdd_runner.py:13-28` ```python def run_bdd(features: str, steps: str) -> Dict: """执行BDD测试""" import random scenarios = [ {'name': '成功登录', 'given': '用户已注册', 'when': '输入正确密码', 'then': '登录成功', 'passed': random.random() > 0.1}, {'name': '失败登录', 'given': '用户已注册', 'when': '输入错误密码', 'then': '显示错误', 'passed': random.random() > 0.1}, ] passed = sum(1 for s in scenarios if s['passed']) return { 'features_path': features, 'steps_path': steps, 'scenarios': scenarios, 'passed': passed, 'failed': len(scenarios) - passed } ``` `scripts/acceptance_report.py:12-23` ```python def generate_acceptance_report(results: str, signoff: str) -> Dict: """生成验收报告""" import random return { 'results_file': results, 'signoff_required': signoff == 'required', 'overall_status': 'PASSED' if ...[truncated 2576 chars]- Remediation
View remediation
