File tree Expand file tree Collapse file tree 4 files changed +26
-6
lines changed
Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -469,11 +469,31 @@ const FileFetcher = require('./file.js')
469469const DirFetcher = require ( './dir.js' )
470470const RemoteFetcher = require ( './remote.js' )
471471
472+ // possible values for allow: 'all', 'root', 'none'
473+ const canUseGit = ( allow = 'all' , isRoot = false ) => {
474+ if ( allow === 'all' ) {
475+ return true
476+ }
477+ if ( allow !== 'none' && isRoot ) {
478+ return true
479+ }
480+ return false
481+ }
482+
472483// Get an appropriate fetcher object from a spec and options
473484FetcherBase . get = ( rawSpec , opts = { } ) => {
474485 const spec = npa ( rawSpec , opts . where )
475486 switch ( spec . type ) {
476487 case 'git' :
488+ if ( ! canUseGit ( opts . allowGit , opts . _isRoot ) ) {
489+ throw Object . assign (
490+ new Error ( `Fetching${ opts . allowGit === 'root' ? ' non-root' : '' } packages from git has been disabled` ) ,
491+ {
492+ code : 'EALLOWGIT' ,
493+ package : spec . toString ( ) ,
494+ }
495+ )
496+ }
477497 return new GitFetcher ( spec , opts )
478498
479499 case 'remote' :
Original file line number Diff line number Diff line change 11{
22 "name" : " pacote" ,
3- "version" : " 21.0.4 " ,
3+ "version" : " 21.1.0 " ,
44 "description" : " JavaScript package downloader" ,
55 "author" : " GitHub Inc." ,
66 "bin" : {
Original file line number Diff line number Diff line change 135135 "npm-registry-fetch" : " ^19.1.1" ,
136136 "npm-user-validate" : " ^4.0.0" ,
137137 "p-map" : " ^7.0.4" ,
138- "pacote" : " ^21.0.4 " ,
138+ "pacote" : " ^21.1.0 " ,
139139 "parse-conflict-json" : " ^5.0.1" ,
140140 "proc-log" : " ^6.1.0" ,
141141 "qrcode-terminal" : " ^0.12.0" ,
92329232 "license" : " BlueOak-1.0.0"
92339233 },
92349234 "node_modules/pacote" : {
9235- "version" : " 21.0.4 " ,
9236- "resolved" : " https://registry.npmjs.org/pacote/-/pacote-21.0.4 .tgz" ,
9237- "integrity" : " sha512-RplP/pDW0NNNDh3pnaoIWYPvNenS7UqMbXyvMqJczosiFWTeGGwJC2NQBLqKf4rGLFfwCOnntw1aEp9Jiqm1MA ==" ,
9235+ "version" : " 21.1.0 " ,
9236+ "resolved" : " https://registry.npmjs.org/pacote/-/pacote-21.1.0 .tgz" ,
9237+ "integrity" : " sha512-WF/PwrImIIVaLmtuCeO5L7n6DA0ZGCqmDPO/XbNjZgNUX+2O5z4f4Wdmu6erBWNICkl3ftKJvit2eIVcpegRRw ==" ,
92389238 "inBundle" : true ,
92399239 "license" : " ISC" ,
92409240 "dependencies" : {
Original file line number Diff line number Diff line change 102102 "npm-registry-fetch" : " ^19.1.1" ,
103103 "npm-user-validate" : " ^4.0.0" ,
104104 "p-map" : " ^7.0.4" ,
105- "pacote" : " ^21.0.4 " ,
105+ "pacote" : " ^21.1.0 " ,
106106 "parse-conflict-json" : " ^5.0.1" ,
107107 "proc-log" : " ^6.1.0" ,
108108 "qrcode-terminal" : " ^0.12.0" ,
You can’t perform that action at this time.
0 commit comments