File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,18 @@ const http = require("http");
22
33http
44 . createServer ( function ( request , response ) {
5+
6+ //
7+ // If the app has been configured to check the CIS secret,
8+ // make sure that the request header value 'x-cis-secret' matches the configured secret.
9+ // If it doesn't match, assume that the request bypassed the CIS firewall and reject it.
10+ if ( process . env . CIS_SECRET && request . headers [ 'x-cis-secret' ] !== process . env . CIS_SECRET ) {
11+ response . writeHead ( 403 ) ;
12+ return response . end ( ) ;
13+ }
14+
515 //
6- // debug endpoint, which prints all incoming headers and environment variables
16+ // Debug endpoint, which prints all incoming headers and environment variables
717 if ( request . url == "/debug" ) {
818 const respData = {
919 headers : request . headers ,
1727 }
1828
1929 //
20- // default http endpoint, which prints a simple hello world
30+ // Default http endpoint, which prints a simple hello world
2131 target = process . env . TARGET ? process . env . TARGET : "World" ;
2232 msg = process . env . MSG ? process . env . MSG : "Hello " + target + "\n" ;
2333 response . writeHead ( 200 , { "Content-Type" : "text/plain" } ) ;
You can’t perform that action at this time.
0 commit comments