Toolvito

Works on this device

Filename Allowlist Tester

Test the rules your upload form uses to accept file names. Type the extensions you allow, choose your rules, and paste names to test. The tool says which names your rules accept or refuse, lists every rule a name breaks, and notes risks your rules let through.

Enter your values

Your values

Separate them with commas or spaces. A dot in front is fine. An entry with a dot inside, such as tar.gz, works with the first rule only.

So you can test characters that are hard to type. Untick it to test the text exactly as typed.

One name on each line, as a visitor might upload it. Spaces are kept. Empty lines are skipped.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Test the names.

How to use the filename allowlist tester

  1. Type the extensions you allow, such as jpg, png, pdf.
  2. Choose how the extension is checked: only the last extension, every extension, or exactly one.
  3. Choose whether capital letters matter, which characters are allowed, and the other rules.
  4. Type or paste the names to test, one on each line. Write hard-to-type characters as \u{202E}.
  5. Choose Test the names. Each row shows the result, the extension, the rules broken and risk notes.

The rules the tool can test

  • Extensions are the parts after the first dot that is not at the start of the name: shell.php.jpg has .php and .jpg; .htaccess has none.
  • Last extension only: the name ends with an allowed extension. shell.php.jpg passes this rule, so the tool notes the double extension.
  • Every extension or exactly one extension: stricter rules that refuse shell.php.jpg.
  • Capital letters: with "do not matter", photo.JPG matches jpg.
  • Characters: refuse invisible and direction characters (Unicode category Cf, such as U+202E, which can make invoice[U+202E]gpj.exe look like invoiceexe.jpg), allow only plain ASCII, or allow any characters.
  • Dots and spaces at the end: Windows removes them, so shell.php. is saved as shell.php.
  • Reserved Windows names: CON, PRN, AUX, NUL, COM0 to COM9, LPT0 to LPT9 (and COM or LPT with ¹ ² ³), also with an extension, such as CON.jpg; and the characters < > : " | ? *.
  • Always checked: an empty name, / or \ (a path), control characters, and the longest name you allow.

Worked example

With the starting rules and names, 4 of 13 names pass: photo.jpg, photo.JPG, shell.php.jpg and the name résumé.pdf typed with separate accents. Two of them have risk notes: shell.php.jpg has two extensions, and the accented name is not in NFC form. shell.jpg.php is refused because its last extension .php is not in the list, and CON.jpg because CON is a reserved Windows name.

Limits you should know

  • The tool tests your rules as you set them. It does not say what a real server, operating system or browser does with a file.
  • A name is not proof of what a file holds. Check the content of each upload too, and store uploads under names your server makes.
  • NFC and NFKC normal forms use the Unicode data of your browser.
  • Reserved Windows names follow the Microsoft document "Naming Files, Paths, and Namespaces". Other systems have other rules.

Related tools