other
- Location
scripts/knowledge_router.py:9- Finding
Broad Collection of Sensitive Local Knowledge and Audit Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/knowledge_router.py, lines 9-60
Vulnerability Type: Sensitive Local Information Access
Risk Level: Mediumpython WORKSPACE = Path.cwd() SELF_IMPROVING = Path.home() / 'self-improving' @dataclass class Source: path: str source_type: str summary: str preview: str = '' def preview_text(path: Path, max_lines: int = 12) -> str: try: lines = path.read_text(errors='ignore').splitlines() return '\n'.join(lines[:max_lines]) except Exception: return '' def collect_sources(scope: str) -> List[Source]: sources: List[Source] = [] p = WORKSPACE / 'MEMORY.md' if p.exists(): sources.append(Source('MEMORY.md', 'stable-rule', 'Long-term defaults and durable operating rules.', preview_text(p))) mem_dir = WORKSPACE / 'memory' if mem_dir.exists() and scope in {'default', 'memory-only'}: for fp in sorted(mem_dir.glob('*.md'))[-8:]: sources.append(Source(str(fp.relative_to(WORKSPACE)), 'daily-fact', 'Dated event log, project progress, and recent factual history.', preview_text(fp))) if SELF_IMPROVING.exists() and scope in {'default', 'improvement-only'}: for fp in sorted(SELF_IMPROVING.glob('*.md'))[:10]: sources.append(Source(str(fp), 'improvement', 'Workflow improvement notes, corrections, and reusable lessons.', preview_text(fp))) if scope in {'default', 'skills-only'}: for fp in sorted((WORKSPACE / 'skills').glob('*/references/*.md'))[:80]: sources.append(Source(str(fp.relative_to(WORKSPACE)), 'method', 'Reusable method/reference knowledge from a skill.', preview_text(fp))) for fp in sorted((WORKSPACE / 'skills').glob('*/SKILL.md'))[:80]: sources.append(Source(str(fp.relative_to(WORKSPACE)), 'method', 'Skill-level guidance and workflow entry point.', preview_text(fp))) if ...[truncated 3327 chars]- Remediation
View remediation
Remediation Suggestions
- Default to metadata-only routing and avoid reading file contents unless content inspection is explicitly requested.
- Require explicit opt-in for sensitive source groups, particularly audit records, memory files, and directories outside the workspace.
- Resolve each candidate with
Path.resolve()and verify that it remains under an approved root before reading it. - Reject symbolic links or any path that resolves outside the authorized workspace or explicitly approved home-directory location.
- Apply secret redaction before storing previews, including filtering for access tokens, private keys, passwords, connection strings, and authentication headers.
- Minimize preview size and retain previews only for the shortest period necessary to calculate ranking scores.
- Clearly document the exact directories, file patterns, and content ranges read by every scope.
- Separate the home-directory source from the default scope so users must deliberately select
improvement-onlyor another explicit option before it is accessed.
