T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/daily_report.py:77- Finding
Daily reports aggregate records across users without ownership filtering
- Content
View full analysis
list[dict]: """从飞书读取指定日期的所有记录""" # 计算日期的毫秒时间戳 date_obj = datetime.strptime(date_str, "%Y-%m-%d").replace(tzinfo=CST) date_ts = int(date_obj.timestamp() * 1000) data = run_lark_cli([ "+record-list", "--base-token", BASE_TOKEN, "--table-id", RECORDS_TABLE_ID, "--limit", "200", ]) fields = data["data"]["fields"] records_raw = data["data"]["data"] field_names = {i: n for i, n in enumerate(fields)} records = [] for raw in records_raw: row = {} for i, val in enumerate(raw): name = field_names.get(i, f"field_{i}") row[name] = val # 只取目标日期的记录 rec_date = str(row.get("记录日期", ""))[:10] if rec_date == date_str: records.append(row) return records ``` The command-line interface accepts recorder identity parameters: ```python parser.add_argument("--recorder", default="", help="记录人姓名(用于显示)") parser.add_argument("--recorder-id", default="", help="记录人open_id(飞书user类型字段必填,格式:ou_xxx)") ``` However, those parameters are not applied when records are retrieved: ```python # Step 1: 读取记录 records = fetch_records(args.date) print(f"📋 读取到 {len(records)} 条记录") if not records: print(f"⚠️ {args.date} 无记录,跳过") return # Step 2: 计算统计 stats = compute_stats(records) # Step 3: 拼接全文 report_text = build_report_text(args.date, stats, args.insight) # Step 4: 写入日报表 write_daily_report(args.date, stats, report_text, args.insight, args.dry_run, args.recorder, args.recorder_id) ``` ### Technical Analysis The report generator retrieves up to 200 records from the entire records table and filters them only by date. It does not filter by the `记录人` field, ev ...[truncated 2283 chars]- Remediation
View remediation
