Commit Graph
1856 Commits
Author SHA1 Message Date
dependabot[bot] 8b83dbffbd Bump NUnit from 4.2.2 to 4.3.0 (#2911)
Bumps [NUnit](https://github.com/nunit/nunit) from 4.2.2 to 4.3.0.
- [Release notes](https://github.com/nunit/nunit/releases)
- [Changelog](https://github.com/nunit/nunit/blob/main/CHANGES.md)
- [Commits](https://github.com/nunit/nunit/compare/4.2.2...4.3.0)

---
updated-dependencies:
- dependency-name: NUnit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-17 11:41:59 +02:00
dependabot[bot] 69e83748ac Bump Nerdbank.GitVersioning from 3.6.146 to 3.7.112 (#2910)
Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.6.146 to 3.7.112.
- [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases)
- [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.6.146...v3.7.112)

---
updated-dependencies:
- dependency-name: Nerdbank.GitVersioning
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-17 11:38:31 +02:00
dependabot[bot] c87eca9186 Bump Serilog from 4.1.0 to 4.2.0 (#2891)
Bumps [Serilog](https://github.com/serilog/serilog) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/serilog/serilog/releases)
- [Commits](https://github.com/serilog/serilog/compare/v4.1.0...v4.2.0)

---
updated-dependencies:
- dependency-name: Serilog
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 08:48:48 +01:00
Martin Regen 0777bbdb51 Merge pull request #2889 from OPCFoundation/develop/main374
Merge main374 in ECC branch
2024-12-08 14:15:38 +01:00
Martin Regen 5ed73fcd95 merge latest release 2024-12-07 17:30:58 +01:00
romanett 67a0df1960 Fix read of NodeId attribute AccessRestrictions by casting return type from Enum to ushort (#2883)
In the read NodeId servcie call an enum is by default cast to Int32, so the cast to ushort is needed here to return the expected type for the AccessRestrictions.
2024-12-05 08:39:09 +01:00
romanett 6c62eb26fd Fix serialization of CertificateTrustList (#2879) 2024-12-04 09:42:19 +01:00
Suciu Mircea AdrianandMartin Regen d0e89a3bf1 Support mutual TLS on server https endpoints (#2849)
A new configuration variable 
    <HttpsMutualTls>true</HttpsMutualTls>
enables the mutual TLS authentication support. The behavior of the TLS endpoint changes as the following:

HttpsMutualTls is true:
The server checks the trust on the certificate which is used by the client for TLS authentication. It must be a valid OPC UA application certificate which is trusted.
A client can still connect without providing a client certificate, but then it is only able to call discovery services.
In order to create a session, the client must use the same application certificate that was used for the TLS channel.

HttpsMutualTls is false:
- There is no application authentication. The server endpoint uses security None and there is no client application authentication.
Instead, only user authentication is used to secure the server, anonymous user authentication is disabled.
Discovery service calls are supported.

Co-authored-by: Martin Regen <mregen@microsoft.com>
2024-12-03 12:43:39 +01:00
Martin Regen a887f909f1 Allow ExtensionObjects which are encoded with an unknown size (#2869)
An older OPC UA server returns well known extension object(811) which cannot be decoded by the client because the server doesn't set the length of the extension object. 
Recently, based on fuzz testing, the length check has been changed to enforce an exact match, according to spec.

Workaround: Allow a value of -1 for the length, then allow to decode well known extension objects.

Also improve some internal calls to Safe Read functions by calling not via the interface.
2024-12-03 12:06:11 +01:00
Martin Regenanddependabot[bot] 71a6e69d62 Bump BouncyCastle.Cryptography from 2.4.0 to 2.5.0, Serilog and Codecov (#2875)
* bump bouncy castle to 2.50

* Bump codecov/codecov-action from 4 to 5 (#2847)

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  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>

* Bump Serilog and System.Diagnostics.DiagnosticSource (#2818)

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.2 to 4.1.0
- [Release notes](https://github.com/serilog/serilog/releases)
- [Commits](https://github.com/serilog/serilog/compare/v4.0.2...v4.1.0)

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

---
updated-dependencies:
- dependency-name: Serilog
  dependency-type: direct:production
  update-type: version-update:semver-minor
- 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>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-03 11:25:58 +01:00
Martin Regen af7dc0f59d Merge pull request #2878 from OPCFoundation/mastercherrypicks
Merge fixes from master in stable branch
2024-12-03 10:55:36 +01:00
romanett 6f7b8e7cf7 [Client] Fix: KeepAliveInterval was not updated on ModifySubscription (#2871)
* Bug fix for: keep alive timer is not updated if the timing of a subscription is changed #2863
* Restart KeepAlive Timer with correct KeepAliveInterval on ModifySubscription, if the interval changed
2024-12-03 10:47:33 +01:00
Archie Miller f98c8a9e23 Client fix for ConditionRefreshAsync always returns NodIdUnknown, add ConditionRefresh2Async support(#2876)
Fixes #2854
2024-12-03 10:24:07 +01:00
Archie Miller ab364b9e98 Update CauseMappings to reflect issue (#2877)
SyspendedToRead caused by Reset remains as per Part 10 Table 7
2024-12-03 10:23:56 +01:00
Archie Miller bc0b1818b6 Client fix for ConditionRefreshAsync always returns NodIdUnknown, add ConditionRefresh2Async support(#2876)
Fixes #2854
2024-12-03 10:11:23 +01:00
Archie Miller 6925e1560f Update CauseMappings to reflect issue (#2877)
SyspendedToRead caused by Reset remains as per Part 10 Table 7
2024-12-03 10:03:29 +01:00
Martin RegenandMarc Schier 1fa0b7f26e Register callback to notify about new channel token activation (#2872) (#2873)
For better client diagnostic it is important to have access to the channel token. Today tooling must monitor the channel token change to be aware of the current token, it is more efficient for the tooling to be called back when the token changes. This can be now accomplished in that the owner of a client (Discovery, Session) can retrieve the Transport channel after connect, read the current token and register a change callback.

* Add OnTokenActivated event for token change notifications

Added a new event `OnTokenActivated` to the `UaChannelBase` class in the `Opc.Ua` namespace to notify when a channel token is activated. Implemented this event in the `HttpsTransportChannel` class within the `Opc.Ua.Bindings` namespace. Introduced a protected internal `OnTokenActivated` event handler in the `UaSCBinaryChannel.Symmetric` class, invoked during token changes in the `ActivateToken` and `DiscardTokens` methods. Cleaned up the event handler in the `Dispose` method of the `UaSCBinaryClientChannel` class. Registered the event handler with the internal channel in the `UaSCBinaryTransportChannel` class. Added a new delegate `ChannelTokenActivatedEventHandler` in the `ITransportChannel` interface and updated the interface to include the `OnTokenActivated` event. Made minor formatting and comment adjustments for improved readability and consistency.

* Include channel in callback

Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
2024-12-02 11:21:07 +01:00
Marc Schier 6aedc787b8 Register callback to notify about new channel token activation (#2872)
For better client diagnostic it is important to have access to the channel token. Today tooling must monitor the channel token change to be aware of the current token, it is more efficient for the tooling to be called back when the token changes. This can be now accomplished in that the owner of a client (Discovery, Session) can retrieve the Transport channel after connect, read the current token and register a change callback.

* Add OnTokenActivated event for token change notifications

Added a new event `OnTokenActivated` to the `UaChannelBase` class in the `Opc.Ua` namespace to notify when a channel token is activated. Implemented this event in the `HttpsTransportChannel` class within the `Opc.Ua.Bindings` namespace. Introduced a protected internal `OnTokenActivated` event handler in the `UaSCBinaryChannel.Symmetric` class, invoked during token changes in the `ActivateToken` and `DiscardTokens` methods. Cleaned up the event handler in the `Dispose` method of the `UaSCBinaryClientChannel` class. Registered the event handler with the internal channel in the `UaSCBinaryTransportChannel` class. Added a new delegate `ChannelTokenActivatedEventHandler` in the `ITransportChannel` interface and updated the interface to include the `OnTokenActivated` event. Made minor formatting and comment adjustments for improved readability and consistency.

* Include channel in callback
2024-12-02 09:48:54 +01:00
Martin Regen 0a4804f4c5 Client perf and memory improvements for JSON encoding and subscriptions (#2864)
- reduce EscapeString overhead in JSON encoder
- client monitored items: allocate queues only if needed
- replace SortedDictionary with Dictionary for perf reasons
- revert a change in padding and reduce a log level
2024-11-28 21:32:55 +01:00
Martin Regen f76c457c72 Support .NET 9.0 build (#2865)
* support .NET 9.0 build
* provide a helper to use the X509CertificateLoader also on older .NET versions
2024-11-28 12:57:10 +01:00
romanett 2f21ca8853 [Server] ValidateRolePermissions of MonitoredItems based of the saved user identity to allow validation when no session is present (#2832)
* ValidateRolePermissions for MIs montioring the Value of a Node
* allow validation of user identity also in case of disconnected session
2024-11-28 09:52:02 +01:00
Salih Goncu ed78fcee04 Merge pull request #2809 from romanett/MIFixRolePermissions
ValidateRolePermissions for MIs montioring the Value of a Node
2024-11-24 10:54:06 +01:00
Suciu Mircea Adrian 3543d02925 Added a minimal rogue client detection mechanism at the transport level (#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.
2024-11-22 10:01:30 +01:00
Martin Regen 76b53184de ChannelToken: Dispose HMAC and improve lifetime calculations. (#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.
2024-11-21 10:16:13 +01:00
dependabot[bot] a64f559d2c Bump codecov/codecov-action from 4 to 5 (#2847)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  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>
2024-11-19 10:01:55 +01:00
KircMax 56dd06d97f Using Uri.TryCreate causes regression with namespace uri that use mixed lower/uppercase letters in the <hostname> of the Uri.(#2837)
Uri.TryCreate lower cases the hostnames. Switch always back to the legacy implementation which maintains the casing.
2024-11-07 10:31:18 +01:00
romanett ff3674fe58 Improve crl handling in certificate stores (#2829)
* improve crl handling in certificate stores by not loading CRL with invalid or unsupported content. Hence the revocation check for such certificates may fail.
2024-11-02 11:44:51 +01:00
Suciu Mircea Adrian 787844c011 Update brokerHostName before MqttClientOptionsBuilder uses it's value (#2830) 2024-10-31 21:03:55 +01:00
Martin Regen ce9850c491 Fix bugs in JSON decoder (#2828)
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.
2024-10-31 08:02:32 +01:00
dependabot[bot] ce33d6387c Bump Serilog and System.Diagnostics.DiagnosticSource (#2818)
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.2 to 4.1.0
- [Release notes](https://github.com/serilog/serilog/releases)
- [Commits](https://github.com/serilog/serilog/compare/v4.0.2...v4.1.0)

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

---
updated-dependencies:
- dependency-name: Serilog
  dependency-type: direct:production
  update-type: version-update:semver-minor
- 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>
2024-10-30 13:35:41 +01:00
romanett b2d715d6cb Fix net462 build last issue (#2816) 2024-10-26 09:44:10 +02:00
Martin Regen b3b2f9154e Update version.json to allow preview builds from develop (#2813) 2024-10-26 09:39:04 +02:00
Martin Regen d60adc197a IOP: Fix FetchOperationLimits for some use cases (#2807)
* an exception in FetchOperationLimits may have skipped applying the configured operation limits on the server
2024-10-24 12:55:40 +02:00
dependabot[bot] 1ef2efd13d Bump Nerdbank.GitVersioning from 3.6.143 to 3.6.146 (#2805)
* Bump Nerdbank.GitVersioning from 3.6.143 to 3.6.146

Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.6.143 to 3.6.146.
- [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases)
- [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/commits)

---
updated-dependencies:
- dependency-name: Nerdbank.GitVersioning
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update version.props

* Update get-version.ps1

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-24 09:10:02 +02:00
romanett 0c6b38b0a8 Fix build for legacy platforms by disabling ECC on .NET 4.6.2 & NET-Standard2.0 (#2811)
* added ifdef for code that doesn't support ECC
2024-10-24 09:02:05 +02:00
romanett 16b9aeff4d Add ReturnDiagnostics to Session Constructor (#2810)
returndiagnostics was not propagated to recreated and reconnected sessions
2024-10-24 05:49:26 +02:00
Roman Ettlinger dfa4c9a122 fix typo 2024-10-23 17:47:11 +02:00
Roman Ettlinger 4bee42cef6 ValidateRolePermissions for MIs montioring the Value of a Node 2024-10-23 17:42:30 +02:00
dependabot[bot] f433fa414d Bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions and System.Diagnostics.DiagnosticSource (#2796)
* Bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions and System.Diagnostics.DiagnosticSource

Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) and [System.Diagnostics.DiagnosticSource](https://github.com/dotnet/runtime). These dependencies needed to be updated together.

Updates `Microsoft.Extensions.Logging` from 6.0.0 to 8.0.1
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v6.0.0...v8.0.1)

Updates `Microsoft.Extensions.Logging.Abstractions` from 3.1.32 to 8.0.2
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/commits/v8.0.2)

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

---
updated-dependencies:
- dependency-name: Microsoft.Extensions.Logging
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: Microsoft.Extensions.Logging.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: System.Diagnostics.DiagnosticSource
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update version.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-17 19:12:03 +02:00
Martin Regen 3cd8071dc5 Merge pull request #2804 from OPCFoundation/develop/main374
Null pointer exception when reading a complex type with empty arrays.…
2024-10-17 18:42:03 +02:00
Suciu Mircea AdrianandMartin Regen f001eabcc8 Add support for ECC profiles (#2398)
- Port support for ECC NIST/Brainpool profiles from prototyping_ecc branch
- Implement CertProvider to load certs per connection / profile
- Backward compatibility of configuration for existing apps
- SecurityConfiguration specifies app cert types for each profile
- Autodetect the ECC support for brainpool/nist based on platform (mac OS 10 doesn't support brainpool)
- ECC supported on net48 / net5.0 / net 6.0 / netstandard2.1
- ECC supported on windows / linux / macOS (brainpool not < macOS11)
- Self signed certs for each profile are created on start similar to RSA
- RSA only profiles are supported on .NET standard 2.0

Co-authored-by: Martin Regen <mregen@microsoft.com>
2024-10-17 16:02:20 +02:00
Marc Schier 3672ebefe9 Null pointer exception when reading a complex type with empty arrays. (#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.
2024-10-14 17:18:50 +02:00
dependabot[bot] 08a1211976 Bump NUnit.Console from 3.18.2 to 3.18.3 (#2797)
Bumps [NUnit.Console](https://github.com/nunit/nunit-console) from 3.18.2 to 3.18.3.
- [Release notes](https://github.com/nunit/nunit-console/releases)
- [Changelog](https://github.com/nunit/nunit-console/blob/main/CHANGES.txt)
- [Commits](https://github.com/nunit/nunit-console/compare/3.18.2...3.18.3)

---
updated-dependencies:
- dependency-name: NUnit.Console
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 16:32:18 +02:00
Martin Regen cb621df562 Fix ExpandedNodeId.Format output for not well formed uri and JSON Verbose WriteStatusCode (#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
2024-10-11 19:15:26 +02:00
Martin Regen 0215eb5552 Revert "#2656 Fix for - Session is not provided by ClearChangeMasks when a change is notified (#2772)" (#2792)
This reverts commit 9c7b321ecb.
During manual tests the new code ran into an ArgumentNullException creating a new OperationContext.
2024-10-11 13:27:04 +02:00
Filippo-Oliva-ABB 9c7b321ecb #2656 Fix for - Session is not provided by ClearChangeMasks when a change is notified (#2772)
It fixes #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.
2024-10-10 19:56:28 +02:00
ThomasNehring 44dc73460a Move modified ref test server to own file (#2725)
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.
2024-10-10 19:39:20 +02:00
romanett 014808e5d8 [Server] update endpoint descriptions after certificate update (#2735)
- Update the Server Endpoint Descriptions after certificate update e.g. from a GDS Push.
Until this PR the server needed a restart.
2024-10-10 19:35:21 +02:00
Filippo-Oliva-ABB 711160e84a #2777 Fix for - MonitoredItem2.OnReportEvent Ignores Session in ISystemContext During Notification Process (#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.
2024-10-10 11:33:38 +02:00
Martin Regen 23b8502778 Server doesn't start up with mixed https endpoints (#2789)
* allow startup of mixed https endpoints
2024-10-10 07:01:48 +02:00