T09 · Insecure Skill Coding Practices
- Location
scripts/job_tracker.py:8- Finding
Plaintext Storage of Sensitive Employment and Contact Data Without Explicit Access Controls
- Content
View full analysis
Vulnerability Details
File Location:
scripts/job_tracker.py:8-10,scripts/job_tracker.py:17-20,scripts/job_tracker.py:43-50, andscripts/job_tracker.py:90-105
Vulnerability Type: Sensitive data stored in plaintext with permissions inherited from the runtime environment
Risk Level: LowVulnerable Code
python def runtime_dir(base_dir): path = Path(base_dir) / ".runtime" path.mkdir(parents=True, exist_ok=True) return pathpython def get_connection(base_dir): connection = sqlite3.connect(db_path(base_dir)) connection.row_factory = sqlite3.Row ensure_schema(connection) return connectionpython CREATE TABLE IF NOT EXISTS contacts ( id INTEGER PRIMARY KEY AUTOINCREMENT, application_id INTEGER NOT NULL, name TEXT NOT NULL, email TEXT, linkedin TEXT, role TEXT, notes TEXT, FOREIGN KEY(application_id) REFERENCES applications(id) );python if args.contact_name: connection.execute( """ INSERT INTO contacts (application_id, name, email, linkedin, role, notes) VALUES (?, ?, ?, ?, ?, ?) """, ( application_id, args.contact_name, args.contact_email, args.contact_linkedin, args.contact_role, args.contact_notes, ), )Technical Analysis
The skill stores recruiter names, email addresses, LinkedIn profiles, employment activity, and free-form notes in an unencrypted SQLite database. The
.runtimedirectory is created without an explicit restrictive mode, and the database file created throughsqlite3.connect()is not subsequently restricted to owner-only access.Consequently, the effective permissions of both the directory and database depend on the process umask and permissions of the parent directory. On a shared system with a permissive umask or accessible parent directory, other local users may be able to inspect the database. ...[truncated 1635 chars]
- Remediation
View remediation
Remediation Suggestions
- Create the runtime directory with owner-only permissions and correct existing permissions:
python def runtime_dir(base_dir): path = Path(base_dir) / ".runtime" path.mkdir(parents=True, exist_ok=True, mode=0o700) path.chmod(0o700) return path- Restrict the database to owner read/write access immediately after opening or creating it:
python def get_connection(base_dir): path = db_path(base_dir) connection = sqlite3.connect(path) path.chmod(0o600) connection.row_factory = sqlite3.Row ensure_schema(connection) return connection-
Validate that
.runtimeand the database are not symbolic links before creating or opening them when the base directory could be influenced by an untrusted local user. -
Document that credentials, authentication tokens, government identifiers, and other secrets must not be entered into free-form notes.
-
If the deployment threat model includes unauthorized filesystem access, consider application-level encryption for sensitive fields with keys stored separately from the database.
-
Add automated tests that verify
.runtimeis mode0700andjob-tracker.dbis mode0600on platforms supporting POSIX permissions.
