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?
I have asked this same question at two different places, below is the link for that.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello, I'm fairly new to codeql so if I'm using codeql terms or statements incorrectly, apologies for that.
I have this simple Test class, where I'm trying to mimic a path problem.
with
Message1as 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";assourceandConsole.WriteLine(Message1);assinki'm getting correct result, But fornon constfieldprivate 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?
I have asked this same question at two different places, below is the link for that.
stackoverflow question
github/codeql/issues/9569
All reactions