exifreader 4.41.3 → 4.42.0
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 +20 -0
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/exif-reader.d.ts +36 -1
- package/package.json +7 -6
- package/src/icc-tags.js +5 -2
- package/src/xmp-tags.js +14 -6
package/README.md
CHANGED
|
@@ -184,6 +184,13 @@ Where `file` is one of
|
|
|
184
184
|
* URL (browser or Node.js; remember that in a browser context the remote server
|
|
185
185
|
has to set CORS headers that allow for remote loading of the file)
|
|
186
186
|
|
|
187
|
+
**Security:** When the argument is a string, ExifReader treats it as a URL or a
|
|
188
|
+
local file path and will make a network request or read from the file system.
|
|
189
|
+
Never pass an untrusted or user-controlled string to `load()`. Doing so lets an
|
|
190
|
+
attacker make the process fetch arbitrary URLs (server-side request forgery) or
|
|
191
|
+
open arbitrary local files. For untrusted image data, always pass the bytes
|
|
192
|
+
themselves (an `ArrayBuffer`, a `Buffer`, or a browser `File`), never a string.
|
|
193
|
+
|
|
187
194
|
**Tip:** To read metadata from an `HTMLImageElement`, wait for its `load` event
|
|
188
195
|
and call `ExifReader.load(image.src)`. The browser should reuse the cached file.
|
|
189
196
|
|
|
@@ -201,6 +208,14 @@ Where `fileBuffer` is one of
|
|
|
201
208
|
See the [examples site](https://mattiasw.github.io/ExifReader/) for more
|
|
202
209
|
directions on how to use the library.
|
|
203
210
|
|
|
211
|
+
**Security:** Treat all returned metadata as untrusted input. Tag values,
|
|
212
|
+
descriptions, and the raw XMP packet (`xmp._raw` when using `expanded: true`)
|
|
213
|
+
come straight from the image and can contain arbitrary text, including HTML-like
|
|
214
|
+
markup. Never insert them into a page as HTML (for example through `innerHTML`)
|
|
215
|
+
without escaping or sanitizing them first, otherwise a crafted image could lead
|
|
216
|
+
to cross-site scripting. Use `textContent`, your framework's escaping, or a
|
|
217
|
+
sanitizer such as DOMPurify when displaying metadata.
|
|
218
|
+
|
|
204
219
|
#### Grouping
|
|
205
220
|
|
|
206
221
|
By default, Exif, IPTC and XMP tags are grouped together. This means that if
|
|
@@ -357,6 +372,11 @@ know the metadata is located at the beginning of the file. Just be aware that
|
|
|
357
372
|
it's common for the metadata to be spread out over a larger area so please try
|
|
358
373
|
it out on your set of files to know if it's suitable for your situation.
|
|
359
374
|
|
|
375
|
+
One thing to look out for is ICC profiles, which are often large. If the profile
|
|
376
|
+
does not fit inside the part you read, no ICC tags are returned for it. Use
|
|
377
|
+
`length: 'auto'` (see below) if you need the ICC tags without picking a size
|
|
378
|
+
yourself.
|
|
379
|
+
|
|
360
380
|
Note that this option only works when ExifReader handles the loading of the
|
|
361
381
|
file. If e.g. an already loaded ArrayBuffer or Buffer is passed into ExifReader,
|
|
362
382
|
the whole file will already have been loaded into memory and it's too late.
|