-
Security
Prevent path traversal in file operations
Stops ../ sequences in filenames and paths from reading or writing files outside the intended directory.
Free Prompt
What This Does / How This Helps
Finds every place user input becomes a filesystem path and makes sure it can't climb out of its directory with ../ tricks. Path traversal turns a download or export feature into a file reader for your whole server: ../../etc/passwd, your .env file, your source code, your database credentials. Any endpoint that takes a filename and reads it from disk without checking where the path lands is a candidate. The prompt insists on canonicalization plus a base-directory check rather than string filtering, because encoded and nested variants sail past simple replaces. Test cases included.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).