Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(git): Fix temp directory permissions for git fetcher (#159)
Browse files Browse the repository at this point in the history
As reported in #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
agy authored and zkat committed Oct 26, 2018
1 parent 6c48ba1 commit 97c3aeb
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 97c3aeb

Please sign in to comment.