mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-08 09:48:20 +01:00
fix(make-pdf): read local images only from the document's directory, and only image files (GST-1747) (#4113)
* fix(make-pdf): read local images only from the document's directory, and only image files (GST-1747) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(make-pdf): inline a local file only when its bytes match its image format A file with an image extension now needs that format's signature (or a recognized size header) before it is inlined; anything else gets the blocked placeholder, and --strict throws. The docx ICNS test now sees the local file blocked by the prepass and the inline data URI dropped by the docx guard. Review-Finding: p1/specialist-batched#1 reader=security Review-Finding: p1/specialist-batched#2 reader=testing Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(make-pdf): compare image paths with path.relative so a root-level document keeps its images A markdown file at the filesystem root made the containment prefix '//' (or 'C:\\'), which no path matched. Review-Finding: v1/adversarial-native#5 reader=adversarial-native Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ef99eb5a55
commit
0dbc60708e
7 files changed
+145
-33
No files matched your search
@@ -59,9 +59,11 @@ so a phone photo doesn't bloat the document.
|
||||
|
||||
Image safety defaults: remote (http/https) images are **blocked with a
|
||||
visible placeholder** unless you pass `--allow-network`. An image path that
|
||||
resolves outside the markdown's directory (even through a symlink) still
|
||||
inlines but warns loudly. Files over 64MB and non-regular files (fifos,
|
||||
devices) degrade to a placeholder instead of hanging the render.
|
||||
resolves outside the markdown's directory (even through a symlink) is never
|
||||
read: it renders as a visible placeholder with a warning. Only image files
|
||||
(png, jpeg, gif, webp, svg) inline; other files, files over 64MB and
|
||||
non-regular files (fifos, devices) degrade to a placeholder instead of
|
||||
hanging the render.
|
||||
|
||||
Per-image directives go immediately after the image:
|
||||
|
||||
@@ -130,9 +132,9 @@ make-pdf generate docs.md --strict
|
||||
```
|
||||
|
||||
Missing local images, blocked remote images, out-of-tree image reads (a path
|
||||
or symlink resolving outside the markdown's directory), oversized files
|
||||
(>64MB), and non-regular files all exit non-zero instead of degrading to a
|
||||
warning or placeholder — for docs pipelines where a broken image should
|
||||
or symlink resolving outside the markdown's directory), non-image files,
|
||||
oversized files (>64MB), and non-regular files all exit non-zero instead of
|
||||
degrading to a warning or placeholder — for docs pipelines where a broken image should
|
||||
break the build.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Reference in new issue
Block a user