File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 11name : Build
22on : [push, pull_request]
33
4+ permissions :
5+ contents : read
6+ packages : write
7+
48jobs :
59 build :
610 runs-on : ${{ matrix.os }}
@@ -15,21 +19,25 @@ jobs:
1519 name : Node ${{ matrix.node_version }} on ${{ matrix.os }}
1620 steps :
1721 - name : Checkout
18- uses : actions/checkout@v4
22+ uses : actions/checkout@v6
1923 with :
2024 fetch-depth : 0
2125 - name : Build Reason
2226 run : " echo ref: ${{github.ref}} event: ${{github.event_name}}"
2327 - name : Setup Node.js environment
24- uses : actions/setup-node@v4
28+ uses : actions/setup-node@v6
2529 with :
2630 node-version : ${{ matrix.node_version }}
2731 registry-url : " https://registry.npmjs.org"
2832 - name : Cache node_modules
29- uses : actions/cache@v4
33+ uses : actions/cache@v5
3034 with :
3135 path : node_modules
3236 key : ${{ matrix.node_version }}-${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
37+ - name : Setup .NET SDK for MinVer
38+ uses : actions/setup-dotnet@v5
39+ with :
40+ dotnet-version : " 8.0.x"
3341 - name : Set Min Version
3442 uses : Stelzi79/action-minver@3.0.1
3543 id : version
5563 NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
5664 - name : Setup GitHub CI Node.js environment
5765 if : github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest'
58- uses : actions/setup-node@v4
66+ uses : actions/setup-node@v6
5967 with :
6068 node-version : ${{ matrix.node_version }}
6169 registry-url : " https://npm.pkg.github.com"
Original file line number Diff line number Diff line change @@ -21,7 +21,14 @@ module.exports = (request, options) => {
2121 if ( base ) {
2222 const prefix = base . replace ( "*" , "" ) ;
2323 const suffix = request . slice ( 2 ) ;
24- const resolved = path . join ( packageRoot , prefix , suffix ) ;
24+ if ( suffix . includes ( ".." ) || path . isAbsolute ( suffix ) ) {
25+ throw new Error ( `Unsafe import path: ${ request } ` ) ;
26+ }
27+ const resolved = path . resolve ( packageRoot , prefix , suffix ) ;
28+ const normalizedRoot = path . resolve ( packageRoot ) + path . sep ;
29+ if ( ! resolved . startsWith ( normalizedRoot ) ) {
30+ throw new Error ( `Import escapes package root: ${ request } ` ) ;
31+ }
2532 return resolveWithExtensions ( resolved ) ;
2633 }
2734 }
You can’t perform that action at this time.
0 commit comments