Tainted flow: 'STATE_FILE' from os.environ.get (line 78, credential/environment) → pathlib.Path.write_text (file write)
Medium
- Category
- Data Flow
- Content
def save_state(state: dict) -> None: STATE_FILE.write_text(json.dumps(state, ensure_ascii=False, indent=2), encoding="utf-8") def add_to_collection(theme: str, name: str, custom_profile=None, context: str = "") -> dict:- Confidence
- 93% confidence
- Finding
- The state file path is derived from the BUDDY_STATE_FILE environment variable and then written without validation. In an agent or service context where environment variables can be influenced by deployment, wrappers, or other components, this can redirect writes to unintended files, causing file clobbering, corruption of application data, or privacy issues.
