- Location
- scripts/personal-db.js:14
- Finding
- Sensitive inferred user profiles are stored persistently in plaintext SQLite<![CDATA[
## Vulnerability Details
**File Location**: `scripts/personal-db.js`, lines 14-28 and 46-73; `assets/hook-skills/update-data.md`, lines 23-42 and 77-90
**Vulnerability Type**: Plaintext storage of sensitive personal data
**Risk Level**: High
### Vulnerable Code Snippet
```javascript
const DB_PATH = process.env.SOUL_DB_PATH ||
path.join(__dirname, '..', 'personal-db.sqlite');
function getDb() {
return new Database(DB_PATH);
}
db.exec(`
CREATE TABLE IF NOT EXISTS dimensions (
dimension_id TEXT PRIMARY KEY,
value TEXT NOT NULL,
updated_at TEXT NOT NULL DEFAULT (datetime('now', 'localtime'))
);
`);
```
```javascript
db.prepare(`
INSERT INTO dimensions (dimension_id, value, updated_at)
VALUES (?, ?, datetime('now', 'localtime'))
ON CONFLICT(dimension_id) DO UPDATE SET
value = excluded.value,
updated_at = datetime('now', 'localtime')
`).run(id, newValue);
```
The update hook identifies profile-worthy conversations involving self-expression, emotions, values, decisions, relationships, goals, and personal reflection, and then writes extracted values through the `merge` command.
### Technical Analysis
The database utility stores profile values directly as unencrypted text. No field-level encryption, encrypted database layer, operating-system permission enforcement, retention period, automatic deletion, or user-access control is implemented.
The stored content is especially sensitive because the post-conversation hook is designed to infer and retain emotional, relational, behavioral, career, and identity-related attributes. The `get-all` command exposes the entire stored profile through standard output.
The `SOUL_DB_PATH` environment variable can redirect the database to another writable location. Although this is useful operationally, the program does not validate that the selected location is private or protected.
Prepared SQL statements prevent conventional SQL injection in these write operations, but they do not p
...[truncated 1201 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
- Encrypt sensitive profile values at rest using a key stored outside the workspace.
- Prefer an encrypted database implementation or authenticated field-level encryption.
- Create the database with restrictive owner-only filesystem permissions.
- Validate that `SOUL_DB_PATH` resolves to an approved private directory.
- Define configurable retention periods and automatically delete expired profile records.
- Provide commands to inspect, export, selectively delete, and completely erase stored data.
- Require explicit consent before collecting sensitive categories.
- Disable emotional, mental-health, relationship, and identity profiling by default.
- Avoid printing the entire profile to standard output unless explicitly requested and confirmed.
- Document how workspace backups and synchronization tools may copy the database.
]]>