Skip to content

Conversation

@bhillkeyfactor
Copy link
Collaborator

epic 76681
feature 76636

@spbsoluble spbsoluble requested a review from Copilot October 6, 2025 15:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an "Enabled" flag feature to the Digicert MPKI CA plugin, allowing administrators to disable gateway functionality while keeping the CA configuration intact. It also adds dual framework support for .NET 6.0 and 8.0.

  • Added an "Enabled" boolean configuration parameter with default value true
  • Updated build configuration to support both .NET 6.0 and 8.0 target frameworks
  • Modified plugin logic to check the enabled state and skip operations when disabled

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
integration-manifest.json Updated schema URL and build configuration for dual framework support
digicert-mpki-caplugin.csproj Added .NET 8.0 as additional target framework
DigicertMpkiConfig.cs Added Enabled property with default value true
DigicertMpkiCAPlugin.cs Implemented enabled state checking in Initialize and ValidateCAConnectionInfo methods
Constants.cs Added Enabled constant for configuration key
README.md Updated documentation to reflect dual framework support and new Enabled parameter
CHANGELOG.md Added changelog entries for version 1.1.0 features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +309 to +311
if (!(bool)connectionInfo[Constants.Enabled])
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct casting without null check could cause InvalidCastException if the Enabled key is missing or contains a non-boolean value. Consider using TryGetValue and safe casting.

Suggested change
if (!(bool)connectionInfo[Constants.Enabled])
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
if (!connectionInfo.TryGetValue(Constants.Enabled, out object enabledObj) || !(enabledObj is bool enabled) || !enabled)
{
_logger.LogWarning($"The CA is currently in the Disabled state or the Enabled flag is missing/invalid. It must be Enabled to perform operations. Skipping validation...");

Copilot uses AI. Check for mistakes.
}
catch (Exception ex)
{
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block logs the exception but continues execution, which could lead to unexpected behavior. The method should either handle the missing Enabled key gracefully or rethrow the exception after logging.

Suggested change
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
throw;

Copilot uses AI. Check for mistakes.
@spbsoluble spbsoluble requested a review from Copilot October 15, 2025 15:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
catch (Exception ex)
{
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block logs the exception but doesn't handle it, allowing execution to continue to line 320 even when an exception occurs accessing connectionInfo[Constants.Enabled]. This could lead to unexpected behavior. Either rethrow the exception after logging, or ensure the validation logic at line 320 can handle the error state appropriately.

Suggested change
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
return;

Copilot uses AI. Check for mistakes.
{
try
{
if (!(bool)connectionInfo[Constants.Enabled])
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct cast to bool will throw InvalidCastException if the value is null or not a boolean type. Use safer casting like 'connectionInfo.TryGetValue(Constants.Enabled, out var enabledValue) && enabledValue is bool enabled && !enabled' or provide a default value with 'as bool? ?? true'.

Suggested change
if (!(bool)connectionInfo[Constants.Enabled])
if (connectionInfo.TryGetValue(Constants.Enabled, out var enabledValue) && enabledValue is bool enabled && !enabled)

Copilot uses AI. Check for mistakes.
@spbsoluble spbsoluble merged commit fdee6de into release-1.1 Oct 15, 2025
30 checks passed
@spbsoluble spbsoluble deleted the enabledflg branch October 15, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants