T09 · Insecure Skill Coding Practices
- Location
scripts/attendance_query.py:17- Finding
Plaintext and Indefinite Local Storage of Employee Attendance Data
- Content
View full analysis
sqlite3.Connection: conn = sqlite3.connect(db_path) conn.execute( """ CREATE TABLE IF NOT EXISTS kv_cache ( key TEXT PRIMARY KEY, value TEXT NOT NULL, ts REAL NOT NULL ) """ ) conn.execute( """ CREATE TABLE IF NOT EXISTS attendance_history ( work_date TEXT NOT NULL, user_id TEXT NOT NULL, user_name TEXT NOT NULL, result_type TEXT NOT NULL, count INTEGER NOT NULL, queried_at REAL NOT NULL, PRIMARY KEY (work_date, user_id, result_type) ) """ ) conn.commit() return conn def _save_attendance_history( fail_table: Dict[str, "collections.Counter"], user_names: Dict[str, str], work_date: str, db_path: str = DEFAULT_CACHE_DB_PATH, ) -> None: """Save abnormal attendance records in the attendance_history table.""" conn = _get_cache_conn(db_path) try: now = time.time() for userid, counter in fail_table.items(): name = user_names.get(userid, userid) for result_type, count in counter.items(): conn.execute( """INSERT OR REPLACE INTO attendance_history (work_date, user_id, user_name, result_type, count, queried_at) VALUES (?, ?, ?, ?, ?, ?)""", (work_date, userid, name, result_type, count, now), ) conn.comm ...[truncated 2687 chars]- Remediation
View remediation
