Skip to content

pmcclory-contrast/KrakenTestBench

 
 

Repository files navigation

KrakenTestBench

Intentionally Vulnerable Node Application

Adding a shared vulnerability

Once you have added shared functionality to @contrast/test-bench-utils and @contrast/test-bench-content, you are ready to add an endpoint in the test bench application.

Create a controllers/ruleName/index.js file and call the controllerFactory method:

const controllerFactory = require('../../utils/controllerFactory');
module.exports = controllerFactory('ruleName');

Check the documentation for controllerFactory under utils/controllerFactory.js usage information.

Create a models/ruleName.js file that provides sink data generated by @contrast/test-bench-utils:

const { utils } = require('@contrast/test-bench-utils');

module.exports = function CommandInjectionModel() {
  const sinkData = utils.getSinkData('ruleName', 'kraken');
  const routeMeta = utils.getRouteMeta('ruleName');

  return {
    ...routeMeta,
    sinkData
  };
};

Add a public/templates/ruleName.ejs file that includes the shared template from @contrast/test-bench-content:

<% include ../../node_modules/@contrast/test-bench-content/views/ruleName.ejs %>

Now run the app and make sure everything works as expected!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.4%
  • HTML 18.9%
  • CSS 18.7%