File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,25 @@ import * as pathModule from 'path'
1212function absolutePath ( path : string , sharedFolder :string ) : string {
1313 path = normalizePath ( path )
1414 path = pathModule . resolve ( sharedFolder , path )
15+ if ( ! isSubDirectory ( pathModule . resolve ( process . cwd ( ) , sharedFolder ) , path ) ) throw new Error ( 'Cannot read/write to path outside shared folder.' )
1516 return path
1617}
1718
19+ /**
20+ * returns a true if child is sub-directory of parent.
21+ *
22+ * @param {String } parent - path to parent directory
23+ * @param {String } child - child path
24+ * @return {Boolean }
25+ */
26+ function isSubDirectory ( parent : string , child : string ) {
27+ if ( ! parent ) return false
28+ if ( parent === child ) return true
29+ const relative = pathModule . relative ( parent , child )
30+
31+ return ! ! relative && relative . split ( pathModule . sep ) [ 0 ] !== '..'
32+ }
33+
1834/**
1935 * return the relative path of the given @arg path
2036 *
Original file line number Diff line number Diff line change 8585 "nightwatch_local_url" : " npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/url.test.js --env=chrome" ,
8686 "nightwatch_local_verticalIconscontextmenu" : " npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.js --env=chrome" ,
8787 "onchange" : " onchange apps/remix-ide/build/app.js -- npm-run-all lint" ,
88- "remixd" : " nx build remixd & nx serve remixd --folder=./apps/remix-ide/contracts --remixide=http://127.0.0.1 :8080" ,
88+ "remixd" : " nx build remixd && nx serve remixd --folder=./apps/remix-ide/contracts --remixide=http://localhost :8080" ,
8989 "selenium" : " selenium-standalone start" ,
9090 "selenium-install" : " selenium-standalone install" ,
9191 "sourcemap" : " exorcist --root ../ apps/remix-ide/build/app.js.map > apps/remix-ide/build/app.js" ,
You can’t perform that action at this time.
0 commit comments