-
Notifications
You must be signed in to change notification settings - Fork 1
Enabledflg #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabledflg #4
Conversation
There was a problem hiding this 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.
| if (!(bool)connectionInfo[Constants.Enabled]) | ||
| { | ||
| _logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation..."); |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
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.
| 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..."); |
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
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.
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | |
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | |
| throw; |
There was a problem hiding this 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)}"); |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
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.
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | |
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | |
| return; |
| { | ||
| try | ||
| { | ||
| if (!(bool)connectionInfo[Constants.Enabled]) |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
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'.
| if (!(bool)connectionInfo[Constants.Enabled]) | |
| if (connectionInfo.TryGetValue(Constants.Enabled, out var enabledValue) && enabledValue is bool enabled && !enabled) |
epic 76681
feature 76636