mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #121 from hvitved/csharp/sync-test-files
C#: Synchronize a few test files
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
class Bad
|
||||
{
|
||||
private int id;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
class Good
|
||||
{
|
||||
private int id;
|
||||
@@ -12,7 +14,7 @@ class Good
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ class Good
|
||||
}
|
||||
entry.ExtractToFile(destFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// semmle-extractor-options: /r:System.Linq.dll
|
||||
@@ -42,5 +42,3 @@ public class Good
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// semmle-extractor-options: /r:System.Linq.dll
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace RootCert
|
||||
{
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user