JS: introduce persistent read/write pairs as a taint step

This commit is contained in:
Esben Sparre Andreasen
2018-12-05 22:21:37 +01:00
parent 75842fec1c
commit 7fb752784a
2 changed files with 39 additions and 0 deletions

View File

@@ -65,3 +65,27 @@ abstract class DatabaseAccess extends DataFlow::Node {
/** Gets an argument to this database access that is interpreted as a query. */
abstract DataFlow::Node getAQueryArgument();
}
/**
* A data flow node that reads persistent data.
*/
abstract class PersistentReadAccess extends DataFlow::Node {
/**
* Gets the corresponding persistent write, if any.
*/
abstract PersistentWriteAccess getAWrite();
}
/**
* A data flow node that writes persistent data.
*/
abstract class PersistentWriteAccess extends DataFlow::Node {
/**
* Gets the data flow node corresponding to the written value.
*/
abstract DataFlow::Node getValue();
}

View File

@@ -232,6 +232,21 @@ module TaintTracking {
}
}
private class StorageTaintStep extends AdditionalTaintStep {
PersistentReadAccess read;
StorageTaintStep() {
this = read
}
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
pred = read.getAWrite().getValue() and
succ = read
}
}
/**
* A taint propagating data flow edge caused by the builtin array functions.
*/