T09 · Insecure Skill Coding Practices
- Location
runtime/hkipo-next/src/hkipo_next/storage/review_store.py:438- Finding
Sensitive Financial History Is Stored Without Enforced Filesystem Permissions
- Content
View full analysis
sqlite3.Connection: self.path.parent.mkdir(parents=True, exist_ok=True) connection = sqlite3.connect(self.path) connection.row_factory = sqlite3.Row return connection ``` The database can contain sensitive investment outcomes and user-supplied notes: ```python class ReviewActualResult(BaseModel): model_config = ConfigDict(extra="forbid") allocated_lots: int | None = Field(default=None, ge=0) listing_return_pct: float | None = None exit_return_pct: float | None = None realized_pnl_hkd: float | None = None exited_at: datetime | None = None notes: str | None = None ``` Profile persistence similarly uses default permissions: ```python def save(self, profile: StoredProfile) -> None: self.path.parent.mkdir(parents=True, exist_ok=True) self.path.write_text( json.dumps(profile.model_dump(mode="json"), ensure_ascii=False, indent=2), encoding="utf-8", ) ``` ### Technical Analysis The application stores review records in a plaintext SQLite database under `~/.hkipo-next/data/hkipo.db`. These records may include stock symbols, investment decisions, risk profiles, allocated lots, realized profit or loss, exit dates, prediction payloads, and free-form notes. The parent directory is created without an explicit mode, and SQLite creates the database according to the process umask. The code neither sets the database to mode `0600` nor verifies permissions on an existin ...[truncated 1904 chars]- Remediation
View remediation
