Intentionally Vulnerable Node Application
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!