Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS: Deprecations and related refactorings #18132

Merged
merged 34 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0cd2e3f
JS: Deprecate old data flow library, except some guard-related nodes
asgerf Nov 6, 2024
bc7753d
JS: Remove non-deprecated reference to AdditionalBarrierGuardNode
asgerf Nov 6, 2024
82682d9
JS: Remove a non-deprecated reference to SanitizerGuardNode
asgerf Nov 6, 2024
c2abb0f
JS: Remove reference to AdditionalSanitizerGuard from CachedStages
asgerf Nov 6, 2024
0b1e859
JS: Remove uses of AdditionalSanitizerGuardNode
asgerf Nov 6, 2024
988fa9c
JS: Deprecate AdditionalSanitizerGuardNode
asgerf Nov 6, 2024
13ee597
JS: Add some proper documentation to SummarizedCallable
asgerf Nov 12, 2024
249104b
JS: Update comments referring to old `Configuration` style
asgerf Nov 12, 2024
f758b67
JS: Openly recommend SummarizedCallable
asgerf Nov 12, 2024
a568d8c
JS: Port threat-model test to ConfigSig
asgerf Nov 28, 2024
3548544
JS: Avoid some uses of deprecated guard classes in tests
asgerf Nov 28, 2024
4d7401a
JS: Deprecate tests for deprecated APIs
asgerf Nov 28, 2024
1832e93
JS: Port FormParsers test to ConfigSig
asgerf Nov 28, 2024
8887ca1
JS: Port an experimental CodeInjection variant to ConfigSig
asgerf Nov 28, 2024
4f83907
JS: Port experimental EnvValueAndKeyInjection to ConfigSig
asgerf Nov 28, 2024
7e162f5
JS: Port experimental EnvValueInjection to ConfigSig
asgerf Nov 28, 2024
72e5226
JS: Port experimental jwtDecodeWithoutVerification to ConfigSig
asgerf Nov 28, 2024
f5a6485
JS: Port experimental decodeJwtWithoutVerificationLocalSource
asgerf Nov 28, 2024
871bc3b
JS: Port experimental CorsPermissiveConfiguration to ConfigSig
asgerf Nov 28, 2024
834d35b
JS: Port experimental DecompressionBombs to ConfigSig
asgerf Nov 28, 2024
04a3a67
JS: Update a reference to AdditionalSanitizerGuardNode
asgerf Nov 28, 2024
0ce1fe7
JS: Deprecate ConsistencyChecking to avoid deprecation warnings
asgerf Nov 28, 2024
e6680de
JS: Avoid use of LabeledSanitizerGuardNode in TaintedObject
asgerf Nov 28, 2024
75ab485
Remove unsupported features from PoI
asgerf Nov 28, 2024
08d25c1
JS: Deprecate more uses of ConsistencyConfiguration
asgerf Nov 28, 2024
a574ff1
JS: Remove use of MakeLegacyBarrierGuard in experimental SSRF
asgerf Nov 29, 2024
21494fb
JS: Refactor BarrierGuardLegacy pattern to not depend on SanitizerGua…
asgerf Nov 29, 2024
2ef652d
JS: Add more deprecation annotations in tests
asgerf Nov 29, 2024
2ae7386
JS: Also apply new BarrierGuardLegacy pattern in Xss.qll
asgerf Nov 29, 2024
f620191
JS: Deprecate SanitizerGuardNode
asgerf Nov 29, 2024
62c17d3
JS: Update SanitizerGuardNode use in BasicTaintTracking test
asgerf Nov 29, 2024
0d79c71
JS: Update two more uses of SanitizerGuardNode
asgerf Nov 29, 2024
b346198
JS: Remove use of SanitizerGuardNode in experimental SSRF query
asgerf Nov 29, 2024
3f0d0e3
JS: Deprecate DataFlow::BarrierGuardNode
asgerf Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ private import semmle.javascript.internal.CachedStages
*
* This class is a singleton, and thus subclasses do not need to specify a characteristic predicate.
*
* As an alternative to this class, consider using `DataFlow::SummarizedCallable`.
*
* Note: For performance reasons, all subclasses of this class should be part
* of the standard library. Override `Configuration::isAdditionalFlowStep`
* for analysis-specific flow steps.
* of the standard library. Use `isAdditionalFlowStep` for query-specific flow steps.
*/
class AdditionalFlowStep extends Unit {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ private import semmle.javascript.internal.CachedStages
*
* This class is a singleton, and thus subclasses do not need to specify a characteristic predicate.
*
* As an alternative to this class, consider using `DataFlow::SummarizedCallable`.
*
* Note: For performance reasons, all subclasses of this class should be part
* of the standard library. Override `Configuration::isAdditionalTaintStep`
* for analysis-specific taint steps.
* of the standard library. Use `isAdditionalFlowStep` for query-specific taint steps.
*/
class AdditionalTaintStep extends Unit {
/**
Expand Down
201 changes: 111 additions & 90 deletions javascript/ql/lib/semmle/javascript/dataflow/Configuration.qll

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions javascript/ql/lib/semmle/javascript/dataflow/DataFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1935,4 +1935,5 @@ module DataFlow {
import internal.FunctionWrapperSteps
import internal.sharedlib.DataFlow
import internal.BarrierGuards
import FlowSummary
}
47 changes: 46 additions & 1 deletion javascript/ql/lib/semmle/javascript/dataflow/FlowSummary.qll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,49 @@ private import semmle.javascript.dataflow.internal.FlowSummaryPrivate
private import semmle.javascript.dataflow.internal.sharedlib.DataFlowImplCommon as DataFlowImplCommon
private import semmle.javascript.dataflow.internal.DataFlowPrivate

/** A callable with a flow summary, identified by a unique string. */
/**
* A model for a function that can propagate data flow.
*
* This class makes it possible to model flow through functions, using the same mechanism as
* `summaryModel` as described in the [library customization docs](https://codeql.github.com/docs/codeql-language-guides/customizing-library-models-for-javascript).
*
* Extend this class to define summary models directly in CodeQL.
* Data extensions and `summaryModel` are usually preferred; but there are a few cases where direct use of this class may be needed:
*
* - The relevant call sites cannot be matched by the access path syntax, and require the full power of CodeQL.
* For example, complex overloading patterns might require more local reasoning at the call site.
* - The input/output behaviour cannot be described statically in the access path syntax, but the relevant access paths
* can be generated dynamically in CodeQL, based on the usages found in the codebase.
*
* Subclasses should bind `this` to a unique identifier for the function being modelled. There is no special
* interpreation of the `this` value, it should just not clash with the `this`-value used by other classes.
*
* For example, this models flow through calls such as `require("my-library").myFunction()`:
* ```codeql
* class MyFunction extends SummarizedCallable {
* MyFunction() { this = "MyFunction" }
*
* override predicate propagatesFlow(string input, string output, boolean preservesValues) {
* input = "Argument[0]" and
* output = "ReturnValue" and
* preservesValue = false
* }
*
* override DataFlow::InvokeNode getACall() {
* result = API::moduleImport("my-library").getMember("myFunction").getACall()
* }
* }
* ```
* This would be equivalent to the following model written as a data extension:
* ```yaml
* extensions:
* - addsTo:
* pack: codeql/javascript-all
* extensible: summaryModel
* data:
* - ["my-library", "Member[myFunction]", "Argument[0]", "ReturnValue", "taint"]
* ```
*/
abstract class SummarizedCallable extends LibraryCallable, Impl::Public::SummarizedCallable {
bindingset[this]
SummarizedCallable() { any() }
Expand All @@ -15,6 +57,9 @@ abstract class SummarizedCallable extends LibraryCallable, Impl::Public::Summari
* Holds if data may flow from `input` to `output` through this callable.
*
* `preservesValue` indicates whether this is a value-preserving step or a taint-step.
*
* See the [library customization docs](https://codeql.github.com/docs/codeql-language-guides/customizing-library-models-for-javascript) for
* the syntax of the `input` and `output` parameters.
*/
pragma[nomagic]
predicate propagatesFlow(string input, string output, boolean preservesValue) { none() }
Expand Down
Loading
Loading