Skip to content
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

[Server] Fix: Return full CertificateChain after Certificate Update #2855

Closed

Conversation

romanett
Copy link
Contributor

@romanett romanett commented Nov 23, 2024

Proposed changes

Fix the CertificateTypesProvider to also return the correct chain after a CertificateUpdate occured.

Related Issues

  • Fixes #

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

@romanett romanett marked this pull request as ready for review November 23, 2024 16:47
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

Attention: Patch coverage is 78.04878% with 9 lines in your changes missing coverage. Please review.

Project coverage is 55.30%. Comparing base (ce33d63) to head (bef4079).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../Security/Certificates/CertificateTypesProvider.cs 78.57% 1 Missing and 2 partials ⚠️
...a.Server/Configuration/ConfigurationNodeManager.cs 81.81% 2 Missing ⚠️
...ndings.Https/Stack/Https/HttpsTransportListener.cs 0.00% 2 Missing ⚠️
Stack/Opc.Ua.Core/Stack/Server/ServerBase.cs 85.71% 0 Missing and 1 partial ⚠️
....Ua.Core/Stack/Tcp/UaSCBinaryChannel.Asymmetric.cs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2855      +/-   ##
==========================================
- Coverage   55.70%   55.30%   -0.41%     
==========================================
  Files         352      352              
  Lines       67332    67342      +10     
  Branches    13806    13805       -1     
==========================================
- Hits        37506    37241     -265     
- Misses      25792    26019     +227     
- Partials     4034     4082      +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@romanett romanett marked this pull request as draft November 23, 2024 17:00
@romanett romanett marked this pull request as ready for review November 24, 2024 08:00
@@ -134,7 +134,13 @@ public byte[] LoadCertificateChainRaw(X509Certificate2 certificate)
return result.Item2;
}

return certificate.RawData;
// load certificate chain.
Copy link
Contributor

Choose a reason for hiding this comment

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

This change contradicts the idea of the cache, which was that certs and certchains are being updated outside the normal create session flows, once.
Then no async load operation has to be done and no async has to be wired up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mregen but shouldn't we handle a "Cache miss". I can change the logic back to a separate update function, If we don't need this

Copy link
Contributor

Choose a reason for hiding this comment

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

Question is why we have a cache miss, it should be loaded once on startup, or when application certificates are updated. handling the cache miss is a band aid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, I will rewrite to loop all security policies to update each of the application certificates on certificate update. I did not think the async overhead was such a concern.

@romanett romanett closed this Nov 26, 2024
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.

2 participants