Tainted flow: 'STATE_FILE' from os.environ.get (line 64, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
def save_sent_tweets(ids): ids_list = sorted(ids)[-MAX_STORED_IDS:] with open(STATE_FILE, "w") as f: json.dump({"tweet_ids": ids_list, "updated": datetime.now(timezone.utc).isoformat()}, f)- Confidence
- 81% confidence
- Finding
- STATE_FILE is taken from the environment and used directly in a write operation without path validation. In a privileged or automated execution context, an attacker who can influence environment variables could redirect writes to unintended filesystem locations, causing file clobbering or persistence side effects.
