T09 · Insecure Skill Coding Practices
- Location
index.js:31- Finding
Non-Atomic Database Updates Can Cause Data Loss or Corruption
- Content
View full analysis
n.id === noteId); if (note) { note.status = 'processed'; await saveDatabase(db); console.log(`✅ Note #${noteId} marquée comme traitée`); return true; } console.warn(`⚠️ Note #${noteId} introuvable`); return false; } ``` ### Technical Analysis Each mutation loads the entire JSON database, changes an in-memory copy, and overwrites the original file. There is no mutex, serialized write queue, revision check, file lock, transactional database mechanism, or atomic temporary-file replacement. If two exported mutation functions execute concurrently, both can read the same initial version. Each then writes a different modified copy, and the final writer silently discards the first writer's changes ...[truncated 2036 chars]- Remediation
View remediation
