Skip to content

Commit c1c3702

Browse files
author
Bob Pokorny
committed
Bumped up various packages that were obsolete or contained vulnerabilities. Also re-factored code to eliminate warnings.
1 parent b6eae11 commit c1c3702

File tree

14 files changed

+71
-20
lines changed

14 files changed

+71
-20
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
* Fixed error when attempting to connect to remote computer using UO service account
33
* Fixed the creation of a certificate when the Cryptographic Service Provider was changed by the user
44
* Updated logic when getting the CSP. Now supports modern CHG and legacy CAPI APIs. This will allow the CSP to show in the stores inventory.
5+
* Re-factored code to eliminate warnings
6+
* Bumped up he following packages to eliminate .net vulnerabilities and obsolete packages:
7+
* Keyfactor.Orchestrators.IOrchestratorJobExtensions" Version="1.0.0"
8+
* Microsoft.PowerShell.SDK" Version="7.4.10" Condition="'$(TargetFramework)' == 'net8.0'"
9+
* runtime.linux-arm64.runtime.native.System.IO.Ports" Version="9.0.5"
10+
* runtime.osx-arm64.runtime.native.System.IO.Ports" Version="9.0.5"
11+
* System.Formats.Asn1" Version="8.0.2" Condition="'$(TargetFramework)' == 'net6.0'"
12+
* System.Formats.Asn1" Version="9.0.0" Condition="'$(TargetFramework)' == 'net8.0'"
13+
* System.IO.Packaging" Version="6.0.2" Condition="'$(TargetFramework)' == 'net6.0'"
14+
* System.IO.Packaging" Version="8.0.1" Condition="'$(TargetFramework)' == 'net8.0'"
15+
* System.Text.Json" Version="8.0.5"
516

617
2.6.1
718
* Documentation updates for the 2.6 release

IISU/ClientPSCertStoreReEnrollment.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Ignore Spelling: Keyfactor
15+
// Ignore Spelling: Keyfactor Reenrollment
1616

1717
// 021225 rcp Cleaned up and removed unnecessary code
1818

@@ -40,7 +40,9 @@ internal class ClientPSCertStoreReEnrollment
4040
private readonly IPAMSecretResolver _resolver;
4141

4242
private PSHelper _psHelper;
43+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
4344
private Collection<PSObject>? _results;
45+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
4446

