Skip to content

Commit 98aa7f8

Browse files
authored
Merge pull request #121 from hvitved/csharp/sync-test-files
C#: Synchronize a few test files
2 parents cbca1e1 + 809da42 commit 98aa7f8

File tree

7 files changed

+13
-10
lines changed

7 files changed

+13
-10
lines changed

csharp/ql/src/API Abuse/IncorrectEqualsSignatureBad.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
class Bad
24
{
35
private int id;

csharp/ql/src/API Abuse/IncorrectEqualsSignatureGood.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
class Good
24
{
35
private int id;
@@ -12,7 +14,7 @@ public bool Equals(Good g) =>
1214

1315
public override bool Equals(object o)
1416
{
15-
if (o is Good g && g.GetType() = typeof(Good))
17+
if (o is Good g && g.GetType() == typeof(Good))
1618
return this.Equals(g);
1719
return false;
1820
}

csharp/ql/src/Security Features/CWE-022/ZipSlipGood.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public static void WriteToDirectory(ZipArchiveEntry entry,
1414
}
1515
entry.ExtractToFile(destFileName);
1616
}
17-
}
17+
}

csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow
1313

1414
class AddCertToRootStoreConfig extends DataFlow::Configuration {
1515
AddCertToRootStoreConfig() { this = "Adding Certificate To Root Store" }
16-
17-
override predicate isSource(DataFlow::Node source) {
18-
exists(ObjectCreation oc | oc = source.asExpr() |
16+
17+
override predicate isSource(DataFlow::Node source) {
18+
exists(ObjectCreation oc | oc = source.asExpr() |
1919
oc.getType().(RefType).hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store") and
2020
oc.getArgument(0).(Access).getTarget().hasName("Root")
2121
)
2222
}
23-
23+
2424
override predicate isSink(DataFlow::Node sink) {
2525
exists(MethodCall mc |
2626
(mc.getTarget().hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "Add") or
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// semmle-extractor-options: /r:System.Linq.dll

csharp/ql/test/query-tests/Architecture/Dependencies/MutualDependency/MutualDependencyGood.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,3 @@ public void ModelChanged()
4242
}
4343
}
4444
}
45-
46-
// semmle-extractor-options: /r:System.Linq.dll

csharp/ql/test/query-tests/Security Features/CWE-327/DontInstallRootCert/Test.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public void InstallRootCertRange()
6565
{
6666
string file1 = "mytest1.pfx"; // Contains name of certificate file
6767
string file2 = "mytest2.pfx"; // Contains name of certificate file
68-
var certCollection = new X509Certificate2[] {
69-
new X509Certificate2(X509Certificate2.CreateFromCertFile(file1)),
68+
var certCollection = new X509Certificate2[] {
69+
new X509Certificate2(X509Certificate2.CreateFromCertFile(file1)),
7070
new X509Certificate2(X509Certificate2.CreateFromCertFile(file2)),
7171
};
7272
X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);

0 commit comments

Comments
 (0)