Skip to content

Commit

Permalink
Fix temp directory permissions for git fetcher
Browse files Browse the repository at this point in the history
As reported in zkat#105 `pacote` does
not set permissions on temporary directories for git fetcher when
opts.uid is used to drop privileges (e.g. when using sudo).

This fix passes in the uid and gid to cacache as options. No checking is
required as cacache checks these options before using them.
  • Loading branch information
Andrew Glen-Young committed Aug 21, 2018
1 parent 2333a17 commit 8691f36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fetchers/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function resolve (url, spec, name, opts) {
function withTmp (opts, cb) {
if (opts.cache) {
// cacache has a special facility for working in a tmp dir
return cacache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone'}, cb)
return cacache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone', uid: opts.uid, gid: opts.gid}, cb)
} else {
const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
const tmpName = uniqueFilename(tmpDir, 'git-clone')
Expand Down

0 comments on commit 8691f36

Please sign in to comment.