fix(pdf): link URIs as ASCII hex (readable by poppler), PNG budget walks the chunk list (second IHDR and APNG refused)
This commit is contained in:
1 parent
dfd04e0bd7
commit
3a26c61119
4 files changed
+215
-49
No files matched your search
+14
-7
@@ -162,7 +162,7 @@ Two operations are distinct:
|
||||
| snapshot document | ≤ 64 views, ≤ 1,024 annotations, ≤ 8,192 finding nodes, depth ≤ 8, names ≤ 512 chars |
|
||||
| branding | PNG base64 ≤ 512 KiB, SVG ≤ 256 KiB, http(s) URLs ≤ 2,048 chars |
|
||||
| branding URL | `http(s)://` then printable ASCII only, without `"` `'` `(` `)` `<` `>` `\`, no space or control character |
|
||||
| branding PNG | valid signature and IHDR, each side ≤ 8,192 px, ≤ 16,777,216 px (4096²) |
|
||||
| branding PNG | valid signature, one IHDR (13 bytes) first, no second IHDR or APNG chunk (`acTL`, `fcTL`, `fdAT`), no chunk past the buffer, each side ≤ 8,192 px, ≤ 16,777,216 px (4096²) |
|
||||
| report at export | ≤ 500 observations, ≤ 8 views per observation |
|
||||
| SVG sanitiser | ≤ 20,000 elements, nesting ≤ 64, ≤ 256 `<use>`, blur `stdDeviation` ≤ 100 |
|
||||
|
||||
@@ -185,9 +185,14 @@ link action: pdf-lib does not escape a literal string, so the engine writes
|
||||
the URI as a hex string and the schema refuses the characters that could
|
||||
close a literal. The export re-validates the branding and the labels it
|
||||
receives (`ArchiveExportError('branding_invalid')` before any page is
|
||||
drawn), even from an archive that passed the reader. A PNG logo whose header
|
||||
is missing, wrong or over the pixel budget is never decoded: that slot alone
|
||||
prints its fallback text and the export reports `logo_failed`.
|
||||
drawn), even from an archive that passed the reader. The URI itself is the
|
||||
hex form of the URL's ASCII bytes (`<68747470…>`), not UTF-16 with a BOM,
|
||||
so readers that take `/URI` as raw bytes (poppler) follow it. A PNG logo is
|
||||
checked before decoding: the signature and a first 13-byte IHDR, then the
|
||||
chunk list is walked to `IEND`; a second IHDR (the decoder would size its
|
||||
buffer from the last one), an APNG chunk, a chunk length past the end of
|
||||
the buffer or a header over the pixel budget refuses the slot. That slot
|
||||
alone prints its fallback text and the export reports `logo_failed`.
|
||||
|
||||
### Known limits
|
||||
|
||||
@@ -196,9 +201,11 @@ prints its fallback text and the export reports `logo_failed`.
|
||||
attachment is even looked at. The 50 MiB file cap bounds the input, not
|
||||
the expansion. Mitigation planned: parse in a Worker, or locate the
|
||||
attachment without a full load.
|
||||
- `<use>` expansion is bounded by the rasterizer (resvg refuses an
|
||||
oversized tree), not by the sanitiser, which only counts the `<use>`
|
||||
elements (≤ 256).
|
||||
- `<use>` expansion is bounded by the rasterizer, not by the sanitiser,
|
||||
which only counts the `<use>` elements (≤ 256). resvg (tests) refuses an
|
||||
oversized tree; the production path is the browser rasterizer
|
||||
(`apps/app/src/pdf/browserRasterizer.ts`, `Image` + canvas), whose
|
||||
limits on `<use>` expansion are not measured.
|
||||
- Report v3 collections are not capped on read; the export refuses above
|
||||
500 observations and 8 views per observation.
|
||||
|
||||
|
||||
Reference in new issue
Block a user