JS: Add ThreatModelSource#isCilentSideSource()

This commit is contained in:
Asger F
2025-01-20 13:13:04 +01:00
parent 327bdc0b02
commit 3061d51b20
2 changed files with 16 additions and 0 deletions

View File

@@ -26,6 +26,11 @@ class ThreatModelSource extends DataFlow::Node instanceof ThreatModelSource::Ran
/** Gets a string that describes the type of this threat-model source. */
string getSourceType() { result = super.getSourceType() }
/**
* Holds if this is a source of data that is specific to the web browser environment.
*/
predicate isClientSideSource() { super.isClientSideSource() }
}
/** Provides a class for modeling new sources for specific threat-models. */
@@ -48,6 +53,11 @@ module ThreatModelSource {
/** Gets a string that describes the type of this threat-model source. */
abstract string getSourceType();
/**
* Holds if this is a source of data that is specific to the web browser environment.
*/
predicate isClientSideSource() { this.getThreatModel() = "view-component-input" }
}
}

View File

@@ -24,12 +24,18 @@ private module Cached {
/**
* A source of remote input in a web browser environment.
*
* Note that this does not include `view-component-input` sources even if that threat model has been enabled by the user.
* Consider using the predicate `ThreatModelSource#isClientSideSource()` to check for a broader class of client-side sources.
*/
cached
abstract class ClientSideRemoteFlowSource extends RemoteFlowSource {
/** Gets a string indicating what part of the browser environment this was derived from. */
cached
abstract ClientSideRemoteFlowKind getKind();
cached
final override predicate isClientSideSource() { any() }
}
}