Unsafe temp files

From zakirkun/ice-tea · View interactive version

Unsafe temp files is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects creation of temporary files with predictable names or in world-writable locations, enabling symlink attacks and race conditions.

How to use this skill

Skill file

Unsafe Temporary File Creation

Overview

Creating temporary files insecurely can lead to:

Detection Strategy

Remediation

Use language-provided secure temp file APIs that atomically create and open the file.

Vulnerable (Python):

import tempfile, os
tmp_path = '/tmp/myapp_' + str(os.getpid())
with open(tmp_path, 'w') as f:  # Race condition!
    f.write(data)

Safe (Python):

import tempfile
with tempfile.NamedTemporaryFile(mode='w', delete=True) as f:
    f.write(data)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.