4547
public ClientPSCertStoreReEnrollment(ILogger logger, IPAMSecretResolver resolver)
4648
{

IISU/ImplementedStoreTypes/Win/Inventory.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
// 021225 rcp 2.6.0 Cleaned up and verified code
1616

17+
// Ignore Spelling: Keyfactor
18+
1719
using System;
1820
using System.Collections.Generic;
1921
using System.Collections.ObjectModel;
@@ -31,9 +33,11 @@ public class Inventory : WinCertJobTypeBase, IInventoryJobExtension
3133
{
3234
private ILogger _logger;
3335
public string ExtensionName => "WinCertInventory";
34-
36+
37+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3538
Collection<PSObject>? results = null;
36-
39+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
40+
3741
public Inventory()
3842
{
3943

IISU/ImplementedStoreTypes/Win/Management.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.using Keyfactor.Logging;
1414

15-
// Ignore Spelling: Keyfactor
15+
// Ignore Spelling: Keyfactor crypto
1616

1717
// 021225 rcp 2.6.0 Cleaned up and verified code
1818

@@ -35,7 +35,9 @@ public class Management : WinCertJobTypeBase, IManagementJobExtension
3535
private ILogger _logger;
3636

3737
private PSHelper _psHelper;
38+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3839
private Collection<PSObject>? _results = null;
40+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3941

4042
// Function wide config values
4143
private string _clientMachineName = string.Empty;
@@ -95,7 +97,9 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
9597
{
9698
string certificateContents = config.JobCertificate.Contents;
9799
string privateKeyPassword = config.JobCertificate.PrivateKeyPassword;
100+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
98101
string? cryptoProvider = config.JobProperties["ProviderName"]?.ToString();
102+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
99103

100104
complete = AddCertificate(certificateContents, privateKeyPassword, cryptoProvider);
101105
_logger.LogTrace($"Completed adding the certificate to the store");

IISU/ImplementedStoreTypes/WinIIS/IISBindingInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Ignore Spelling: Keyfactor IISU
15+
// Ignore Spelling: Keyfactor IISU Sni Aliase
1616

1717
// 021225 rcp 2.6.0 Cleaned up and verified code
1818

@@ -29,7 +29,9 @@ public class IISBindingInfo
2929
public string Protocol { get; set; }
3030
public string IPAddress { get; set; }
3131
public string Port { get; set; }
32+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3233
public string? HostName { get; set; }
34+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3335
public string SniFlag { get; set; }
3436
public string Thumbprint { get; private set; }
3537

IISU/ImplementedStoreTypes/WinIIS/Inventory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
// 021225 rcp 2.6.0 Cleaned up and verified code
1616

17+
// Ignore Spelling: Keyfactor IISU
18+
1719
using Keyfactor.Logging;
1820
using Keyfactor.Orchestrators.Common.Enums;
1921
using Keyfactor.Orchestrators.Extensions;
@@ -30,7 +32,9 @@ namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
3032
public class Inventory : WinCertJobTypeBase, IInventoryJobExtension
3133
{
3234
private ILogger _logger;
35+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3336
Collection<PSObject>? results = null;
37+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3438

3539
public string ExtensionName => "WinIISUInventory";
3640

IISU/ImplementedStoreTypes/WinIIS/Management.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// Ignore Spelling: Keyfactor IISU Crypto
1516
using System;
1617
using System.Collections.Generic;
1718
using System.Collections.ObjectModel;
@@ -34,7 +35,9 @@ public class Management : WinCertJobTypeBase, IManagementJobExtension
3435
private ILogger _logger;
3536

3637
private PSHelper _psHelper;
38+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3739
private Collection<PSObject>? _results = null;
40+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3841

3942
// Function wide config values
4043
private string _clientMachineName = string.Empty;
@@ -99,7 +102,9 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
99102
{
100103
string certificateContents = config.JobCertificate.Contents;
101104
string privateKeyPassword = config.JobCertificate.PrivateKeyPassword;
105+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
102106
string? cryptoProvider = config.JobProperties["ProviderName"]?.ToString();
107+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
103108

104109
// Add Certificate to Cert Store
105110
try

IISU/ImplementedStoreTypes/WinIIS/WinIISBinding.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
// 021225 rcp 2.6.0 Cleaned up and verified code
1616

17+
// Ignore Spelling: Keyfactor IISU
18+
1719
using Keyfactor.Logging;
1820
using Microsoft.Extensions.Logging;
1921
using System;
@@ -25,9 +27,9 @@ namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
2527
{
2628
public class WinIISBinding
2729
{
28-
private static ILogger _logger;
29-
private static Collection<PSObject>? _results = null;
30-
private static PSHelper _helper;
30+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
31+
private static ILogger? _logger;
32+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3133

3234
public static Collection<PSObject> BindCertificate(PSHelper psHelper, IISBindingInfo bindingInfo, string thumbprint, string renewalThumbprint, string storePath)
3335
{

IISU/ImplementedStoreTypes/WinSQL/Inventory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public class Inventory : WinCertJobTypeBase, IInventoryJobExtension
3535
private ILogger _logger;
3636
public string ExtensionName => "WinSqlInventory";
3737

38+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3839
Collection<PSObject>? results = null;
40+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3941

4042
public Inventory()
4143
{

IISU/ImplementedStoreTypes/WinSQL/Management.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Ignore Spelling: thumbprint Keyfactor sql
15+
// Ignore Spelling: thumbprint Keyfactor sql crypto
1616

1717
// 021225 rcp 2.6.0 Cleaned up and verified code
1818

@@ -35,7 +35,9 @@ public class Management : WinCertJobTypeBase, IManagementJobExtension
3535
private ILogger _logger;
3636

3737
private PSHelper _psHelper;
38+
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3839
private Collection<PSObject>? _results = null;
40+
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
3941

4042
// Function wide config values
4143
private string _clientMachineName = string.Empty;
@@ -172,8 +174,6 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
172174
// Remove the certificate from the cert store
173175
complete = RemoveCertificate(config.JobCertificate.Alias);
174176
_logger.LogTrace($"Completed removing the certificate from the store");
175-
176-
break;
177177
}
178178
else
179179
{
@@ -184,7 +184,6 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
184184
FailureMessage = "Unable to unbind one or more certificates from the SQL Instances."
185185
};
186186
}
187-
188187
}
189188
catch (Exception ex)
190189
{
@@ -195,10 +194,9 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
195194
FailureMessage = ex.Message
196195
};
197196
}
198-
199-
_logger.LogTrace($"Completed unbinding and removing the certificate from the store");
200-
return complete;
201197
}
198+
_logger.LogTrace($"Completed unbinding and removing the certificate from the store");
199+
return complete;
202200
}
203201
}
204202

0 commit comments

Comments
 (0)