T09 · Insecure Skill Coding Practices
- Location
src/memory_core.py:42- Finding
Sensitive memory data is stored without restrictive filesystem permissions
- Content
View full analysis
None: """Ensure the directory exists.""" path.mkdir(parents=True, exist_ok=True) ``` ```python # Write file path = self.memories_dir / f"{memory_id}.json" path.write_text(json.dumps(record, ensure_ascii=False, indent=2), encoding="utf-8") ``` ```python def save(self) -> None: """ Persist in-memory state to disk. """ _ensure_dir(self.storage_dir) # entities with open(self.entities_path, "w", encoding="utf-8") as f: json.dump(self._entities, f, ensure_ascii=False, indent=2) # inverted tag index with open(self.index_path, "w", encoding="utf-8") as f: json.dump(dict(self._tag_index), f, ensure_ascii=False, indent=2) # meta meta = { "saved_at": _utc_now(), "total_memories": len(self._memories), "total_entities": len(self._entities), "total_tags": len(self._tag_index), } with open(self.meta_path, "w", encoding="utf-8") as f: json.dump(meta, f, ensure_ascii=False, indent=2) ``` ```python def __init__(self, storage_dir: str = "/workspace/memory/nova-memory/"): self.storage_dir = Path(storage_dir) self.storage_dir.mkdir(parents=True, exist_ok=True) self.db_path = Path(storage_dir) / "memory_olap.db" self._init_db() ``` ### Technical Analysis The application stores arbitrary memory content, entity facts, tags, indexes, and analytics in JSON and SQLite files. These records may contain private or otherwise sensitive information. The directories and files are created without explicitly enforcing owner-only permissions. Their effective modes therefore depend on the process umask and the permissions of pre-existing files an ...[truncated 1584 chars]- Remediation
View remediation
