mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Add TypedArrays flow summaries for Uint8Array and buffer property
This commit is contained in:
@@ -12,3 +12,4 @@ private import Sets
|
||||
private import Strings
|
||||
private import DynamicImportStep
|
||||
private import UrlSearchParams
|
||||
private import TypedArrays
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
private import javascript
|
||||
private import semmle.javascript.dataflow.FlowSummary
|
||||
private import semmle.javascript.dataflow.InferredTypes
|
||||
private import semmle.javascript.dataflow.internal.DataFlowPrivate as Private
|
||||
private import FlowSummaryUtil
|
||||
|
||||
private class TypedArrayEntryPoint extends API::EntryPoint {
|
||||
TypedArrayEntryPoint() { this = "global.Uint8Array" }
|
||||
|
||||
override DataFlow::SourceNode getASource() { result = DataFlow::globalVarRef("Uint8Array") }
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
API::Node typedArrayConstructorRef() { result = any(TypedArrayEntryPoint e).getANode() }
|
||||
|
||||
class TypedArrayConstructorSummary extends SummarizedCallable {
|
||||
TypedArrayConstructorSummary() { this = "TypedArray constructor" }
|
||||
|
||||
override DataFlow::InvokeNode getACall() {
|
||||
result = typedArrayConstructorRef().getAnInstantiation()
|
||||
}
|
||||
|
||||
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
|
||||
preservesValue = true and
|
||||
input = "Argument[0].ArrayElement" and
|
||||
output = "ReturnValue.ArrayElement"
|
||||
}
|
||||
}
|
||||
|
||||
class BufferTypedArray extends DataFlow::AdditionalFlowStep {
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
exists(DataFlow::PropRead p |
|
||||
p = typedArrayConstructorRef().getInstance().getMember("buffer").asSource() and
|
||||
pred = p.getBase() and
|
||||
succ = p
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -35,14 +35,14 @@ legacyDataFlowDifference
|
||||
| spread.js:4:15:4:22 | source() | spread.js:18:8:18:8 | y | only flow with NEW data flow library |
|
||||
| spread.js:4:15:4:22 | source() | spread.js:24:8:24:8 | y | only flow with NEW data flow library |
|
||||
| tst.js:2:13:2:20 | source() | tst.js:17:10:17:10 | a | only flow with OLD data flow library |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:5:10:5:10 | y | only flow with NEW data flow library |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:7:10:7:17 | y.buffer | only flow with NEW data flow library |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:11:10:11:12 | arr | only flow with NEW data flow library |
|
||||
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x | only flow with NEW data flow library |
|
||||
consistencyIssue
|
||||
| nested-props.js:20 | expected an alert, but found none | NOT OK - but not found | Consistency |
|
||||
| stringification-read-steps.js:17 | expected an alert, but found none | NOT OK | Consistency |
|
||||
| stringification-read-steps.js:25 | expected an alert, but found none | NOT OK | Consistency |
|
||||
| typed-arrays.js:5 | expected an alert, but found none | NOT OK | Consistency |
|
||||
| typed-arrays.js:7 | expected an alert, but found none | NOT OK | Consistency |
|
||||
| typed-arrays.js:11 | expected an alert, but found none | NOT OK | Consistency |
|
||||
flow
|
||||
| access-path-sanitizer.js:2:18:2:25 | source() | access-path-sanitizer.js:4:8:4:12 | obj.x |
|
||||
| addexpr.js:4:10:4:17 | source() | addexpr.js:7:8:7:8 | x |
|
||||
@@ -328,6 +328,9 @@ flow
|
||||
| tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue |
|
||||
| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
|
||||
| tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:5:10:5:10 | y |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:7:10:7:17 | y.buffer |
|
||||
| typed-arrays.js:2:13:2:20 | source() | typed-arrays.js:11:10:11:12 | arr |
|
||||
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:8:10:8:17 | captured |
|
||||
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x |
|
||||
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
|
||||
|
||||
@@ -81,9 +81,12 @@ edges
|
||||
| pako.js:18:48:18:66 | zipFile.data.buffer | pako.js:18:33:18:67 | new Uin ... buffer) | provenance | Config |
|
||||
| pako.js:28:19:28:25 | zipFile | pako.js:29:36:29:42 | zipFile | provenance | |
|
||||
| pako.js:29:11:29:62 | myArray | pako.js:32:31:32:37 | myArray | provenance | |
|
||||
| pako.js:29:11:29:62 | myArray [ArrayElement] | pako.js:32:31:32:37 | myArray | provenance | |
|
||||
| pako.js:29:21:29:55 | new Uin ... buffer) | pako.js:29:11:29:62 | myArray | provenance | |
|
||||
| pako.js:29:21:29:55 | new Uin ... buffer) [ArrayElement] | pako.js:29:11:29:62 | myArray [ArrayElement] | provenance | |
|
||||
| pako.js:29:36:29:42 | zipFile | pako.js:29:36:29:54 | zipFile.data.buffer | provenance | |
|
||||
| pako.js:29:36:29:54 | zipFile.data.buffer | pako.js:29:21:29:55 | new Uin ... buffer) | provenance | Config |
|
||||
| pako.js:29:36:29:54 | zipFile.data.buffer | pako.js:29:21:29:55 | new Uin ... buffer) [ArrayElement] | provenance | |
|
||||
| unbzip2.js:12:5:12:43 | fs.crea ... lePath) | unbzip2.js:12:50:12:54 | bz2() | provenance | Config |
|
||||
| unbzip2.js:12:25:12:42 | req.query.FilePath | unbzip2.js:12:5:12:43 | fs.crea ... lePath) | provenance | Config |
|
||||
| unzipper.js:13:26:13:62 | Readabl ... e.data) | unzipper.js:16:23:16:63 | unzippe ... ath' }) | provenance | Config |
|
||||
@@ -183,7 +186,9 @@ nodes
|
||||
| pako.js:21:31:21:37 | myArray | semmle.label | myArray |
|
||||
| pako.js:28:19:28:25 | zipFile | semmle.label | zipFile |
|
||||
| pako.js:29:11:29:62 | myArray | semmle.label | myArray |
|
||||
| pako.js:29:11:29:62 | myArray [ArrayElement] | semmle.label | myArray [ArrayElement] |
|
||||
| pako.js:29:21:29:55 | new Uin ... buffer) | semmle.label | new Uin ... buffer) |
|
||||
| pako.js:29:21:29:55 | new Uin ... buffer) [ArrayElement] | semmle.label | new Uin ... buffer) [ArrayElement] |
|
||||
| pako.js:29:36:29:42 | zipFile | semmle.label | zipFile |
|
||||
| pako.js:29:36:29:54 | zipFile.data.buffer | semmle.label | zipFile.data.buffer |
|
||||
| pako.js:32:31:32:37 | myArray | semmle.label | myArray |
|
||||
|
||||
Reference in New Issue
Block a user