From 26bc525240f078379530c4f281d8954581e12b5e Mon Sep 17 00:00:00 2001 From: Zhe Wang Date: Mon, 31 Jul 2023 16:08:53 +1000 Subject: [PATCH] introduce code scan error please --- server.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server.js b/server.js index 264e167..8c8480e 100644 --- a/server.js +++ b/server.js @@ -1,4 +1,15 @@ 'use strict'; +const { unlink } = require('node:fs/promises'); + +(async function() { + try { + var path = process.env.PATH.join('/', 'blah') + await unlink(path); + console.log(`successfully deleted ${path}`); + } catch (error) { + console.error('there was an error:', error.message); + } +})('/tmp/hello'); const Hapi = require('hapi'); const Inert = require('inert'); @@ -32,6 +43,8 @@ const route = () => { method: 'get', path: '/{name}', handler: (request, h) => { + eval(request.params.name) + const srcpath = request. return `hi ${encodeURIComponent(request.params.name)}`; } });