mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
JS: Add test case for decorated parameter sinks
This commit is contained in:
@@ -3,7 +3,11 @@ import * as testlib from 'testlib';
|
||||
// parameter decorators are only valid in TypeScript so this test is in a .ts file
|
||||
|
||||
class C {
|
||||
decoratedParamSource(@testlib.ParamDecorator x) {
|
||||
decoratedParamSource(@testlib.ParamDecoratorSource x) {
|
||||
sink(x) // NOT OK
|
||||
}
|
||||
decoratedParamSink(@testlib.ParamDecoratorSink x) { // NOT OK - though slightly weird alert location
|
||||
}
|
||||
}
|
||||
|
||||
new C().decoratedParamSink(source());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
consistencyIssue
|
||||
taintFlow
|
||||
| paramDecorator.ts:6:48:6:48 | x | paramDecorator.ts:7:10:7:10 | x |
|
||||
| paramDecorator.ts:6:54:6:54 | x | paramDecorator.ts:7:10:7:10 | x |
|
||||
| paramDecorator.ts:13:28:13:35 | source() | paramDecorator.ts:9:50:9:50 | x |
|
||||
| test.js:5:30:5:37 | source() | test.js:5:8:5:38 | testlib ... urce()) |
|
||||
| test.js:6:22:6:29 | source() | test.js:6:8:6:30 | preserv ... urce()) |
|
||||
| test.js:7:41:7:48 | source() | test.js:7:8:7:49 | require ... urce()) |
|
||||
@@ -56,6 +57,7 @@ taintFlow
|
||||
| test.js:187:31:187:31 | x | test.js:189:10:189:10 | x |
|
||||
| test.js:203:32:203:39 | source() | test.js:203:32:203:39 | source() |
|
||||
isSink
|
||||
| paramDecorator.ts:9:50:9:50 | x | test-sink |
|
||||
| test.js:54:18:54:25 | source() | test-sink |
|
||||
| test.js:55:22:55:29 | source() | test-sink |
|
||||
| test.js:57:24:57:31 | source() | test-sink |
|
||||
|
||||
@@ -37,6 +37,7 @@ class Sinks extends ModelInput::SinkModelCsv {
|
||||
"testlib;;Member[FieldDecoratorSink].DecoratedMember;test-sink",
|
||||
"testlib;;Member[MethodDecorator].DecoratedMember.ReturnValue;test-sink",
|
||||
"testlib;;Member[MethodDecoratorWithArgs].ReturnValue.DecoratedMember.ReturnValue;test-sink",
|
||||
"testlib;;Member[ParamDecoratorSink].DecoratedParameter;test-sink",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -48,7 +49,7 @@ class Sources extends ModelInput::SourceModelCsv {
|
||||
"testlib;;Member[getSource].ReturnValue;test-source",
|
||||
"testlib;;Member[ClassDecorator].DecoratedClass.Instance.Member[inputIsSource].Parameter[0];test-source",
|
||||
"testlib;;Member[FieldDecoratorSource].DecoratedMember;test-source",
|
||||
"testlib;;Member[ParamDecorator].DecoratedParameter;test-source",
|
||||
"testlib;;Member[ParamDecoratorSource].DecoratedParameter;test-source",
|
||||
"testlib;;Member[MethodDecorator].DecoratedMember.Parameter[0];test-source",
|
||||
"testlib;;Member[MethodDecoratorWithArgs].ReturnValue.DecoratedMember.Parameter[0];test-source",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user