Skip to content

Commit

Permalink
Fixes arbitrary file write on fetch (yarnpkg#7831)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored and Vincent Bailly committed Jun 10, 2020
1 parent eead803 commit f687b63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fetchers/tarball-fetcher.js
Expand Up @@ -136,6 +136,11 @@ export default class TarballFetcher extends BaseFetcher {
chown: false, // don't chown. just leave as it is
map: header => {
header.mtime = now;
if (header.linkname) {
const basePath = path.posix.dirname(path.join('/', header.name));
const jailPath = path.posix.join(basePath, header.linkname);
header.linkname = path.posix.relative('/', jailPath);
}
return header;
},
fs: patchedFs,
Expand Down

0 comments on commit f687b63

Please sign in to comment.