exifreader 4.48.0 → 4.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -14
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/exif-reader.d.ts +6 -6
- package/package.json +5 -5
- package/src/canon-tags.js +4 -3
- package/src/exif-reader.js +7 -1
- package/src/icc-tag-names.js +2 -11
- package/src/image-header-png.js +1 -6
- package/src/photoshop-tags.js +9 -1
- package/src/png-text-tags.js +6 -3
- package/src/tag-filter-config.js +23 -0
- package/src/tag-names-exif-ifd.js +32 -11
- package/src/tag-names-interoperability-ifd.js +2 -2
- package/src/tag-names-mpf-ifd.js +2 -2
- package/src/tag-names-utils.js +17 -3
- package/src/utils.js +36 -12
- package/src/xmp-tags.js +9 -6
package/README.md
CHANGED
|
@@ -202,20 +202,25 @@ come straight from the image and can contain arbitrary text, including HTML-like
|
|
|
202
202
|
markup. Never insert them into a page as HTML (for example through `innerHTML`)
|
|
203
203
|
without escaping or sanitizing them first, otherwise a crafted image could lead
|
|
204
204
|
to cross-site scripting. Use `textContent`, your framework's escaping, or a
|
|
205
|
-
sanitizer such as DOMPurify when displaying metadata.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
205
|
+
sanitizer such as DOMPurify when displaying metadata.
|
|
206
|
+
|
|
207
|
+
The property names inside a tag value come from the image too, and a tag whose
|
|
208
|
+
name is `__proto__` is kept under that name as a regular property, so it does
|
|
209
|
+
not replace the prototype of the object holding it. A tag whose name comes from
|
|
210
|
+
the image and is the name of an `Object.prototype` method, such as
|
|
211
|
+
`hasOwnProperty`, `toString` or `constructor`, is returned under that name with
|
|
212
|
+
`_` appended (`hasOwnProperty_`), so it does not hide the method on the result
|
|
213
|
+
object or on a group object, and `includeTags` and `excludeTags` match it by
|
|
214
|
+
that returned name. The same applies to the property names inside an XMP tag
|
|
215
|
+
value (structure members, members of list items and children of `rdf:value`)
|
|
216
|
+
and to the keys of an XMP tag's `attributes`. A value parsed from an XMP
|
|
217
|
+
`rdf:value` element that holds child elements other than a list is returned as
|
|
218
|
+
an object without a prototype. An XMP qualifier in `attributes` that holds
|
|
219
|
+
child elements is returned as its element tree, with the element and attribute
|
|
220
|
+
names unchanged and kept in objects without a prototype. Such an object has no
|
|
221
|
+
inherited methods, and copying it into an object of your own with
|
|
222
|
+
`Object.assign` or a deep merge helper without filtering the keys could let a
|
|
223
|
+
crafted image replace that object's prototype.
|
|
219
224
|
|
|
220
225
|
#### Grouping
|
|
221
226
|
|
|
@@ -490,6 +495,10 @@ Block `type` reuses the filtering-group vocabulary (`exif`, `iptc`, `xmp`,
|
|
|
490
495
|
`icc`, `mpf`, `jfif`, `file`, `png`, `riff`, `gif`), plus `mpfImage` for the
|
|
491
496
|
sub-images of an MPF Multi-Picture JPEG. The same type may appear more than
|
|
492
497
|
once (multi-chunk ICC, extended XMP), one entry per physical container.
|
|
498
|
+
ExifReader records at most 4,096 of the containers it finds while scanning
|
|
499
|
+
the file; in a file with more, the last one recorded keeps its own type and is
|
|
500
|
+
widened to cover all the rest, so `start`, `end` and the `0..end` slice still
|
|
501
|
+
cover every metadata byte. `mpfImage` blocks come on top of these.
|
|
493
502
|
|
|
494
503
|
Typical workflow:
|
|
495
504
|
|
|
@@ -664,6 +673,11 @@ import {DOMParser, onErrorStopParsing} from '@xmldom/xmldom';
|
|
|
664
673
|
const tags = ExifReader.load(fileBuffer, {domParser: new DOMParser({onError: onErrorStopParsing})});
|
|
665
674
|
```
|
|
666
675
|
|
|
676
|
+
Use `xmldom` 0.9.12 or later. ExifReader limits how deeply XMP elements can
|
|
677
|
+
nest and how many markup nodes a packet can have, and it checks those limits
|
|
678
|
+
the way `xmldom` 0.9 reads the markup. With 0.8, a crafted file can get past
|
|
679
|
+
them and make parsing slow.
|
|
680
|
+
|
|
667
681
|
The `onError` option is needed to avoid a [seemingly infinite loop for some
|
|
668
682
|
XMLs](https://github.com/xmldom/xmldom/issues/501). Unfortunately `linkedom` has
|
|
669
683
|
the same problem but does not have this option and will therefore get stuck on
|