The vulnerability is an arbitrary file write in the compressing npm package, caused by improper handling of symbolic links in TAR archives. The root cause is that the library does not validate the target of a symlink during extraction. An attacker can create a malicious TAR archive containing a symlink that points to a directory outside the intended extraction destination (e.g., ../../../../tmp). When the library processes a subsequent file entry intended for that symlinked directory, it follows the link and writes the file to the arbitrary location, leading to a path traversal vulnerability.
The analysis of the provided patches (8d16c196c7f1888fc1af957d9ff36117247cea6c and ce1c0131c401c071c77d5a1425bf8c88cfc16361) pinpoints the vulnerable code in lib/utils.js. The fix is implemented within the makeUncompressFn function, which is a factory for the uncompression logic. The patch introduces a new isPathWithinParent function to check if a given path is within the destination directory. This check is then applied to both regular file entries and, most importantly, to the targets of symbolic links.
The function makeUncompressFn is identified as the key function because it contains the vulnerable logic that was modified. While the user-facing API is compressing.tar.uncompress, the actual processing of the tar entries happens inside an anonymous function created by makeUncompressFn. A runtime profiler would show execution within this logic when the vulnerability is triggered. The patch directly modifies this function to add the necessary security validation, confirming it as the location of the vulnerability.