Skip to content

C#: Update the alert messages to better follow the style guide #10557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ where
xor2.getAnOperand() = v.getAnAccess()
)
)
select l,
"The variable $@ seems to be used as part of a FNV-like hash calculation, that is modified by an additional $@ expression using literal $@.",
v, v.toString(), additional_xor, "xor", l, l.toString()
select l, "This literal is used in an $@ after an FNV-like hash calculation with variable $@.",
additional_xor, "additional xor", v, v.toString()
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ where
total = countSolorigateCommandInEnum(e) and
total > 10
select e,
"The enum $@ may be related to Solorigate. It matches " + total +
" of the values used for commands in the enum.", e, e.getName()
"This enum may be related to Solorigate. It matches " + total +
" of the values used for commands in the enum."
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ where
isSolorigateHash(l) and
total > threshold
select l,
"The Hash literal $@ may be related to the Solorigate campaign. Total count = " + total +
" is above the threshold " + threshold + ".", l, l.getValue()
"This Hash literal may be related to the Solorigate campaign. Total count = " + total +
" is above the threshold " + threshold + "."
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ where
isSolorigateLiteral(l) and
total > threshold
select l,
"The literal $@ may be related to the Solorigate campaign. Total count = " + total +
" is above the threshold " + threshold + ".", l, l.getValue()
"This literal may be related to the Solorigate campaign. Total count = " + total +
" is above the threshold " + threshold + "."
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ where
isSolorigateSuspiciousMethodName(m) and
total > threshold
select m,
"The method $@ may be related to Solorigate. Total count = " + total + " is above the threshold " +
threshold + ".", m, m.getName()
"This method may be related to Solorigate. Total count = " + total + " is above the threshold " +
threshold + "."
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| test.cs:39:16:39:36 | 6605813339339102567 | The variable $@ seems to be used as part of a FNV-like hash calculation, that is modified by an additional $@ expression using literal $@. | test.cs:25:9:25:11 | num | num | test.cs:39:10:39:36 | ... ^ ... | xor | test.cs:39:16:39:36 | 6605813339339102567 | 6605813339339102567 |
| test.cs:39:16:39:36 | 6605813339339102567 | This literal is used in an $@ after a FNV-like hash calculation with variable $@. | test.cs:39:10:39:36 | ... ^ ... | additional xor | test.cs:25:9:25:11 | num | num |
4 changes: 2 additions & 2 deletions csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ where
exists(MethodCall callToEquals |
callToEquals.getTarget() instanceof EqualsMethod and
callToEquals.getQualifier().getType() = c and
message = "but it is called $@" and
message = "but $@" and
item = callToEquals and
itemText = "here"
itemText = "'Equals' is called on an instance of this class"
)
or
item = c.getAnOperator().(EQOperator) and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ predicate mayNotBeDisposed(LocalScopeDisposableCreation disposable) {

from LocalScopeDisposableCreation disposable
where mayNotBeDisposed(disposable)
select disposable, "Disposable '" + disposable.getType() + "' is created here but is not disposed."
select disposable, "Disposable '" + disposable.getType() + "' is created but not disposed."
2 changes: 1 addition & 1 deletion csharp/ql/src/CSI/NullAlways.ql
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ import semmle.code.csharp.dataflow.Nullness

from Dereference d, Ssa::SourceVariable v
where d.isFirstAlwaysNull(v)
select d, "Variable $@ is always null here.", v, v.toString()
select d, "Variable $@ is always null at this dereference.", v, v.toString()
Comment on lines 17 to +19

Check warning

Code scanning / CodeQL

Consistent alert message

The cs/dereferenced-value-is-always-null query does not have the same alert message as java.
3 changes: 2 additions & 1 deletion csharp/ql/src/CSI/NullMaybe.ql
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ import PathGraph
from
Dereference d, PathNode source, PathNode sink, Ssa::SourceVariable v, string msg, Element reason
where d.isFirstMaybeNull(v.getAnSsaDefinition(), source, sink, msg, reason)
select d, source, sink, "Variable $@ may be null here " + msg + ".", v, v.toString(), reason, "this"
select d, source, sink, "Variable $@ may be null at this access " + msg + ".", v, v.toString(),
reason, "this"
2 changes: 1 addition & 1 deletion csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ where
readaccess.getEnclosingCallable() = getter and
not exists(LockStmt readlock | readlock.getAChildStmt+().getAChildExpr+() = readaccess)
)
select p, "Field '$@' is guarded by a lock in the setter but not in the getter.", f, f.getName()
select p, "Field $@ is guarded by a lock in the setter but not in the getter.", f, f.getName()
5 changes: 2 additions & 3 deletions csharp/ql/src/Dead Code/NonAssignedFields.ql
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,5 @@ where
fa.getTarget() = g and
g.getUnboundDeclaration() = f
)
select f,
"The field '" + f.getName() + "' is never explicitly assigned a value, yet it is read $@.", fa,
"here"
select f, "The field '" + f.getName() + "' is never explicitly assigned a value, yet $@.", fa,
"the field is read"
2 changes: 1 addition & 1 deletion csharp/ql/src/Dead Code/UnusedField.ql
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ where
f.fromSource() and
isDeadField(f) and
not f.getDeclaringType().isPartial()
select f, "Unused field (or field used from dead method only)"
select f, "Unused field (or field used from dead method only)."
2 changes: 1 addition & 1 deletion csharp/ql/src/Dead Code/UnusedMethod.ql
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ where
m.fromSource() and
isDeadMethod(m) and
not m.getDeclaringType().isPartial()
select m, "Unused method (or method called from dead method only)"
select m, "Unused method (or method called from dead method only)."
2 changes: 1 addition & 1 deletion csharp/ql/src/Language Abuse/ForeachCapture.ql
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ predicate declaredInsideLoop(ForeachStmt loop, LocalVariable v) {

from LambdaDataFlowConfiguration c, AnonymousFunctionExpr lambda, Variable loopVar, Element storage
where c.capturesLoopVarAndIsStoredIn(lambda, loopVar, storage)
select lambda, "Function which may be stored in $@ captures variable $@", storage,
select lambda, "Function which may be stored in $@ captures variable $@.", storage,
storage.toString(), loopVar, loopVar.getName()
4 changes: 2 additions & 2 deletions csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ where
uselessIsBeforeAs(ae, ie) and
not exists(MethodCall mc | ae = mc.getAnArgument().getAChildExpr*())
select ae,
"This 'as' expression performs a type test - it should be directly compared against null, rendering the 'is' $@ potentially redundant.",
ie, "here"
"This 'as' expression performs a type test - it should be directly compared against null, rendering the $@ potentially redundant.",
ie, "is"
5 changes: 2 additions & 3 deletions csharp/ql/src/Linq/BadMultipleIteration.ql
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ where
va = seq.getAnAccess() and
potentiallyConsumingAccess(va) and
count(VariableAccess x | x = seq.getAnAccess() and potentiallyConsumingAccess(x)) > 1
select seq,
"This enumerable sequence may not be repeatable, but is potentially consumed multiple times $@.",
va, "here"
select seq, "This enumerable sequence may not be repeatable, but $@.", va,
"it is potentially consumed multiple times"
4 changes: 2 additions & 2 deletions csharp/ql/src/Linq/MissedCastOpportunity.ql
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ import Linq.Helpers
from ForeachStmt fes, LocalVariableDeclStmt s
where missedCastOpportunity(fes, s)
select fes,
"This foreach loop immediately casts its iteration variable to another type $@ - consider casting the sequence explicitly using '.Cast(...)'.",
s, "here"
"This foreach loop immediately $@ - consider casting the sequence explicitly using '.Cast(...)'.",
s, "casts its iteration variable to another type"
4 changes: 2 additions & 2 deletions csharp/ql/src/Linq/MissedOfTypeOpportunity.ql
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ import Linq.Helpers
from ForeachStmt fes, LocalVariableDeclStmt s
where missedOfTypeOpportunity(fes, s)
select fes,
"This foreach loop immediately uses 'as' to coerce its iteration variable to another type $@ - consider using '.OfType(...)' instead.",
s, "here"
"This foreach loop immediately uses 'as' to $@ - consider using '.OfType(...)' instead.", s,
"coerce its iteration variable to another type"
4 changes: 2 additions & 2 deletions csharp/ql/src/Linq/MissedSelectOpportunity.ql
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ where
missedSelectOpportunity(fes, s) and
not oversized(s)
select fes,
"This foreach loop immediately maps its iteration variable to another variable $@ - consider mapping the sequence explicitly using '.Select(...)'.",
s, "here"
"This foreach loop immediately $@ - consider mapping the sequence explicitly using '.Select(...)'.",
s, "maps its iteration variable to another variable"
4 changes: 2 additions & 2 deletions csharp/ql/src/Linq/MissedWhereOpportunity.ql
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ where
missedWhereOpportunity(fes, is) and
not missedAllOpportunity(fes)
select fes,
"This foreach loop implicitly filters its target sequence $@ - consider filtering the sequence explicitly using '.Where(...)'.",
is.getCondition(), "here"
"This foreach loop $@ - consider filtering the sequence explicitly using '.Where(...)'.",
is.getCondition(), "implicitly filters its target sequence"
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in a path.", source.getNode(),
"User-provided value"
select sink.getNode(), source, sink, "This path depends on a $@.", source.getNode(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the message starts with "this", while it doesn't for CommandInjection.ql.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for other queries; some start with "this" while others don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone for starting with "This " in most of the queries.
That way we are consistent about referencing the current location with "This".

"user-provided value"
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in a command.", source.getNode(),
"User-provided value"
select sink.getNode(), source, sink, "This command line depends on a $@.", source.getNode(),
"user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {

from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in a command.", source.getNode(),
"Stored user-provided value"
select sink.getNode(), source, sink, "This command line depends on a $@.", source.getNode(),
"stored (potentially user-provided) value"
8 changes: 4 additions & 4 deletions csharp/ql/src/Security Features/CWE-079/StoredXSS.ql
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ from
where
c.hasFlowPath(source, sink) and
if exists(sink.getNode().(Sink).explanation())
then explanation = ": " + sink.getNode().(Sink).explanation() + "."
else explanation = "."
then explanation = " (" + sink.getNode().(Sink).explanation() + ")"
else explanation = ""
select sink.getNode(), source, sink,
"$@ flows to here and is written to HTML or JavaScript" + explanation, source.getNode(),
"Stored user-provided value"
"This HTML or JavaScript write" + explanation + " depends on a $@.", source.getNode(),
"stored (potentially user-provided) value"
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends SqlInjection::TaintTrackingConfig

from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an SQL query.",
source.getNode(), "Stored user-provided value"
select sink.getNode(), source, sink, "This SQL query depends on a $@.", source.getNode(),
"stored user-provided value"
2 changes: 1 addition & 1 deletion csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ string getSourceType(DataFlow::Node node) {

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "Query might include code from $@.", source,
select sink.getNode(), source, sink, "This query depends on $@.", source,
("this " + getSourceType(source.getNode()))
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an LDAP query.",
source.getNode(), "User-provided value"
select sink.getNode(), source, sink, "This LDAP query depends on a $@.", source.getNode(),
"user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {

from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an LDAP query.",
source.getNode(), "Stored user-provided value"
select sink.getNode(), source, sink, "This LDAP query depends on a $@.", source.getNode(),
"stored (potentially user-provided) value"
3 changes: 2 additions & 1 deletion csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink, source, sink, "$@ flows to here and is inserted as XML.", source, "User-provided value"
select sink.getNode(), source, sink, "This XML element depends on a $@.", source.getNode(),
"user-provided value"
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is compiled as code.", source.getNode(),
"User-provided value"
select sink.getNode(), source, sink, "This code compilation depends on a $@.", source.getNode(),
"user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in a resource descriptor.",
source.getNode(), "User-provided value"
select sink.getNode(), source, sink, "This resource descriptor depends on a $@.", source.getNode(),
"user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"$@ flows to here and is processed as XML without validation because " +
sink.getNode().(Sink).getReason(), source.getNode(), "User-provided value"
"This XML processing depends on a $@ without validation because " +
sink.getNode().(Sink).getReason(), source.getNode(), "user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {

from TaintTrackingConfiguration c, DataFlow::Node source, DataFlow::Node sink
where c.hasFlow(source, sink)
select sink, "$@ flows to here and is used as the path to dynamically load an assembly.", source,
"User-provided value"
select sink, "This assembly path depends on a $@.", source, "user-provided value"
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-117/LogForging.ql
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to log entry.", source.getNode(),
"User-provided value"
select sink.getNode(), source, sink, "This log entry depends on a $@.", source.getNode(),
"user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ class FormatStringConfiguration extends TaintTracking::Configuration {
}
}

string getSourceType(DataFlow::Node node) {
result = node.(RemoteFlowSource).getSourceType()
or
result = node.(LocalFlowSource).getSourceType()
}

from FormatStringConfiguration config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used as a format string.",
source.getNode(), source.getNode().toString()
select sink.getNode(), source, sink, "This format string depends on $@.", source.getNode(),
("this" + getSourceType(source.getNode()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, there is an a too much.
I've removed the a such that the alert-message is similar to the one you use in cs/sql-injection.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {

from TaintTrackingConfiguration configuration, DataFlow::PathNode source, DataFlow::PathNode sink
where configuration.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"Sensitive information from $@ flows to here, and is transmitted to the user.", source.getNode(),
source.toString()
select sink.getNode(), source, sink, "This data transmitted to the user depends on $@.",
source.getNode(), "sensitive information"
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"Exception information from $@ flows to here, and is exposed to the user.", source.getNode(),
source.toString()
select sink.getNode(), source, sink, "This information exposed to the user depends on $@.",
source.getNode(), "exception information"
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "Sensitive data returned by $@ is stored here.",
select sink.getNode(), source, sink, "This stores sensitive data returned by $@ as clear text.",
source.getNode(), source.toString()
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ class StringLiteralSource extends KeySource {

from SymmetricKeyTaintTrackingConfiguration keyFlow, KeySource src, SymmetricEncryptionKeySink sink
where keyFlow.hasFlow(src, sink)
select sink, "Hard-coded symmetric $@ is used in symmetric algorithm in " + sink.getDescription(),
src, "key"
select sink, "This hard-coded $@ is used in symmetric algorithm in " + sink.getDescription(), src,
"symmetric key"
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration {

from DataFlow::PathNode oc, DataFlow::PathNode mc, AddCertToRootStoreConfig config
where config.hasFlowPath(oc, mc)
select mc.getNode(), oc, mc, "Certificate added to the root certificate store."
select mc.getNode(), oc, mc, "This certificate is added to the root certificate store."
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ class TaintTrackingConfiguration extends DataFlow::Configuration {

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and does not specify `Encrypt=True`.",
source.getNode(), "Connection string"
select sink.getNode(), source, sink,
"$@ flows to this SQL connection and does not specify `Encrypt=True`.", source.getNode(),
"Connection string"
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ where
loginMethod(loginMethod, fromLoginFlow) and
sessionUse(sessionUse.getElement()) and
controlStep+(loginCall.getASuccessorByType(fromLoginFlow), sessionUse)
select sessionUse, "This session has not been invalidated following the call to '$@'.", loginCall,
select sessionUse, "This session has not been invalidated following the call to $@.", loginCall,
loginMethod.getName()
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"$@ flows to here and is loaded insecurely as XML (" + sink.getNode().(Sink).getReason() + ").",
source.getNode(), "User-provided value"
"This insecure XML processing depends on a $@ (" + sink.getNode().(Sink).getReason() + ").",
source.getNode(), "user-provided value"
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends XPathInjection::TaintTrackingConf

from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an XPath expression.",
source.getNode(), "Stored user-provided value"
select sink.getNode(), source, sink, "This XPath expression depends on a $@.", source.getNode(),
"stored (potentially user-provided) value"
4 changes: 2 additions & 2 deletions csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph

from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an XPath expression.",
source.getNode(), "User-provided value"
select sink.getNode(), source, sink, "This XPath expression depends on a $@.", source.getNode(),
"user-provided value"
Loading