mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Merge pull request #17219 from michaelnebel/shared/neutralsourcesink
C#/Java: Fix source- and sink callable provenance overlap.
This commit is contained in:
@@ -613,32 +613,6 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A callable where there exists a MaD sink model that applies to it.
|
||||
*/
|
||||
private class SinkModelCallableAdapter extends SinkModelCallable {
|
||||
private Provenance provenance;
|
||||
|
||||
SinkModelCallableAdapter() {
|
||||
SourceSinkInterpretationInput::sinkElement(this, _, _, provenance, _)
|
||||
}
|
||||
|
||||
override predicate hasProvenance(Provenance p) { provenance = p }
|
||||
}
|
||||
final class SourceCallable = SourceModelCallable;
|
||||
|
||||
final class SinkCallable = SinkModelCallable;
|
||||
|
||||
/**
|
||||
* A callable where there exists a MaD source model that applies to it.
|
||||
*/
|
||||
private class SourceModelCallableAdapter extends SourceModelCallable {
|
||||
private Provenance provenance;
|
||||
|
||||
SourceModelCallableAdapter() {
|
||||
SourceSinkInterpretationInput::sourceElement(this, _, _, provenance, _)
|
||||
}
|
||||
|
||||
override predicate hasProvenance(Provenance p) { provenance = p }
|
||||
}
|
||||
|
||||
final class SourceCallable = SourceModelCallable;
|
||||
|
||||
@@ -6,6 +6,13 @@ extensions:
|
||||
- [ "Sinks", "NewSinks", False, "Sink", "(System.Object)", "", "Argument[0]", "test-sink", "manual"]
|
||||
- [ "Sinks", "NewSinks", False, "Sink2", "(System.Object)", "", "Argument[0]", "test-sink2", "manual"]
|
||||
- [ "Sinks", "NewSinks", False, "ManualSinkAlreadyDefined", "(System.Object)", "", "Argument[0]", "test-sink", "manual"]
|
||||
- [ "Sinks", "NewSinks", False, "SaveAndGet", "(System.Object)", "", "Argument[0]", "test-sink", "df-generated"]
|
||||
|
||||
- addsTo:
|
||||
pack: codeql/csharp-all
|
||||
extensible: sourceModel
|
||||
data:
|
||||
- [ "Sinks", "NewSinks", False, "SaveAndGet", "(System.Object)", "", "ReturnValue", "test-source", "manual"]
|
||||
|
||||
- addsTo:
|
||||
pack: codeql/csharp-all
|
||||
|
||||
@@ -24,6 +24,15 @@ public class NewSinks
|
||||
// neutral=Sinks;NewSinks;NoSink;(System.Object);summary;df-generated
|
||||
public static void NoSink(object o) => throw null;
|
||||
|
||||
// Sink and Source defined in the extensible file next to the sink test.
|
||||
// sink=Sinks;NewSinks;false;SaveAndGet;(System.Object);;Argument[0];test-sink;df-generated
|
||||
// neutral=Sinks;NewSinks;SaveAndGet;(System.Object);summary;df-generated
|
||||
public static object SaveAndGet(object o)
|
||||
{
|
||||
Sink(o);
|
||||
return null;
|
||||
}
|
||||
|
||||
// New sink
|
||||
// sink=Sinks;NewSinks;false;WrapResponseWrite;(System.Object);;Argument[0];html-injection;df-generated
|
||||
// neutral=Sinks;NewSinks;WrapResponseWrite;(System.Object);summary;df-generated
|
||||
|
||||
Reference in New Issue
Block a user