Skip to content
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
2 changes: 2 additions & 0 deletions csharp/ql/src/API Abuse/IncorrectEqualsSignatureBad.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

class Bad
{
private int id;
Expand Down
4 changes: 3 additions & 1 deletion csharp/ql/src/API Abuse/IncorrectEqualsSignatureGood.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

class Good
{
private int id;
Expand All @@ -12,7 +14,7 @@ public bool Equals(Good g) =>

public override bool Equals(object o)
{
if (o is Good g && g.GetType() = typeof(Good))
if (o is Good g && g.GetType() == typeof(Good))
return this.Equals(g);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/ql/src/Security Features/CWE-022/ZipSlipGood.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static void WriteToDirectory(ZipArchiveEntry entry,
}
entry.ExtractToFile(destFileName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow

class AddCertToRootStoreConfig extends DataFlow::Configuration {
AddCertToRootStoreConfig() { this = "Adding Certificate To Root Store" }
override predicate isSource(DataFlow::Node source) {
exists(ObjectCreation oc | oc = source.asExpr() |

override predicate isSource(DataFlow::Node source) {
exists(ObjectCreation oc | oc = source.asExpr() |
oc.getType().(RefType).hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store") and
oc.getArgument(0).(Access).getTarget().hasName("Root")
)
}

override predicate isSink(DataFlow::Node sink) {
exists(MethodCall mc |
(mc.getTarget().hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "Add") or
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// semmle-extractor-options: /r:System.Linq.dll
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ public void ModelChanged()
}
}
}

// semmle-extractor-options: /r:System.Linq.dll
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void InstallRootCertRange()
{
string file1 = "mytest1.pfx"; // Contains name of certificate file
string file2 = "mytest2.pfx"; // Contains name of certificate file
var certCollection = new X509Certificate2[] {
new X509Certificate2(X509Certificate2.CreateFromCertFile(file1)),
var certCollection = new X509Certificate2[] {
new X509Certificate2(X509Certificate2.CreateFromCertFile(file1)),
new X509Certificate2(X509Certificate2.CreateFromCertFile(file2)),
};
X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
Expand Down