documentation for handlebars.js flow step

This commit is contained in:
Stephan Brandauer
2022-03-24 13:08:52 +01:00
parent 0bd9e9f298
commit a28e9c5b6e
2 changed files with 18 additions and 1 deletions

View File

@@ -52,6 +52,23 @@ module TaintStep {
/**
* Holds if there's a step from `pred` to `succ` due to templating data being
* passed from a templating call to a registered helper via a parameter.
*
* To establish the step, we look at the template passed to `compile`, and will
* only track steps from templates to helpers they actually reference.
*
* ```javascript
* function loudHelper(text) {
* // ^^^^ succ
* return text.toUpperCase();
* }
*
* hb.registerHelper("loud", loudHelper);
*
* const template = hb.compile("Hello, {{loud name}}!");
*
* template({name: "user"});
* // ^^^^^^ pred
* ```
*/
private predicate isHandlebarsArgStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(string helperName |

View File

@@ -7,10 +7,10 @@ const app = express();
const data = {};
function init() {
hb.registerHelper("catFile", catFile);
data.compiledFileAccess = hb.compile("contents of file {{path}} are: {{catFile path}}")
data.compiledBenign = hb.compile("hello, {{name}}");
data.compiledUnknown = hb.compile(fs.readFileSync("greeting.template"));
hb.registerHelper("catFile", catFile);
}
init();