File Upload Validation, Magic-Byte Security and Parser QA Testing Across 54 Formats: Questions and Answers
Engineering reference covering Technical Questions and Answers on magic-byte verification, boundary-size testing, corrupted-container error handling, and Playwright/Cypress/CI automation across all 54 sample file formats, how each format works at the byte level, how our deterministic generator builds and verifies them, and how to test them in QA pipelines.
Format hubs covered on this reference page
Part 1: Binary signatures, headers and specification rules
- 1. What is the most critical QA validation check when an application accepts user-uploaded .avro (Avro) files?
- Verify that the upload handler checks for the .avro signature (4F 62 6A 01), validates the structure using Apache Avro (Java/C++/Python), fastavro, PySpark, Confluent Schema Registry tools, and DuckDB, and confirms that altering the 16-byte sync marker at the end of a data block causes fastavro and Java Avro readers to raise an invalid sync marker exception is caught cleanly with an HTTP 400/422 error.
- 2. What is the most critical QA validation check when an application accepts user-uploaded .bin (BIN) files?
- Verify that the upload handler checks for the .bin signature (None), validates the structure using hexdump -C, xxd, Python memoryview/bytes, Node.js Buffer, and raw stream readers, and confirms that reading a binary .bin stream through a UTF-8 text decoder corrupts every byte >= 0x80 into U+FFFD replacement characters (EF BF BD) is caught cleanly with an HTTP 400/422 error.
- 3. What is the most critical QA validation check when an application accepts user-uploaded .bmp (BMP) files?
- Verify that the upload handler checks for the .bmp signature (42 4D), validates the structure using Pillow, ImageMagick, Windows GDI/WIC, SDL2, and OpenCV, and confirms that forgetting that BMP rows are padded to a multiple of 4 bytes when width * 3 is not divisible by 4 skews every scanline diagonally is caught cleanly with an HTTP 400/422 error.
- 4. What is the most critical QA validation check when an application accepts user-uploaded .css (CSS) files?
- Verify that the upload handler checks for the .css signature (UTF-8 text), validates the structure using PostCSS, LightningCSS, css-tree, esbuild, and browser CSSOM parsers, and confirms that serving a .css file with Content-Type: text/plain when X-Content-Type-Options: nosniff is active causes browsers to refuse to apply the stylesheet is caught cleanly with an HTTP 400/422 error.
- 5. What is the most critical QA validation check when an application accepts user-uploaded .csv (CSV) files?
- Verify that the upload handler checks for the .csv signature (UTF-8 text), validates the structure using Python csv and Pandas read_csv, PapaParse, Apache Commons CSV, DuckDB read_csv_auto, and PostgreSQL COPY, and confirms that an unclosed double quote on row N causes an RFC 4180 state machine to consume all subsequent rows into a single multi-line field until EOF is caught cleanly with an HTTP 400/422 error.
- 6. What is the most critical QA validation check when an application accepts user-uploaded .docx (DOCX) files?
- Verify that the upload handler checks for the .docx signature (50 4B 03 04), validates the structure using python-docx, Apache POI XWPF, Mammoth.js, LibreOffice Writer, and OpenXML SDK, and confirms that truncating the end of the file strips the ZIP End of Central Directory (50 4B 05 06), preventing OpenXML parsers from locating word/document.xml is caught cleanly with an HTTP 400/422 error.
- 7. What is the most critical QA validation check when an application accepts user-uploaded .eml (EML) files?
- Verify that the upload handler checks for the .eml signature (UTF-8 text), validates the structure using Python email.parser, Nodemailer/mailparser, Apache James Mime4j, Thunderbird, and Outlook, and confirms that omitting the blank CRLF separator line between headers and body causes parsers to treat the entire message body as malformed header lines is caught cleanly with an HTTP 400/422 error.
- 8. What is the most critical QA validation check when an application accepts user-uploaded .epub (EPUB) files?
- Verify that the upload handler checks for the .epub signature (50 4B 03 04), validates the structure using Readium, epub.js, Calibre, Apple Books, Foliate, and EPUBCheck, and confirms that placing META-INF/container.xml before the mimetype entry in the ZIP stream causes EPUBCheck error PKG-006 (mimetype must be first at offset 30) is caught cleanly with an HTTP 400/422 error.
- 9. What is the most critical QA validation check when an application accepts user-uploaded .flac (FLAC) files?
- Verify that the upload handler checks for the .flac signature (66 4C 61 43), validates the structure using libFLAC, metaflac, FFmpeg, Audacity, Mutagens, and browser HTMLAudioElement, and confirms that modifying audio frames without updating the 16-byte raw-PCM MD5 checksum in the STREAMINFO block causes flac -t verification to fail is caught cleanly with an HTTP 400/422 error.
- 10. What is the most critical QA validation check when an application accepts user-uploaded .geojson (GeoJSON) files?
- Verify that the upload handler checks for the .geojson signature (UTF-8 text), validates the structure using GDAL/OGR, Turf.js, GeoPandas, Mapbox GL / MapLibre, Leaflet, and Shapely, and confirms that swapping [longitude, latitude] to [latitude, longitude] plots points in the wrong hemisphere or ocean, and violating the RFC 7946 right-hand polygon winding rule breaks spatial clippers is caught cleanly with an HTTP 400/422 error.
- 11. What is the most critical QA validation check when an application accepts user-uploaded .gif (GIF) files?
- Verify that the upload handler checks for the .gif signature (47 49 46 38 39 61), validates the structure using giflib, Pillow, ImageMagick, Gifsicle, FFmpeg, and browser <img> renderers, and confirms that missing the final 0x3B semicolon trailer byte or corrupting an LZW sub-block length byte causes frame decoders to fail is caught cleanly with an HTTP 400/422 error.
- 12. What is the most critical QA validation check when an application accepts user-uploaded .gltf (glTF) files?
- Verify that the upload handler checks for the .gltf signature (UTF-8 text), validates the structure using Three.js GLTFLoader, Babylon.js, Blender, Khronos glTF-Validator, and CesiumJS, and confirms that miscalculating accessor byteOffset or byteLength against the decoded base64 buffer length triggers a BUFFER_VIEW_OUT_OF_BOUNDS error in glTF-Validator is caught cleanly with an HTTP 400/422 error.
- 13. What is the most critical QA validation check when an application accepts user-uploaded .gpx (GPX) files?
- Verify that the upload handler checks for the .gpx signature (UTF-8 text), validates the structure using gpxpy, GDAL, Strava/Garmin importers, QGIS, and GPSBabel, and confirms that omitting the lat and lon attributes on <trkpt> or mixing local timezones without a Z UTC suffix in <time> breaks pace and elevation gain calculations is caught cleanly with an HTTP 400/422 error.
- 14. What is the most critical QA validation check when an application accepts user-uploaded .gz (GZ) files?
- Verify that the upload handler checks for the .gz signature (1F 8B 08), validates the structure using GNU gzip/zcat, zlib, Python gzip, libdeflate, and browser DecompressionStream('gzip'), and confirms that relying on the trailing 4-byte ISIZE field for files over 4 GB (since ISIZE wraps modulo 2^32) is caught cleanly with an HTTP 400/422 error.
- 15. What is the most critical QA validation check when an application accepts user-uploaded .html (HTML) files?
- Verify that the upload handler checks for the .html signature (3C 21 44 4F 43 54 59 50 45), validates the structure using Browser HTML5 engines (Blink, Gecko, WebKit), BeautifulSoup4, lxml.html, Cheerio, and html5lib, and confirms that uploading unsanitized HTML to an endpoint that serves files without Content-Disposition: attachment allows stored XSS execution is caught cleanly with an HTTP 400/422 error.
- 16. What is the most critical QA validation check when an application accepts user-uploaded .ico (ICO) files?
- Verify that the upload handler checks for the .ico signature (00 00 01 00), validates the structure using Pillow, ImageMagick, browser favicon loaders, and Windows Shell icon extractors, and confirms that confusing type=1 (00 00 01 00 ICO icon) with type=2 (00 00 02 00 CUR cursor) in the 6-byte header is caught cleanly with an HTTP 400/422 error.
- 17. What is the most critical QA validation check when an application accepts user-uploaded .ics (iCalendar) files?
- Verify that the upload handler checks for the .ics signature (UTF-8 text), validates the structure using Python icalendar, ical.js, Apple Calendar, Google Calendar, and Microsoft Outlook, and confirms that omitting mandatory UID or DTSTAMP properties inside a VEVENT block causes strict CalDAV servers and Outlook to reject the calendar import is caught cleanly with an HTTP 400/422 error.
- 18. What is the most critical QA validation check when an application accepts user-uploaded .ini (INI) files?
- Verify that the upload handler checks for the .ini signature (UTF-8 text), validates the structure using Python configparser, PHP parse_ini_file, Windows GetPrivateProfileString, and systemd unit parsers, and confirms that placing key=value lines before the first [section] header causes Python's configparser to raise MissingSectionHeaderError is caught cleanly with an HTTP 400/422 error.
- 19. What is the most critical QA validation check when an application accepts user-uploaded .jpg (JPG) files?
- Verify that the upload handler checks for the .jpg signature (FF D8 FF), validates the structure using libjpeg-turbo, Pillow, MozJPEG, Sharp, ImageMagick, and browser HTMLImageElement, and confirms that truncating the stream before the final FF D9 End-of-Image marker leaves the bottom scanlines grey or causes strict decoders to reject the image is caught cleanly with an HTTP 400/422 error.
- 20. What is the most critical QA validation check when an application accepts user-uploaded .js (JavaScript) files?
- Verify that the upload handler checks for the .js signature (UTF-8 text), validates the structure using V8 / SpiderMonkey / JavaScriptCore, Acorn, Babel parser, Terser, esbuild, and SWC, and confirms that uploading .js files to a poorly configured static bucket without nosniff and attachment headers creates script-execution risks is caught cleanly with an HTTP 400/422 error.
- 21. What is the most critical QA validation check when an application accepts user-uploaded .json (JSON) files?
- Verify that the upload handler checks for the .json signature (UTF-8 text), validates the structure using V8 JSON.parse, Python json, Jackson (Java), serde_json (Rust), jq, and SIMDJSON, and confirms that trailing commas after the last property or single-quoted strings violate RFC 8259 and throw SyntaxError in standard JSON.parse is caught cleanly with an HTTP 400/422 error.
- 22. What is the most critical QA validation check when an application accepts user-uploaded .jsonl (JSONL) files?
- Verify that the upload handler checks for the .jsonl signature (UTF-8 text), validates the structure using jq -c, Pandas read_json(lines=True), DuckDB, Vector, Fluent Bit, and Node.js readline + JSON.parse, and confirms that pretty-printing an object across multiple lines breaks line-by-line streaming parsers that call JSON.parse on each individual line is caught cleanly with an HTTP 400/422 error.
- 23. What is the most critical QA validation check when an application accepts user-uploaded .kml (KML) files?
- Verify that the upload handler checks for the .kml signature (UTF-8 text), validates the structure using Google Earth, GDAL/OGR, QGIS, OpenLayers, and fastkml, and confirms that putting spaces after commas inside a KML <coordinates>lon,lat,alt</coordinates> tuple causes strict KML parsers to split a single coordinate into three broken tokens is caught cleanly with an HTTP 400/422 error.
- 24. What is the most critical QA validation check when an application accepts user-uploaded .log (LOG) files?
- Verify that the upload handler checks for the .log signature (UTF-8 text), validates the structure using Logstash, Fluentd, Vector, GoAccess, grep/awk, and Grafana Loki, and confirms that multiline stack traces mixed into single-line access logs break regex line parsers unless multiline aggregation rules are configured is caught cleanly with an HTTP 400/422 error.
- 25. What is the most critical QA validation check when an application accepts user-uploaded .m4a (M4A) files?
- Verify that the upload handler checks for the .m4a signature (66 74 79 70 4D 34 41 20 at byte offset 4), validates the structure using FFmpeg, Apple CoreAudio, Mutagen, GPAC, and HTML5 <audio> elements, and confirms that confusing MP4-wrapped .m4a files (ftypM4A ) with raw ADTS .aac streams (FF F1) is caught cleanly with an HTTP 400/422 error.
Part 2: Internal container layout, padding and byte structure
- 1. What is the most critical QA validation check when an application accepts user-uploaded .md (Markdown) files?
- Verify that the upload handler checks for the .md signature (UTF-8 text), validates the structure using unified/remark, markdown-it, marked, Goldmark (Go), Pulldown-CMark (Rust), and Pandoc, and confirms that leaving an unclosed triple-backtick code fence causes downstream sections to be swallowed into a single <pre><code> node is caught cleanly with an HTTP 400/422 error.
- 2. What is the most critical QA validation check when an application accepts user-uploaded .mkv (MKV) files?
- Verify that the upload handler checks for the .mkv signature (1A 45 DF A3), validates the structure using MKVToolNix (mkvmerge/mkvinfo), FFmpeg, VLC, MPV, and MediaInfo, and confirms that assuming every 1A 45 DF A3 file is WebM without reading the EBML DocType string ('matroska' vs. 'webm') is caught cleanly with an HTTP 400/422 error.
- 3. What is the most critical QA validation check when an application accepts user-uploaded .mov (MOV) files?
- Verify that the upload handler checks for the .mov signature (66 74 79 70 71 74 20 20 at byte offset 4), validates the structure using Apple QuickTime / AVFoundation, FFmpeg, MediaInfo, and DaVinci Resolve / Premiere, and confirms that uploading a QuickTime .mov recorded on iOS without checking whether the inner video track is H.264 (avc1) or HEVC (hvc1) is caught cleanly with an HTTP 400/422 error.
- 4. What is the most critical QA validation check when an application accepts user-uploaded .mp3 (MP3) files?
- Verify that the upload handler checks for the .mp3 signature (49 44 33), validates the structure using libmpg123, LAME, FFmpeg, Mutagen, MediaInfo, and browser Web Audio / <audio>, and confirms that rejecting valid MP3 uploads because the file starts with 49 44 33 ('ID3') instead of a bare FF FB MPEG frame sync word is caught cleanly with an HTTP 400/422 error.
- 5. What is the most critical QA validation check when an application accepts user-uploaded .mp4 (MP4) files?
- Verify that the upload handler checks for the .mp4 signature (66 74 79 70 at byte offset 4), validates the structure using FFmpeg/ffprobe, GPAC MP4Box, Bento4, MediaInfo, Shaka Packager, and browser HTMLVideoElement, and confirms that truncating an MP4 file whose moov box sits at the end of the file leaves the mdat frames unindexed and unplayable is caught cleanly with an HTTP 400/422 error.
- 6. What is the most critical QA validation check when an application accepts user-uploaded .obj (OBJ) files?
- Verify that the upload handler checks for the .obj signature (UTF-8 text), validates the structure using Three.js OBJLoader, Blender, Assimp, MeshLab, and PyWavefront, and confirms that using 0-based indices instead of Wavefront's mandatory 1-based vertex indexing shifts every triangle face or crashes the mesh loader is caught cleanly with an HTTP 400/422 error.
- 7. What is the most critical QA validation check when an application accepts user-uploaded .ods (ODS) files?
- Verify that the upload handler checks for the .ods signature (50 4B 03 04), validates the structure using LibreOffice Calc, Pandas (odf engine), pyexcel-ods, and Collabora Online, and confirms that omitting office:value-type='float' on numeric cells causes formulas to treat cell contents as zero-valued text strings is caught cleanly with an HTTP 400/422 error.
- 8. What is the most critical QA validation check when an application accepts user-uploaded .odt (ODT) files?
- Verify that the upload handler checks for the .odt signature (50 4B 03 04), validates the structure using LibreOffice Writer, odfpy, Collabora Online, Pandoc, and Apache ODF Toolkit, and confirms that compressing the first mimetype entry with DEFLATE violates the OASIS ODF packaging rule requiring magic-byte sniffers to read the MIME string at offset 38 in plain ASCII is caught cleanly with an HTTP 400/422 error.
- 9. What is the most critical QA validation check when an application accepts user-uploaded .pdf (PDF) files?
- Verify that the upload handler checks for the .pdf signature (25 50 44 46 2D), validates the structure using PDFium, Mozilla pdf.js, Poppler pdftotext, pypdf, qpdf, and MuPDF, and confirms that cutting off the final 64 bytes removes the startxref pointer and %%EOF marker, forcing viewers to attempt a full linear object scan is caught cleanly with an HTTP 400/422 error.
- 10. What is the most critical QA validation check when an application accepts user-uploaded .png (PNG) files?
- Verify that the upload handler checks for the .png signature (89 50 4E 47 0D 0A 1A 0A), validates the structure using libpng, Pillow, Sharp, oxipng, pngcheck, and browser Canvas/Image decoders, and confirms that altering a single byte in IHDR or tEXt without updating its 4-byte big-endian CRC-32 causes libpng and browsers to abort decoding with a CRC error is caught cleanly with an HTTP 400/422 error.
- 11. What is the most critical QA validation check when an application accepts user-uploaded .pptx (PPTX) files?
- Verify that the upload handler checks for the .pptx signature (50 4B 03 04), validates the structure using python-pptx, Apache POI XSLF, LibreOffice Impress, and Google Slides importer, and confirms that missing relationship entries in ppt/slides/_rels/slide1.xml.rels breaks embedded image and layout references when opened in PowerPoint is caught cleanly with an HTTP 400/422 error.
- 12. What is the most critical QA validation check when an application accepts user-uploaded .rtf (RTF) files?
- Verify that the upload handler checks for the .rtf signature (7B 5C 72 74 66 31), validates the structure using LibreOffice Writer, Microsoft Word, unrtf, Pandoc, and macOS TextEdit, and confirms that dropping the final closing curly brace } leaves the root \rtf1 group unclosed, causing strict RTF readers to report an unexpected end of file is caught cleanly with an HTTP 400/422 error.
- 13. What is the most critical QA validation check when an application accepts user-uploaded .sql (SQL) files?
- Verify that the upload handler checks for the .sql signature (UTF-8 text), validates the structure using sqlite3, psql (PostgreSQL), mysql CLI, sqlparse, sqlglot, and Flyway / Liquibase, and confirms that unescaped single quotes inside a SQL string literal break statement parsing and expose SQL injection vulnerabilities in naive string builders is caught cleanly with an HTTP 400/422 error.
- 14. What is the most critical QA validation check when an application accepts user-uploaded .srt (SRT) files?
- Verify that the upload handler checks for the .srt signature (UTF-8 text), validates the structure using FFmpeg, VLC, Video.js, pysrt, and YouTube/Vimeo caption uploaders, and confirms that using a period instead of a comma before milliseconds (00:00:01.500 instead of 00:00:01,500) causes strict SubRip parsers to reject the timestamp line is caught cleanly with an HTTP 400/422 error.
- 15. What is the most critical QA validation check when an application accepts user-uploaded .stl (STL) files?
- Verify that the upload handler checks for the .stl signature (73 6F 6C 69 64), validates the structure using Three.js STLLoader, Blender, PrusaSlicer, Cura, MeshLab, and numpy-stl, and confirms that assuming any STL file starting with the 5 ASCII letters 'solid' is an ASCII STL file, when many binary STL exporters write 'solid' in their 80-byte binary header (always check if 84 + uint32_at_80 * 50 == file_size) is caught cleanly with an HTTP 400/422 error.
- 16. What is the most critical QA validation check when an application accepts user-uploaded .svg (SVG) files?
- Verify that the upload handler checks for the .svg signature (3C 73 76 67), validates the structure using Browser SVG DOM, librsvg, resvg, Inkscape, SVGO, and CairoSVG, and confirms that omitting the xmlns="http://www.w3.org/2000/svg" namespace attribute causes browsers opening the file directly to display raw XML text instead of rendering the graphic is caught cleanly with an HTTP 400/422 error.
- 17. What is the most critical QA validation check when an application accepts user-uploaded .tar (TAR) files?
- Verify that the upload handler checks for the .tar signature (75 73 74 61 72 at byte offset 257), validates the structure using GNU tar, bsdtar (libarchive), Python tarfile, and node-tar, and confirms that checking offset 0 for magic bytes instead of offset 257 ('ustar'), or failing to validate octal header checksums is caught cleanly with an HTTP 400/422 error.
- 18. What is the most critical QA validation check when an application accepts user-uploaded .tiff (TIFF) files?
- Verify that the upload handler checks for the .tiff signature (49 49 2A 00), validates the structure using libtiff, Pillow, tifffile, GDAL, ImageMagick, and Apple Preview, and confirms that hardcoding little-endian integer reads in a parser causes it to fail on big-endian (4D 4D 00 2A) TIFF files produced by macOS and high-end scanners is caught cleanly with an HTTP 400/422 error.
- 19. What is the most critical QA validation check when an application accepts user-uploaded .toml (TOML) files?
- Verify that the upload handler checks for the .toml signature (UTF-8 text), validates the structure using Python tomllib (3.11+), toml-rs (Rust Cargo), Go pelletier/go-toml, and Taplo, and confirms that redefining the same [table] header twice or mixing data types in an inline array (in TOML v0.4 parsers) fails validation is caught cleanly with an HTTP 400/422 error.
- 20. What is the most critical QA validation check when an application accepts user-uploaded .tsv (TSV) files?
- Verify that the upload handler checks for the .tsv signature (UTF-8 text), validates the structure using Python csv(delimiter='\t'), Pandas read_csv(sep='\t'), Miller (mlr), awk -F'\t', and DuckDB, and confirms that untrimmed literal tab characters inside a free-text field shift all subsequent column values one column to the right is caught cleanly with an HTTP 400/422 error.
- 21. What is the most critical QA validation check when an application accepts user-uploaded .txt (TXT) files?
- Verify that the upload handler checks for the .txt signature (None), validates the structure using POSIX cat/grep/awk, Python io.TextIOWrapper, Node.js fs.createReadStream, and browser TextDecoder, and confirms that injecting invalid UTF-8 continuation bytes (0xFF, 0xFE, or lone surrogates) triggers UnicodeDecodeError in strict UTF-8 readers is caught cleanly with an HTTP 400/422 error.
- 22. What is the most critical QA validation check when an application accepts user-uploaded .vtt (WebVTT) files?
- Verify that the upload handler checks for the .vtt signature (57 45 42 56 54 54), validates the structure using Browser HTMLTrackElement (<track kind="captions">), Video.js, hls.js, shaka-player, and FFmpeg, and confirms that missing the leading WEBVTT header on line 1 or prepending a non-UTF-8 encoding causes HTML5 <track> elements to discard the entire subtitle track silently is caught cleanly with an HTTP 400/422 error.
- 23. What is the most critical QA validation check when an application accepts user-uploaded .wav (WAV) files?
- Verify that the upload handler checks for the .wav signature (52 49 46 46 ?? ?? ?? ?? 57 41 56 45), validates the structure using Python wave/scipy.io.wavfile, libsndfile, FFmpeg, Audacity, SoX, and Web Audio decodeAudioData, and confirms that exceeding 4,294,967,295 bytes overflows the unsigned 32-bit RIFF chunk size field (requiring RF64 or Sony Wave64 .w64) is caught cleanly with an HTTP 400/422 error.
- 24. What is the most critical QA validation check when an application accepts user-uploaded .webm (WebM) files?
- Verify that the upload handler checks for the .webm signature (1A 45 DF A3), validates the structure using FFmpeg, libvpx, mkvinfo (MKVToolNix), MediaInfo, and browser HTML5 <video>/MediaSource, and confirms that serving a .webm file with an incompatible audio codec (such as AAC instead of Vorbis/Opus) violates the WebM container specification is caught cleanly with an HTTP 400/422 error.
- 25. What is the most critical QA validation check when an application accepts user-uploaded .webp (WebP) files?
- Verify that the upload handler checks for the .webp signature (52 49 46 46 ?? ?? ?? ?? 57 45 42 50), validates the structure using libwebp, Pillow, Sharp, ImageMagick, FFmpeg, and modern web browsers, and confirms that leaving the 32-bit RIFF payload size at bytes 4–7 inconsistent with the actual file length causes strict RIFF demuxers to reject the file is caught cleanly with an HTTP 400/422 error.
Part 3: In-browser generation, streaming and SHA-256 checksums
- 1. What is the most critical QA validation check when an application accepts user-uploaded .xlsx (XLSX) files?
- Verify that the upload handler checks for the .xlsx signature (50 4B 03 04), validates the structure using openpyxl, SheetJS (xlsx), Apache POI XSSF, Pandas read_excel, Calamine (Rust), and ExcelJS, and confirms that mismatching a cell's t='s' shared-string index against the count of <si> items in xl/sharedStrings.xml causes spreadsheet readers to throw an index-out-of-bounds error is caught cleanly with an HTTP 400/422 error.
- 2. What is the most critical QA validation check when an application accepts user-uploaded .xml (XML) files?
- Verify that the upload handler checks for the .xml signature (3C 3F 78 6D 6C), validates the structure using libxml2, Python xml.etree.ElementTree and lxml, Java SAX/DOM/StAX, and browser DOMParser, and confirms that including an unescaped ampersand (&) or left angle bracket (<) inside element text immediately halts W3C-compliant XML parsers with a fatal well-formedness error is caught cleanly with an HTTP 400/422 error.
- 3. What is the most critical QA validation check when an application accepts user-uploaded .yaml (YAML) files?
- Verify that the upload handler checks for the .yaml signature (UTF-8 text), validates the structure using PyYAML (safe_load), ruamel.yaml, js-yaml, Go gopkg.in/yaml.v3, and yq, and confirms that mixing tab characters (0x09) with spaces in indentation or leaving colons unquoted inside strings triggers a YAML scanner error is caught cleanly with an HTTP 400/422 error.
- 4. What is the most critical QA validation check when an application accepts user-uploaded .zip (ZIP) files?
- Verify that the upload handler checks for the .zip signature (50 4B 03 04), validates the structure using Python zipfile, Info-ZIP unzip, 7-Zip, libarchive, JSZip, and fflate, and confirms that corrupting payload bytes so the computed CRC-32 disagrees with the header (tested by our zip-corrupted-crc fixture) or Zip Slip '../' path traversal is caught cleanly with an HTTP 400/422 error.
- 5. How do I write a comprehensive file-upload test plan covering boundary sizes?
- Test five size tiers for every allowed format: 0 bytes (empty-file.txt), minimum valid header size, 1 byte below your max limit, exact max limit (for example 10,485,760 bytes for 10 MB), and 1 byte above your max limit (asserting HTTP 413 Payload Too Large).
- 6. Why should upload validators check both the leading magic bytes and the trailing EOF marker on PDF, PNG, JPEG, and Parquet files?
- Formats like PDF (%%EOF), PNG (IEND), JPEG (FF D9), ZIP (EOCD 50 4B 05 06), and Parquet (trailing PAR1) place critical index or trailer markers at the very end of the file; checking only offset 0 misses truncated uploads.
- 7. How do I test whether my backend is vulnerable to MIME-sniffing XSS attacks?
- Upload wrong-mime-html-in-csv.csv from /broken-files/ and request the uploaded file URL directly in a browser; confirm your server returns X-Content-Type-Options: nosniff and Content-Disposition: attachment.
- 8. How do I test extension spoofing filters with real binary files?
- Upload wrong-extension-png-as-jpg.jpg from /broken-files/, which has a .jpg extension but starts with PNG magic bytes (89 50 4E 47 0D 0A 1A 0A), and verify your backend detects the mismatch.
- 9. What is the safest way to test antivirus and executable upload blockers without using EICAR or live malware?
- Use the Inert Stub Generator on /generator/#inert-stubs to build a non-executable .exe (MZ header) or .iso (CD001 header) stub in your browser and verify your upload endpoint rejects it.
- 10. How do I test UTF-8 decoder resilience against invalid byte sequences?
- Feed malformed-utf8-sequences.txt from /broken-files/ (which contains overlong 0xC0 0xAF encodings, lone surrogates, and 0xFF 0xFE bytes) into your text importer and verify it rejects or replaces invalid sequences without crashing.
- 11. How do I test CSV importers against RFC 4180 quoting bugs?
- Import sample-csv-quoted-fields.csv (/files/csv-quoted-fields/) and unclosed-quotes-malformed.csv (/broken-files/) to verify that valid multiline quoted fields succeed while unclosed quotes return a clean line-number error.
- 12. How do I test CSV spreadsheet exports against Formula Injection (CSV Injection)?
- Include test cells starting with '=', '+', '-', '@', '\t', and '\r' and verify that your exporter prefixes them with a single quote or tab so Excel and LibreOffice Calc do not execute them as formulas.
- 13. How do I test image thumbnail generators against smartphone EXIF rotation bugs?
- Upload all 8 files from image-exif-orientation-1.jpg through image-exif-orientation-8.jpg on /media-edge-cases/ and verify that your resizer applies EXIF tag 0x0112 before stripping metadata.
- 14. Why do 4-channel CMYK JPEGs break some web image resizers?
- Browsers and basic sRGB pipelines expect 3-channel YCbCr/RGB JPEGs; uploading image-cmyk-color.jpg (/media-edge-cases/) verifies that your image worker converts CMYK to sRGB instead of inverting colors.
- 15. Why do odd-dimension images and videos (like 333x197) crash H.264 yuv420p transcoders?
- YUV 4:2:0 chroma subsampling groups pixels into 2x2 blocks, requiring even width and height; testing with image-odd-dimensions-333x197.jpg and video-odd-dimensions-333x197.mp4 confirms your FFmpeg pipeline scales or pads odd dimensions.
- 16. How do I test video players and transcoders against smartphone portrait rotation?
- Upload video-rotated-90deg.mp4 (/media-edge-cases/), which stores landscape frames with a 90-degree rotation matrix in its tkhd box, and confirm your transcoder outputs upright video.
- 17. How do I test video ingestion workers against Variable Frame Rate (VFR) audio drift?
- Use video-vfr-variable-framerate.mp4 (/media-edge-cases/) to confirm your pipeline preserves presentation timestamps (PTS) or normalizes to constant frame rate (CFR) without losing audio sync.
- 18. How do I test multi-track audio and subtitle extraction in media pipelines?
- Ingest video-dual-audio-tracks.mp4 (2 AAC tracks: eng and fra) and video-embedded-subtitles.mkv (muxed SRT track) from /media-edge-cases/ and assert that ffprobe/ffmpeg maps all streams accurately.
- 19. How do I test XML parsers against XML External Entity (XXE) vulnerabilities?
- Configure your XML parser with resolve_entities=False / FEATURE_SECURE_PROCESSING and verify that DOCTYPE SYSTEM/PUBLIC external entity declarations are rejected before parsing sample-product-catalog.xml.
- 20. How do I test archive extractors against Zip Slip path traversal?
- Verify that your unzip/untar wrapper resolves every entry's target path with path.resolve() and rejects any entry containing '../', leading '/', or Windows drive letters before writing to disk.
- 21. How do I test archive extractors against CRC-32 corruption?
- Pass sample-zip-corrupted.zip (/files/zip-corrupted-crc/) to your archive extractor and assert that it catches the CRC-32 mismatch and aborts extraction cleanly.
- 22. How do I test PDF processors against encrypted or password-locked uploads?
- Upload sample-pdf-password-protected.pdf (/files/pdf-password-protected/, password: 'sample') and verify your backend prompts the user or returns a specific 'password-protected document' error rather than a generic 500 error.
- 23. How do I test PDF form-field extraction and flattening?
- Use sample-pdf-form-fields.pdf (/files/pdf-form-fields/), which contains 7 AcroForm fields, to test field enumeration, value population, and form flattening.
- 24. How do I test filename handling with spaces, Unicode scripts, and 120-character names?
- Upload sample file name with spaces.txt, sample-ünïcödé-文件-имя.txt, and the 120-character sample-long-file-name fixture from /files/ to verify S3 key encoding, database VARCHAR limits, and Content-Disposition headers.
- 25. How do I test upload handlers when a file has no extension at all?
- Upload sample-file-without-extension (/files/sample-file-without-extension/) to verify how your backend behaves when path.extname(filename) returns an empty string.
Part 4: Parser libraries, edge cases and automated QA testing
- 1. How do I test multipart/form-data uploads with multiple files in a single HTTP request?
- In Playwright, pass an array of fixture paths—such as ['sample-pdf-10kb.pdf', 'sample-png-10kb.png']—to locator.setInputFiles() on an <input type='file' multiple> element.
- 2. How do I test drag-and-drop file upload zones in automated browser tests?
- Construct a DataTransfer object in page.evaluate(), attach a File built from a fetched fixture ArrayBuffer, and dispatch dragenter, dragover, and drop events on the dropzone element.
- 3. How do I test HTTP 206 Partial Content and Range requests on static file servers?
- Send curl -H 'Range: bytes=0-1023' -I against a hosted fixture or use sample-parquet-sales-100.parquet to verify that the server returns HTTP 206 Partial Content with Content-Range and Accept-Ranges: bytes.
- 4. How do I test resumable chunked uploads (such as Tus.io or S3 CreateMultipartUpload)?
- Use a 20 MB or 50 MB .bin or .mp4 sample, slice it into 5 MB Blobs (S3's minimum part size), interrupt part 3 to simulate a dropped connection, and verify that resuming uploads only the missing parts and matches the full SHA-256 hash.
- 5. Why should automated download tests always verify both Content-Length and SHA-256?
- A server bug that renders an HTML error page with HTTP 200 OK can still trigger a browser download event; asserting the exact byte count and SHA-256 hash proves the downloaded file is genuine.
- 6. How do I verify downloaded files in Playwright using Node's crypto module?
- Await page.waitForEvent('download'), call await download.createReadStream(), pipe the stream through crypto.createHash('sha256'), and assert that the hex digest matches the published value in /files.json.
- 7. How do I test database bulk loaders across 100-row and 1,000-row datasets?
- Download the matching Sales, Employee, or Weather files from /datasets/ in CSV, TSV, JSON, JSONL, XLSX, and Parquet, import each format into your database, and assert that SELECT COUNT(*) and SUM(total_usd) return identical results.
- 8. How do I test SQLite database file uploads and schema introspection?
- Upload sample-sqlite-company.sqlite (/formats/sqlite/), run PRAGMA quick_check; in read-only mode, and verify the 4 rows in departments and 50 rows in records.
- 9. How do I test WebAssembly module loading and CSP wasm-unsafe-eval policies?
- Fetch sample.wasm (/formats/code-source-bytecode/#wasm), call WebAssembly.instantiate(bytes), and assert that instance.exports.add(20, 22) returns 42.
- 10. How do I test @font-face loading and OpenType Sanitizer validation?
- Serve sample-font-web.woff2 (/formats/woff2/) and sample-font-regular.ttf (/formats/ttf/) with Access-Control-Allow-Origin: * and verify document.fonts.ready resolves without OTS console errors.
- 11. How do I test vCard contact book batch imports?
- Import sample-contacts-single.vcf (1 contact) and sample-contacts-directory-25.vcf (25 contacts) from /formats/vcf/ to confirm your CRM imports all 25 vCard blocks.
- 12. How do I test 7-Zip archive signature and header CRC validation?
- Pass sample-archive-7z.7z (/formats/7z/) to your archive validator and verify that it checks both the 6-byte 37 7A BC AF 27 1C magic header and the 32-bit StartHeader CRC at bytes 8–11.
- 13. How do I test Ogg Opus vs. Ogg Vorbis stream differentiation?
- Feed sample-opus-48khz.opus (/formats/opus/) and sample-ogg-stereo.ogg (/formats/ogg/) into your media inspector and confirm it inspects byte 28 ('OpusHead' vs. Vorbis/FLAC header) after matching 'OggS' at byte 0.
- 14. How do I test ADTS AAC vs. M4A container routing?
- Compare sample-aac-44khz-stereo.aac (starting with FF F1 ADTS syncword) against sample-m4a-100kb.m4a (starting with ftypM4A at offset 4) in your audio ingestion worker.
- 15. How do I test legacy Office OLE2 (.doc, .xls, .ppt) vs. OpenXML (.docx, .xlsx, .pptx) routing?
- Use sample.doc, sample.xls, and sample.ppt from /formats/document-office-ebook-legacy/ (which start with D0 CF 11 E0 A1 B1 1A E1) alongside .docx/.xlsx/.pptx (which start with 50 4B 03 04) to verify your converter routes each family to the right parser.
- 16. How do I test slow-network timeouts (Slowloris / throttled mobile 3G) on file uploads?
- Use Chrome DevTools Network throttling or Playwright CDPSession('Network.emulateNetworkConditions') with a 5 MB sample file to confirm your upload progress bar and server request timeout behave gracefully.
- 17. How do I test frontend error states when an upload API returns HTTP 400 or 422?
- Fetch /mock-data/errors-400.json in your frontend test harness to verify that field-level magic-byte mismatch errors render clearly to the user.
- 18. How do I test image alpha-channel preservation during WebP and PNG thumbnailing?
- Upload image-alpha-transparency.png and image-alpha-transparency.webp from /media-edge-cases/ and sample pixels in the output corners to confirm transparency is preserved rather than filled with black.
- 19. How do I test 16-bit-per-channel PNG downsampling to 8-bit sRGB?
- Upload image-16bit-channel.png (/media-edge-cases/) and verify that your image processor shifts 16-bit values (0..65535) to 8-bit values (0..255) smoothly without integer overflow banding.
- 20. How do I test progressive JPEG rendering andSOF2 marker detection?
- Use image-progressive-scan.jpg (/media-edge-cases/), which uses the progressive DCT SOF2 marker (FF C2) instead of baseline SOF0 (FF C0).
- 21. How do I test multi-sheet Excel workbook imports?
- Upload sample-xlsx-multiple-sheets.xlsx (/files/xlsx-multiple-sheets/) and verify that your importer either reads all worksheet tabs or prompts the user to select a target sheet.
- 22. How do I test multi-page PDF page-splitting and thumbnail workers?
- Use sample-pdf-10-pages.pdf (/files/pdf-10-pages/) and sample-business-report.pdf (/files/sample-business-report-pdf/) to verify page-count detection and per-page image rendering.
- 23. How do I test email attachment extraction on multipart MIME messages?
- Parse sample-multipart-attachment.eml (/files/sample-multipart-email-eml/) and verify that your MIME parser extracts both the text/plain body and the attached file payload.
- 24. How do I test CRLF vs. LF line-ending preservation in text processors?
- Compare sample-text-crlf-line-endings.txt (/files/sample-text-crlf-line-endings/) against LF-terminated files to confirm whether your storage pipeline normalizes or preserves 0x0D 0x0A sequences.
- 25. Where can I inspect any test file's magic bytes and SHA-256 hash before adding it to my test suite?
- Open /inspector/ in your browser and drop the file onto the page to inspect its first 64 bytes in hex and ASCII and compute its SHA-256 digest locally.
Explore more topic-based technical format references
Browse all 20 deep-dive Q&A guides on Testing guides or Frequently asked questions.