other
- Location
stats.py:53- Finding
Broad Access to Sensitive Claude Conversation History
- Content
View full analysis
Dict[str, int]: """处理单个 JSONL 文件,返回技能计数""" counts = {} try: with open(file_path, "r", encoding="utf-8", errors="ignore") as f: for line in f: try: entry = json.loads(line) # 检查时间戳 if cutoff_ts is not None and "timestamp" in entry: ts = entry.get("timestamp") if isinstance(ts, (int, float)) and ts < cutoff_ts: continue # 检查 display 字段 if "display" in entry: display = entry.get("display", "") for skill, pattern in skill_patterns.items(): if pattern.search(display): counts[skill] = counts.get(skill, 0) + 1 except (json.JSONDecodeError, KeyError, TypeError): continue except (IOError, OSError): pass return counts def collect_stats(period: str) -> Dict[str, int]: """收集指定时间段的技能使用统计""" cutoff_ts = get_cutoff_timestamp(period) skills = get_installed_skills() skill_patterns = build_skill_patterns(skills) skill_counts = {skill: 0 for skill in skills} # 处理全局历史文件 history_file = Path.home() / ".claude" / "history.jsonl" if history_file.exists(): counts = process_file(history_file, skill_patterns, cutoff_ts) for skill, count in counts.items(): skill_counts[skill] = skill_counts.get(skill, 0) + count # 处理项目会话文件 projects_dir = Path.home() / ".claude" / "projects" if projects_dir ...[truncated 2573 chars]- Remediation
View remediation
