Skip to content

Commit

Permalink
fix(runtime): function source leakage caused by type hint interface (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Aug 11, 2023
1 parent e2be923 commit 1ad9832
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions runtimes/nodejs/src/handler/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import path = require('path')
import { logger } from '../support/logger'
import { IRequest } from '../support/types'
import { FunctionCache } from '../support/function-engine/cache'
import { parseToken } from '../support/token'

const nodeModulesRoot = path.resolve(__dirname, '../../node_modules')

Expand All @@ -20,6 +21,16 @@ const nodeModulesRoot = path.resolve(__dirname, '../../node_modules')
export async function handlePackageTypings(req: IRequest, res: Response) {
const requestId = req['requestId']

// verify the debug token
const token = req.get('x-laf-develop-token')
if (!token) {
return res.status(400).send('x-laf-develop-token is required')
}
const auth = parseToken(token) || null
if (auth?.type !== 'develop') {
return res.status(403).send('permission denied: invalid develop token')
}

const packageName = req.query.packageName as string
if (!packageName) {
return res.status(422).send('invalid package name')
Expand Down

0 comments on commit 1ad9832

Please sign in to comment.