Back to Freecodecamp

Hide Potentially Dangerous Information Using helmet.hidePoweredBy()

curriculum/challenges/english/blocks/information-security-with-helmetjs/587d8247367417b2b2512c37.md

latest847 B
Original Source

--description--

As a reminder, this project is being built upon the following starter project cloned from <a href="https://github.com/freeCodeCamp/boilerplate-infosec/" target="_blank" rel="noopener noreferrer nofollow">GitHub</a>.

Hackers can exploit known vulnerabilities in Express/Node if they see that your site is powered by Express. X-Powered-By: Express is sent in every request coming from Express by default. Use the helmet.hidePoweredBy() middleware to remove the X-Powered-By header.

--hints--

helmet.hidePoweredBy() middleware should be mounted correctly

js
const response = await fetch(code + '/_api/app-info');
if (!response.ok) {
  throw Error(await response.text());
}
const data = await response.json();
assert.include(data.appStack, 'hidePoweredBy');
assert.notEqual(data.headers['x-powered-by'], 'Express');