Size boundaries
Is a size limit enforced exactly where it is declared?
The size-boundaries preset builds a whole set of real test files for this question in one
command, and a manifest.json beside them saying how your system should react to each
file. Everything below is read from the program, at the defaults of this version.
What does it usually find?
- off by one errors at the limit
- MB confused with MiB, which is 4.8 per cent and enough to let a file through that should not pass
- a limit enforced in the browser and not on the server
What is in the set?
At its defaults, as tfg preset show size-boundaries reports it:
| Files | 7 |
|---|---|
| Targets in its recipe | 7 |
| Total size | 73 400 320 B |
| Formats |
And what the manifest of that set expects from your system:
| Expected | Meaning | Files |
|---|---|---|
accept | Your system should take the file. | 4 |
reject | Your system should turn the file away. | 3 |
What can you change?
| Setting | Takes | Default | What it does |
|---|---|---|---|
--limit |
a size such as 2mb | 10mb |
The size limit your system declares. Everything else is measured from it. This default is our placeholder, not your system's value. Pass your own. |
--spread |
sizes separated by commas | 1B,1kb,1mb |
How far either side of the limit to reach, as a list of sizes. |
--format |
a format id from the formats page | pdf |
The format of every file in the set. It is a flag of the tool itself, and the preset only gives it a default. |
How do you run it?
See what the set would cost, build it, or take its recipe to edit:
tfg preset show size-boundaries
tfg generate --preset size-boundaries --limit 10mb --out ./size-boundaries
tfg preset eject size-boundaries > size-boundaries.yaml
Or build on it in a recipe of your own, next to your tests:
version: 1
extends: preset:size-boundaries
with:
limit: 10mb