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

Add fuzz targets for certificates, cert chains and CRLs #346

Open
wants to merge 107 commits into
base: master
Choose a base branch
from

Conversation

mregen
Copy link
Owner

@mregen mregen commented Aug 5, 2024

Proposed changes

Only local tests

Related Issues

  • Fixes #

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply. You can also fill these out after creating the PR.

  • 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

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • 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.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

mregen and others added 28 commits September 26, 2024 12:58
…dation#2773)

For convenience, the DirectoryStore class creates the default folders when the DirectoryStore is opened. (since OPCFoundation#2720)
However this may lead into issues mapping folders to the store when started in docker.

Fix: remove the code which creates default folders and ensure a null directory does not throw a NullReferenceException.
)

Bumps [Serilog](https://github.com/serilog/serilog) and [System.Diagnostics.DiagnosticSource](https://github.com/dotnet/runtime). These dependencies needed to be updated together.

Updates `Serilog` from 4.0.1 to 4.0.2
- [Release notes](https://github.com/serilog/serilog/releases)
- [Commits](serilog/serilog@v4.0.1...v4.0.2)

Updates `System.Diagnostics.DiagnosticSource` from 6.0.1 to 8.0.1
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](dotnet/runtime@v6.0.1...v8.0.1)

---
updated-dependencies:
- dependency-name: Serilog
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: System.Diagnostics.DiagnosticSource
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…st method of Server (OPCFoundation#2778)

* Enable regeneratePrivatekey for CreateSigningRequest method of Server
* only put needed info into cert, limit lifetime, use public key to get the key size
… attribute is null (OPCFoundation#2746)

Handle a case where a misconfigured server returns a null value for an attribute when a value type is expected. To avoid the NullReferenceException that stops the whole ReadNodes operation, flag the Node with the service result and or return a default value if required.
A new method is implemented which reads byte strings in chunks and therefore allows to read byte strings which exceed the encoding limits of the server. This is used in the method which reads v103 data dictionaries.
…sion in ISystemContext During Notification Process (OPCFoundation#2779)

Check the Session included in the ISystemContext instance, if any, and compare it with those belonging to the monitored items.
If the ISystemContext instance contains a Session, the event will be appended only to the monitored items belonging to the same Session.
If the ISystemContext instance does not contain a Session, the event will be appended to all monitored items, regardless of their sessions.
…undation#2735)

- Update the Server Endpoint Descriptions after certificate update e.g. from a GDS Push.
Until this PR the server needed a restart.
Moved the modified reference server from the unit test to its own file. 
Also moved the modified server side session, the modified session manager and the modified master node manager to the same file.
…sks when a change is notified (OPCFoundation#2772)

It fixes OPCFoundation#2656 by including in the SystemContext (taken as an argument to the OnMonitoredNodeChanged method) the Server session related to the current MonitoredItem that is going to be passed to the QueueValue.
…ChangeMasks when a change is notified (OPCFoundation#2772)" (OPCFoundation#2792)

This reverts commit 9c7b321.
During manual tests the new code ran into an ArgumentNullException creating a new OperationContext.
…bose WriteStatusCode (OPCFoundation#2794)

-JSON Encoder Verbose and NonReversible encoding with WriteStatusCode may produce invalid JSON
-ExpandedNodeId.Format does not handle not well formed uri correctly, as in the previous implementation
…OPCFoundation#2798)

The server under test has a extension object with a complex type.  Type id = {nsu=http://opcfoundation.org/UA/Machinery/Result/;i=5008}.  This contains something with a variant array that is null though (-1).  SetProperty should support setting a Array that is null.  Therefore, test for null collection (case when length was encoded as -1) before dereferencing ahead of the ToArrray() conversion to Array.
returndiagnostics was not propagated to recreated and reconnected sessions
* an exception in FetchOperationLimits may have skipped applying the configured operation limits on the server
JSON ReadEnumeratedString does not decode the number in e.g. "Red_0".
JSON reencode of JSON content in an extension object runs into an encoder error.
* improve crl handling in certificate stores by not loading CRL with invalid or unsupported content. Hence the revocation check for such certificates may fail.
…ed lower/uppercase letters in the <hostname> of the Uri.(OPCFoundation#2837)

Uri.TryCreate lower cases the hostnames. Switch always back to the legacy implementation which maintains the casing.
…ndation#2846)

- Channels are not disposed (client and server)
- During long running tests an HMAC object leak was observed.
- The HMAC and SymmetricSign objects were not disposed after use, leading to a small incremental memory leak per key renewal. 
- The channel token lifetime is calculated by the system clock, which can change. Instead use the continous HiResClock.TickCount to calculate the lifetimes.
- Token renewal and connection requests are not removed from the request dictionary

Improvements:
- Make ChannelToken disposable. Dispose channels.
- Dispose HMAC and SymmetricSign objects after use.
- Use TickCount to calculate key renewal and key expiry.
- Introduce a 5% jitter to the token renewal timer, to avoid token renewal storms.
- Reduce the allocation per use of the HMAC objects by using ReadOnlySpan and avoid MemoryStream.
…el (OPCFoundation#2850)

Clients that are failing too often to pass the security validationin a certain interval of time with the Basic128 security profile are now tracked and blocked.
ValidateRolePermissions for MIs montioring the Value of a Node
… user identity to allow validation when no session is present (OPCFoundation#2832)

* ValidateRolePermissions for MIs montioring the Value of a Node
* allow validation of user identity also in case of disconnected session
* support .NET 9.0 build
* provide a helper to use the X509CertificateLoader also on older .NET versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants