T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/scan_user_context.py:165- Finding
Default Broad Collection of Agent Memory and Workspace Metadata Violates Least Privilege
- Content
View full analysis
dict: """Scan TRAE memory using three weighting levels.""" summary = {"project_memory_words": 0, "topics_words": 0, "user_profile_words": 0} project_memory_dir = _derive_project_memory_dir(memory_root, project_dir) pm = project_memory_dir / "project_memory.md" if pm.exists(): text = pm.read_text(encoding="utf-8") summary["project_memory_words"] = _extract_keywords( text, 3, "project_memory", counter, source_map ) today = datetime.now().strftime("%Y%m%d") yesterday = (datetime.now() - timedelta(days=1)).strftime("%Y%m%d") for date_str in [today, yesterday]: topics = project_memory_dir / date_str / "topics.md" if topics.exists(): text = topics.read_text(encoding="utf-8") summary["topics_words"] += _extract_keywords( text, 2, "topics", counter, source_map ) up = memory_root / "user_profile.md" if up.exists(): text = up.read_text(encoding="utf-8") summary["user_profile_words"] = _extract_keywords( text, 1, "user_profile", counter, source_map ) return summary ``` ```python def _scan_active_projects(project_dir: Path, days: int = 7) -> tuple[list[str], dict, dict]: cutoff = datetime.now() - timedelta(days=days) active = [] counter: dict = defaultdict(int) source_map: dict = defaultdict(list) if not project_dir.exists(): return active, counter, source_map for item in project_dir.iterdir(): if not item.is_dir(): continue if ...[truncated 4158 chars]- Remediation
View remediation
