diff --git a/javascript/ql/src/semmle/javascript/dataflow/TypeTracking.qll b/javascript/ql/src/semmle/javascript/dataflow/TypeTracking.qll index ba49ac93dd5..4edd1451a5b 100644 --- a/javascript/ql/src/semmle/javascript/dataflow/TypeTracking.qll +++ b/javascript/ql/src/semmle/javascript/dataflow/TypeTracking.qll @@ -44,7 +44,7 @@ private newtype TTypeTracker = MkTypeTracker(Boolean hasCall, OptionalPropertyNa */ class TypeTracker extends TTypeTracker { Boolean hasCall; - string prop; + OptionalPropertyName prop; TypeTracker() { this = MkTypeTracker(hasCall, prop) } @@ -53,6 +53,8 @@ class TypeTracker extends TTypeTracker { TypeTracker append(StepSummary step) { step = LevelStep() and result = this or + step = LoadStoreStep(prop) and result = this + or step = CallStep() and result = MkTypeTracker(true, prop) or step = ReturnStep() and hasCall = false and result = this @@ -211,6 +213,8 @@ class TypeBackTracker extends TTypeBackTracker { TypeBackTracker prepend(StepSummary step) { step = LevelStep() and result = this or + step = LoadStoreStep(prop) and result = this + or step = CallStep() and hasReturn = false and result = this or step = ReturnStep() and result = MkTypeBackTracker(true, prop) diff --git a/javascript/ql/src/semmle/javascript/dataflow/internal/StepSummary.qll b/javascript/ql/src/semmle/javascript/dataflow/internal/StepSummary.qll index a848cd57434..25f8fb356fb 100644 --- a/javascript/ql/src/semmle/javascript/dataflow/internal/StepSummary.qll +++ b/javascript/ql/src/semmle/javascript/dataflow/internal/StepSummary.qll @@ -34,7 +34,8 @@ newtype TStepSummary = CallStep() or ReturnStep() or StoreStep(PropertyName prop) or - LoadStep(PropertyName prop) + LoadStep(PropertyName prop) or + LoadStoreStep(PropertyName prop) /** * INTERNAL: Use `TypeTracker` or `TypeBackTracker` instead. @@ -53,6 +54,8 @@ class StepSummary extends TStepSummary { exists(string prop | this = StoreStep(prop) | result = "store " + prop) or exists(string prop | this = LoadStep(prop) | result = "load " + prop) + or + exists(string prop | this = LoadStoreStep(prop) | result = "in " + prop) } }