Tainted flow: 'JOURNAL_FILE' from os.environ.get (line 34, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
def save_entry(entry: dict) -> dict: os.makedirs(DATA_DIR, exist_ok=True) with open(JOURNAL_FILE, "a", encoding="utf-8") as f: f.write(json.dumps(entry, ensure_ascii=False) + "\n") return entry- Confidence
- 90% confidence
- Finding
- The script trusts STOIC_COACH_DATA_DIR from the environment and uses it to construct JOURNAL_FILE, which is then opened for append without validation. In a host/agent environment where environment variables can be influenced, this can redirect sensitive journaling data to an unintended path or overwrite/append to attacker-chosen files accessible to the process.
