Information Security with HelmetJS - Hide Potentially Dangerous Information Using helmet.hidePoweredBy()

Tell us what’s happening:
Describe your issue in detail here.
What are the second instructions?
Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36

Challenge: Information Security with HelmetJS - Hide Potentially Dangerous Information Using helmet.hidePoweredBy()

Link to the challenge:

Do you mean this?

Use the helmet.hidePoweredBy() middleware to remove the X-Powered-By header.


Remember how you used other Express middleware?

app.use(someMiddleware)

That is how you should use the helmet.hidePoweredBy() middleware.


Edit:

  1. You need to require in helmet.

  2. You need to app.use() the helmet.hidePoweredBy() middleware.

what is the somemiddleware code? but inevitable yes

The helmet.hidePoweredBy() middleware.


You learn how to use middleware here.

Here is an example of using the cors middleware.

const cors = require('cors'); 
app.use(cors());

It is the same principle for how you should use the helmet.hidePoweredBy() middleware.

That didn’t help, I tried everything and no luck.

All I see is this

https://replit.com/@borristheclown2/boilerplate-infosec-10?v=1#myApp.js

Which is not correct and not what I said to do. Update your Replit with your latest code if that isn’t it.


  1. You need to require in helmet.

  2. You need to put the helmet.hidePoweredBy() middleware call inside the app.use() call.

const theMiddleware = require('theMiddleware'); 
app.use(theMiddleware.theMethod());


I did it, is this correct?

  • What is it you believe putting myApp.js inside the myApp.js file does? As it is telling you, it is a reference error. Remove that from the code.

  • How are you supposed to call a method .hidePoweredBy() on an object helmet that doesn’t exist in the code? You can’t call helmet.hidePoweredBy() without having used require() to bring in helmet first.

Well how do I do that?

How do you do what?

You bring in helmet the same way you bring in express.

https://web.archive.org/web/20200414213516/https://helmetjs.github.io/docs/hide-powered-by/


Have you done the JS curriculum and the Back End Development and APIs sections? Because there is really nothing new going on here, just a new library and its usage.

no and its still not working.

https://web.archive.org/web/20200414213516/https://helmetjs.github.io/docs/hide-powered-by/ I tried the code from this website but its still not working idk.

What is it you believe app is in your code? How can you call something that doesn’t exist in the code?

You remove the Express code which is required to use Express.

const express = require('express');
const app = express();

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.