Merge pull request #121 from hvitved/csharp/sync-test-files

C#: Synchronize a few test files
This commit is contained in:
calumgrant
2018-09-04 15:01:19 +01:00
committed by GitHub
7 changed files with 13 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
using System;
class Bad
{
private int id;

View File

@@ -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;
}

View File

@@ -14,4 +14,4 @@ class Good
}
entry.ExtractToFile(destFileName);
}
}
}

View File

@@ -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

View File

@@ -0,0 +1 @@
// semmle-extractor-options: /r:System.Linq.dll

View File

@@ -42,5 +42,3 @@ public class Good
}
}
}
// semmle-extractor-options: /r:System.Linq.dll

View File

@@ -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);