JS: Include content properties in type-tracker properties

Reminder: we have two PropertyName classes because the one in Contents.qll can't depend on DataFlow::Node.
This commit is contained in:
Asger F
2024-12-03 09:58:54 +01:00
parent 8bca66493f
commit 054558d7b5
2 changed files with 4 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import javascript
private import semmle.javascript.dataflow.TypeTracking
private import semmle.javascript.internal.CachedStages
private import semmle.javascript.dataflow.internal.Contents as Contents
private import sharedlib.SummaryTypeTracker as SummaryTypeTracker
private import FlowSteps
@@ -30,6 +31,8 @@ private module Cached {
SharedTypeTrackingStep::loadStoreStep(_, _, _, this)
or
this = DataFlow::PseudoProperties::arrayLikeElement()
or
this instanceof Contents::Private::PropertyName
}
}

View File

@@ -48,7 +48,7 @@ function m5() {
// Store and read to a property that isn't mentioned anywhere in the source code.
const store = mkSummary("Argument[0]", "ReturnValue.Member[propOnlyMentionedInSummary]");
const read = mkSummary("Argument[0].Member[propOnlyMentionedInSummary]", "ReturnValue");
sink(read(store(source("m5.1")))); // $ MISSING: track=m5.1
sink(read(store(source("m5.1")))); // $ track=m5.1
sink(read(source("m5.1")));
sink(store(source("m5.1")));
sink(store(read(source("m5.1"))));