mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Added comments to the test file. Fixed a typo.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
| Test.cs:19:13:19:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
| Test.cs:28:13:28:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
| Test.cs:69:13:69:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
| Test.cs:20:13:20:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
| Test.cs:30:13:30:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
| Test.cs:75:13:75:17 | access to local variable store | Certificate added to the root certificate store. Do not add certificates to root certificate store. |
|
||||
|
||||
@@ -11,20 +11,22 @@ namespace RootCert
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
public void InstallRoorCert()
|
||||
public void InstallRootCert()
|
||||
{
|
||||
string file = "mytest.pfx"; // Contains name of certificate file
|
||||
X509Store store = new X509Store(StoreName.Root);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// BAD: adding a certificate to the Root store
|
||||
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
|
||||
store.Close();
|
||||
}
|
||||
|
||||
public void InstallRoorCert2()
|
||||
public void InstallRootCert2()
|
||||
{
|
||||
string file = "mytest.pfx"; // Contains name of certificate file
|
||||
X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// BAD: adding a certificate to the Root store
|
||||
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
|
||||
store.Close();
|
||||
}
|
||||
@@ -34,6 +36,7 @@ namespace RootCert
|
||||
string file = "mytest.pfx"; // Contains name of certificate file
|
||||
X509Store store = new X509Store(StoreName.My);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// GOOD: adding a certificate to My store
|
||||
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
|
||||
store.Close();
|
||||
}
|
||||
@@ -43,6 +46,7 @@ namespace RootCert
|
||||
string file = "mytest.pfx"; // Contains name of certificate file
|
||||
X509Store store = new X509Store(StoreName.My);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// GOOD: removing a certificate from My store
|
||||
store.Remove(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
|
||||
store.Close();
|
||||
}
|
||||
@@ -52,11 +56,12 @@ namespace RootCert
|
||||
string file = "mytest.pfx"; // Contains name of certificate file
|
||||
X509Store store = new X509Store(StoreName.Root);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// GOOD: removing a certificate from Root store
|
||||
store.Remove(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
|
||||
store.Close();
|
||||
}
|
||||
|
||||
public void InstallRoorCertRange()
|
||||
public void InstallRootCertRange()
|
||||
{
|
||||
string file1 = "mytest1.pfx"; // Contains name of certificate file
|
||||
string file2 = "mytest2.pfx"; // Contains name of certificate file
|
||||
@@ -66,6 +71,7 @@ namespace RootCert
|
||||
};
|
||||
X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
|
||||
store.Open(OpenFlags.ReadWrite);
|
||||
// BAD: adding multiple certificates to the Root store
|
||||
store.AddRange(new X509Certificate2Collection(certCollection));
|
||||
store.Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user