You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import csharp
import DataFlow::PathGraph
classSourceextends DataFlow::Node{Source(){this.asExpr()instanceofStringLiteral}}classWriteLineMethodextendsMethod{WriteLineMethod(){this.hasQualifiedName("System.Console.WriteLine")}}classSinkextends DataFlow::Node{Sink(){exists(MethodCallm|m.getTarget()instanceofWriteLineMethodandthis.asExpr()=m.getArgument(0))}}classSimpleConfigurationextends TaintTracking::Configuration{SimpleConfiguration(){this="Simple configuration"}overridepredicateisSource(DataFlow::Nodesource){sourceinstanceofSource}overridepredicateisSink(DataFlow::Nodesink){sinkinstanceofSink}}from DataFlow::PathNodesource, DataFlow::PathNodesink,SimpleConfigurationcfgwherecfg.hasFlowPath(source,sink)selectsink.getNode(),source,sink,"$@ is used in WriteLine method.",source.getNode(),"String"
Here I did simple taint tracking analysis on above Test class using above query, for const field private const string Message1 = "Test Message 1"; as source and Console.WriteLine(Message1); as sink i'm getting correct result, But for non const field private readonly string Message2 = "Test Message 2"; it doesn't seem to work.
Did i miss something here? why does taint tracking works for const field or static field in static class but not for instance field?
The text was updated successfully, but these errors were encountered:
I have this simple Test class, where I'm trying to mimic a path problem.
with
Message1
as source andConsole.WriteLine(Message1)
as sink.Here I did simple taint tracking analysis on above Test class using above query, for const field
private const string Message1 = "Test Message 1";
assource
andConsole.WriteLine(Message1);
assink
i'm getting correct result, But fornon const
fieldprivate readonly string Message2 = "Test Message 2";
it doesn't seem to work.Did i miss something here? why does taint tracking works for const field or static field in static class but not for instance field?
The text was updated successfully, but these errors were encountered: