# Generated by: tfg preset eject filename-handling
# Will my system store, show and give back a file name it did not expect?
#
# Edit it, commit it, it is an ordinary recipe from here on.

version: 1
targets:
  - id: polish_diacritics
    format: txt
    count: 1
    size: 1024
    name: zażółć gęślą jaźń.txt
    group: scripts
    purpose: A Polish name with diacritics, each accented letter two bytes in UTF-8. A system that stores the name in one encoding and shows it in another turns it into mojibake.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: cyrillic
    format: txt
    count: 1
    size: 1024
    name: Отчёт за квартал.txt
    group: scripts
    purpose: A name in Cyrillic, so none of it is ASCII. It shows whether the name survives storage, display and download without turning into question marks.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: cjk
    format: txt
    count: 1
    size: 1024
    name: 報告書.txt
    group: scripts
    purpose: A name in Japanese, three bytes a character in UTF-8. It checks that the name is kept whole and shown in its own script.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: rtl_with_digits
    format: txt
    count: 1
    size: 1024
    name: تقرير 2024 v2.txt
    group: scripts
    purpose: An Arabic word followed by a year and a version, written right to left. A list or a log that ignores the direction of the text shows the parts in the wrong order.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: emoji
    format: txt
    count: 1
    size: 1024
    name: 🎉.txt
    group: scripts
    purpose: "A name that is one emoji - four bytes in UTF-8 and two units in UTF-16. Storage that allows three bytes a character, such as the old utf8 of MySQL, refuses it or cuts it."
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: emoji_zwj
    format: txt
    count: 1
    size: 1024
    name: "👨\u200d👩\u200d👧 family.txt"
    group: scripts
    purpose: A family emoji made of three emoji joined by zero width joiners, then a word. Counting characters, cutting or reversing the name breaks the family apart.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: nfd
    format: txt
    count: 1
    size: 1024
    name: café.txt
    group: scripts
    purpose: The word cafe with its accent written as a separate character after the e. It looks like the usual spelling, and a system comparing bytes treats the two as different files.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: hangul_nfd
    format: txt
    count: 1
    size: 1024
    name: 한국어 보고서.txt
    group: scripts
    purpose: A Korean name written as separate letters rather than syllables, the way macOS hands names over. It checks that the name is shown as syllables and matched to its usual spelling.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: case_mapping
    format: txt
    count: 1
    size: 1024
    name: İstanbul Straße.txt
    group: scripts
    purpose: A dotted capital I and a sharp s, whose upper and lower case forms change length or letter. A system that changes case before it compares or stores names gets them wrong.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: fullwidth
    format: txt
    count: 1
    size: 1024
    name: ｒｅｐｏｒｔ.txt
    group: scripts
    purpose: The word report in full width letters, which Unicode normalisation turns into ordinary ones. It shows whether a system normalises names and then finds two files under one name.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: combining_stack
    format: txt
    count: 1
    size: 1024
    name: z̵̡a̷l̸g̶o.txt
    group: scripts
    purpose: Letters with several combining marks stacked on each one. It checks that a list or a label keeps the name inside its line and never cuts it in the middle of a letter.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: bidi_override
    format: txt
    count: 1
    size: 1024
    name: "photo\u202egpj.txt"
    group: lookalike
    purpose: A right to left override inside the name, so the file ends in .txt and is shown as if it ended in .jpg. It checks that the system shows the real extension and does not trust what is displayed.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: zero_width
    format: txt
    count: 1
    size: 1024
    name: "in\u200bvoice.txt"
    group: lookalike
    purpose: The word invoice with a zero width space inside it. It looks exactly like invoice, so a system that shows names without marking such characters lets two different names look the same.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: no_break_space
    format: txt
    count: 1
    size: 1024
    name: "annual\u00a0report.txt"
    group: lookalike
    purpose: A no-break space between the two words instead of an ordinary one. It looks the same, and a search, a comparison or a trim that knows only the ordinary space misses it.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: homoglyph
    format: txt
    count: 1
    size: 1024
    name: pаypal.txt
    group: lookalike
    purpose: The word paypal with a Cyrillic a in place of the Latin one. It looks identical, and it checks whether the system warns about names that mix scripts.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: leading_bom
    format: txt
    count: 1
    size: 1024
    name: "\ufeffreport.txt"
    group: lookalike
    purpose: A byte order mark at the start of the name, invisible on screen. A system that strips it from file contents and not from names ends up with a name nobody can type.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: line_separator
    format: txt
    count: 1
    size: 1024
    name: "report\u2028ERROR admin logged in.txt"
    group: lookalike
    purpose: A Unicode line separator in the name, followed by words that read like a log entry. A log that writes names as they are shows a line nobody logged.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: unicode_tags
    format: txt
    count: 1
    size: 1024
    name: "report\U000e0068\U000e0069\U000e0064\U000e0064\U000e0065\U000e006e\U000e0020\U000e006e\U000e006f\U000e0074\U000e0065.txt"
    group: lookalike
    purpose: "The word report followed by invisible Unicode tag characters that spell a short note. The name looks like report, and anything reading the raw name - a script, a language model - sees text a person cannot."
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: leading_space
    format: txt
    count: 1
    size: 1024
    name: " leading space.txt"
    group: spaces-and-dots
    purpose: A name that begins with a space. Many systems trim it on the way in or on the way out, and the file can then no longer be found under the name it was given.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: leading_ideographic_space
    format: txt
    count: 1
    size: 1024
    name: "\u3000report.txt"
    group: spaces-and-dots
    purpose: A name that begins with an ideographic space, the wide space of CJK scripts. It checks whether the system keeps it, trims it or shows it, and whether that is what you want.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: double_space
    format: txt
    count: 1
    size: 1024
    name: two  spaces.txt
    group: spaces-and-dots
    purpose: Two spaces between the words. A web page shows them as one, so the name on the page is not the name on the disk.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: leading_dot
    format: txt
    count: 1
    size: 1024
    name: .hidden.txt
    group: spaces-and-dots
    purpose: A name that begins with a dot, which Linux and macOS hide from ordinary listings. It checks that the file stays visible and manageable in your system.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: leading_double_dot
    format: txt
    count: 1
    size: 1024
    name: ..report.txt
    group: spaces-and-dots
    purpose: A name that begins with two dots. Code that looks for two dots to stop path traversal may refuse it, and code that strips dots may turn it into another name.
    expected:
      outcome: unspecified
      reason: filename_traversal
  - id: only_extension
    format: txt
    count: 1
    size: 1024
    name: .txt
    group: spaces-and-dots
    purpose: A name that is only the extension, with nothing before the dot. Linux and macOS hide it, and a system that splits the name at the dot is left with an empty name.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: many_dots
    format: txt
    count: 1
    size: 1024
    name: v1.2.3.final.txt
    group: spaces-and-dots
    purpose: A name with several dots, as in a version number. Only the part after the last dot is the extension, and a system that splits at the first dot gets the type wrong. Your system should take it.
    expected: accept
  - id: no_extension
    format: txt
    count: 1
    size: 1024
    name: README
    group: spaces-and-dots
    purpose: A file called README with no extension at all. A system that requires an extension, or guesses the type from it, has nothing to go on.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: upper_extension
    format: txt
    count: 1
    size: 1024
    name: REPORT.TXT
    group: spaces-and-dots
    purpose: The extension in capitals. A system that compares extensions with case turns away a file it takes in lower case. Your system should take it.
    expected: accept
  - id: leading_dash
    format: txt
    count: 1
    size: 1024
    name: -rf.txt
    group: metacharacters
    purpose: "A name that begins with a dash, -rf. Passed to a command line without a -- before it, it is read as an option."
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: shell_substitution
    format: txt
    count: 1
    size: 1024
    name: $(id) `id`.txt
    group: metacharacters
    purpose: A name holding $(id) and the same command in backticks, which a shell runs. It checks that no script or command line ever puts the name into a shell unquoted.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: shell_separators
    format: txt
    count: 1
    size: 1024
    name: a;b&c.txt
    group: metacharacters
    purpose: A name with a semicolon and an ampersand, which end one shell command and start another. It checks that the name never reaches a shell as text.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: sql_quote
    format: txt
    count: 1
    size: 1024
    name: "'; DROP TABLE files; --.txt"
    group: metacharacters
    purpose: A name that closes an SQL string and drops a table. It checks that names go into the database as parameters and are never pasted into a query.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: script_quote
    format: txt
    count: 1
    size: 1024
    name: "'-alert(1)-'.txt"
    group: metacharacters
    purpose: A name that closes a quoted string and calls alert. It checks that a page showing the name escapes it for JavaScript and for HTML.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: url_encoded_traversal
    format: txt
    count: 1
    size: 1024
    name: ..%2F..%2Fetc%2Fpasswd.txt
    group: metacharacters
    purpose: The path ../../etc/passwd with every slash written as %2F. A system that decodes the name after checking it for traversal lets it climb out of the upload directory.
    expected:
      outcome: unspecified
      reason: filename_traversal
  - id: fullwidth_traversal
    format: txt
    count: 1
    size: 1024
    name: ．．／．．／ｅｔｃ／ｐａｓｓｗｄ.txt
    group: metacharacters
    purpose: The path ../../etc/passwd in full width dots and slashes, which Unicode normalisation turns into ordinary ones. A system that normalises after checking for traversal lets it climb out of the upload directory.
    expected:
      outcome: unspecified
      reason: filename_traversal
  - id: encoded_control
    format: txt
    count: 1
    size: 1024
    name: report%00%0D%0A.txt
    group: metacharacters
    purpose: "A name holding %00, %0D and %0A. Decoded, they are a null byte and a line break - a name cut short, or a header or a log line nobody wrote."
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: fullwidth_extension
    format: txt
    count: 1
    size: 1024
    name: report.ｔｘｔ
    group: metacharacters
    purpose: The extension in full width letters, so it looks like the real one and is not. A system that normalises before it checks the type sees one extension, and one that does not sees another.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: url_specials
    format: txt
    count: 1
    size: 1024
    name: "100% a+b #1.txt"
    group: metacharacters
    purpose: A name with a percent sign, a plus and a hash. Each means something else in an address, so a download link built without encoding points at another file or cuts the name at the hash.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: formula
    format: txt
    count: 1
    size: 1024
    name: =1+1.txt
    group: metacharacters
    purpose: A name that begins with an equals sign, which a spreadsheet reads as a formula. It checks that a list of names exported to CSV or Excel does not run it.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: htaccess
    format: txt
    count: 1
    size: 1024
    name: .htaccess
    group: special-names
    purpose: A file called .htaccess. On an Apache server that serves the upload directory it changes how the server behaves, whatever the file holds.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: web_config
    format: txt
    count: 1
    size: 1024
    name: web.config
    group: special-names
    purpose: A file called web.config. On an IIS server that serves the upload directory it changes how the server behaves, whatever the file holds.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: dotenv
    format: txt
    count: 1
    size: 1024
    name: .env
    group: special-names
    purpose: A file called .env, the name applications read their settings and secrets from. It checks that an upload cannot land where it would be read as configuration.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: ds_store
    format: txt
    count: 1
    size: 1024
    name: .DS_Store
    group: special-names
    purpose: A file called .DS_Store, which macOS writes into folders. Systems often hide or skip it, and it checks that the file is treated the way you mean.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: desktop_ini
    format: txt
    count: 1
    size: 1024
    name: desktop.ini
    group: special-names
    purpose: A file called desktop.ini, which Windows Explorer reads to decide how a folder looks. It checks that an upload cannot change how a shared folder is shown.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: office_lock
    format: txt
    count: 1
    size: 1024
    name: ~$report.txt
    group: special-names
    purpose: A name that begins with a tilde and a dollar sign, the way Microsoft Office names its lock files. Sync tools and backups often skip such files, so it may quietly not arrive.
    expected:
      outcome: unspecified
      reason: filename_invalid
  - id: null_word
    format: txt
    count: 1
    size: 1024
    name: null.txt
    group: values
    purpose: "A file called null. A system that turns the name into a value somewhere - JSON, a database, a template - may store no name at all. Your system should take it."
    expected: accept
  - id: leading_zeros
    format: txt
    count: 1
    size: 1024
    name: 007.txt
    group: values
    purpose: A name made of digits with leading zeros. A spreadsheet, a JSON reader or a database column that reads it as a number drops the zeros. Your system should take it.
    expected: accept
  - id: ustar_101
    format: txt
    count: 1
    size: 1024
    name: uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu.txt
    group: length
    purpose: A name of 101 bytes with its extension, one more than the name field of a ustar tar archive holds. Packing uploads into tar cuts it or moves it into an extra header.
    expected:
      outcome: unspecified
      reason: filename_too_long
  - id: max_ascii
    format: txt
    count: 1
    size: 1024
    name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt
    group: length
    purpose: A name of 255 bytes in ASCII, the longest most file systems store. A system that adds a prefix or a suffix on the way in pushes it over the limit.
    expected:
      outcome: unspecified
      reason: filename_too_long
  - id: cjk_bytes
    format: txt
    count: 1
    size: 1024
    name: 日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日.txt
    group: length
    purpose: A name of up to 255 bytes made of CJK characters, three bytes each. A limit counted in characters lets it through where the storage counts bytes.
    expected:
      outcome: unspecified
      reason: filename_too_long
  - id: emoji_bytes
    format: txt
    count: 1
    size: 1024
    name: 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉.txt
    group: length
    purpose: A name of up to 255 bytes made of emoji, four bytes and two UTF-16 units each. Characters, bytes and units give three different lengths, and a limit checked with the wrong one lets it through or cuts it.
    expected:
      outcome: unspecified
      reason: filename_too_long
