File tree 1 file changed +11
-0
lines changed
runtimes/nodejs/src/handler
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import path = require('path')
11
11
import { logger } from '../support/logger'
12
12
import { IRequest } from '../support/types'
13
13
import { FunctionCache } from '../support/function-engine/cache'
14
+ import { parseToken } from '../support/token'
14
15
15
16
const nodeModulesRoot = path . resolve ( __dirname , '../../node_modules' )
16
17
@@ -20,6 +21,16 @@ const nodeModulesRoot = path.resolve(__dirname, '../../node_modules')
20
21
export async function handlePackageTypings ( req : IRequest , res : Response ) {
21
22
const requestId = req [ 'requestId' ]
22
23
24
+ // verify the debug token
25
+ const token = req . get ( 'x-laf-develop-token' )
26
+ if ( ! token ) {
27
+ return res . status ( 400 ) . send ( 'x-laf-develop-token is required' )
28
+ }
29
+ const auth = parseToken ( token ) || null
30
+ if ( auth ?. type !== 'develop' ) {
31
+ return res . status ( 403 ) . send ( 'permission denied: invalid develop token' )
32
+ }
33
+
23
34
const packageName = req . query . packageName as string
24
35
if ( ! packageName ) {
25
36
return res . status ( 422 ) . send ( 'invalid package name' )
You can’t perform that action at this time.
0 commit comments