tar 7.5.9 → 7.5.11
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 +60 -0
- package/dist/commonjs/index.min.js +2 -2
- package/dist/commonjs/index.min.js.map +3 -3
- package/dist/commonjs/strip-absolute-path.d.ts +1 -1
- package/dist/commonjs/strip-absolute-path.d.ts.map +1 -1
- package/dist/commonjs/strip-absolute-path.js.map +1 -1
- package/dist/commonjs/unpack.js +4 -4
- package/dist/commonjs/unpack.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/index.min.js.map +3 -3
- package/dist/esm/strip-absolute-path.d.ts +1 -1
- package/dist/esm/strip-absolute-path.d.ts.map +1 -1
- package/dist/esm/strip-absolute-path.js.map +1 -1
- package/dist/esm/unpack.js +4 -4
- package/dist/esm/unpack.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -7,6 +7,66 @@ If you are familiar with how tar works, most of this will hopefully be
|
|
|
7
7
|
straightforward for you. If not, then hopefully this module can teach
|
|
8
8
|
you useful unix skills that may come in handy someday :)
|
|
9
9
|
|
|
10
|
+
## Security Information
|
|
11
|
+
|
|
12
|
+
Significant efforts have been taken to harden this library
|
|
13
|
+
against a wide variety of filesystem based attacks, especially as
|
|
14
|
+
it is used to unpack packages that are published by unknown
|
|
15
|
+
agents to [the npm registry](https://npmjs.com/).
|
|
16
|
+
|
|
17
|
+
A brief overview of some of the hardening that has gone into this
|
|
18
|
+
implementation. (Note that most of these are disabled if
|
|
19
|
+
`preservePaths: true` is set in the options.)
|
|
20
|
+
|
|
21
|
+
- Paths that attempt to walk up outside of the extraction target
|
|
22
|
+
are ignored, and a warning is raised.
|
|
23
|
+
- `Link` and `SymbolicLink` entries are not allowed to target
|
|
24
|
+
locations outside of the extraction folder.
|
|
25
|
+
- Extraction is not allowed through a symbolic link that appears
|
|
26
|
+
within the extraction target.
|
|
27
|
+
- Absolute paths are turned into relative paths underneath the
|
|
28
|
+
extraction target.
|
|
29
|
+
- Character Device, Block Device, and FIFO entries are never
|
|
30
|
+
extracted.
|
|
31
|
+
- File and directory ownership is not mutated unless `forceChown`
|
|
32
|
+
is set, or the extraction is run as root.
|
|
33
|
+
- File and directory modes in the archive are ignored, unless
|
|
34
|
+
the `chmod: true` option is set.
|
|
35
|
+
|
|
36
|
+
**However**, care must still be taken when dealing with data from
|
|
37
|
+
unknown sources, especially when extracting files, with this or
|
|
38
|
+
any library, no matter how hardened it may be.
|
|
39
|
+
|
|
40
|
+
1. **NEVER** extract tarball data into a folder that could be
|
|
41
|
+
potentially controlled by an unknown actor. A clever attacker
|
|
42
|
+
can swap out the target of an extracted file with a symbolic
|
|
43
|
+
link to some location of their choosing, resulting in writing
|
|
44
|
+
files outside the target folder. There is no reasonable way to
|
|
45
|
+
harden against this category of attack, and security reports
|
|
46
|
+
about it will be closed. TOCTOU exposure is unavoidable when
|
|
47
|
+
creating files based on entries in an archive file.
|
|
48
|
+
2. If you are unpacking tarballs that may come from an unknown
|
|
49
|
+
source, it is **highly recommended** that you use a filter
|
|
50
|
+
function that rejects all hardlinks and symbolic links. Link
|
|
51
|
+
files are historically the root of nearly every file
|
|
52
|
+
extraction vulnerability. (npm filters links out of package
|
|
53
|
+
artifacts for this reason.)
|
|
54
|
+
3. If you are extracting tarballs that are compressed (eg, with
|
|
55
|
+
gzip, brotli, or zstd), then it is a very good idea to also
|
|
56
|
+
filter out any files that are excessively large. Even if you
|
|
57
|
+
are restricting the size of the archive file itself, an
|
|
58
|
+
excessively large file of repetitive data can compress down
|
|
59
|
+
very small, and extract to take up a lot of disk space.
|
|
60
|
+
4. **Stay up to date.** Old versions of tar are not maintained or
|
|
61
|
+
tested for newly discovered security advisories, and should be
|
|
62
|
+
assumed to contain every known security vulnerability, and
|
|
63
|
+
many that are unknown.
|
|
64
|
+
|
|
65
|
+
If you find a security vulnerability in node-tar, where it is not
|
|
66
|
+
properly enforcing the intended security protections, then please
|
|
67
|
+
report it using the GitHub Security Advisories system, where it
|
|
68
|
+
will be triaged and corrected if possible.
|
|
69
|
+
|
|
10
70
|
## Background
|
|
11
71
|
|
|
12
72
|
A "tar file" or "tarball" is an archive of file system entries
|