Tell us what’s happening:
I’m struggling alot, I’ve put helmet to version 3.23.3 to avoid the the new API, yet helmet is still not defined.
Your code so far
boilerplate-infosec - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Challenge Information:
Information Security with HelmetJS - Hide Potentially Dangerous Information Using helmet.hidePoweredBy()
Are you running this in replit or is this just the source code. Also shouldn’t helmet be somewhere in the server.js file with the other dependencies?
I was using npm to host, so I thought it was just a localhost problem, and swapped over to replit, and the same thing happened, I’m also using the github repo within replit only editing, myapp.js.
1 Like
I was reviewing this post to try and see if it worked but the same thing happened again, It might be due to me using Safe mode with Windows 10, because my computer decided to just off the critical process during booting normally.
Edit: It’s an old refurbished work computer, that was sent with a Windows 7 pro activation code so.
Tell us what’s happening:
app.use(helmet.hidePoweredBy()); not working
Your project link(s)
The response is (not working) as follows:
ReferenceError: helmet is not defined
at Object. (/home/runner/boilerplate-infosec/myApp.js:3:9)
How to resolve this problem?
solution: boilerplate-infosec - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 OPR/94.0.0.0
Challenge: Information …
Yes, it could just be a windows issue like an extension or update. Good luck
I don’t think it could be I can host with npm just fine, It always just tells me helmet isn't defined
.
Edit: It could be due to me using npm
, and pnpm
Edit 2: I did install react scripts
to deal with a react project, and I used npm to run npm install
, npm test
, npm run build
, ect.
Ok, try npm audit fix or maybe finding out what version of node you are using that can be a problem somtimes.
I also know ethical hacking, I spent like 850 USD on the course that’s beside the point, even with that knowledge I’m still unsure why the middleware is not mounting correctly.
Alright, hold on, let me load PowerShell, and that takes a good 3-5 minutes sadly.
@robheyays
Using VScode to edit myapp.js
I input
require('helmet');
VScode tells me
Could not find a declaration file for Module 'helmet'.
lasjorg
February 11, 2025, 5:19pm
11
You are not saving the require
import to a variable.
You just have:
require('helmet');
It should be:
const helmet = require('helmet');
I still get this even when using the code
const helmet = require('helmet');
Thank you, my code was wrong, and VScode was just freaking out over a declaration file.