Require exact LDS certificate ApplicationUri registration (OPC 10000-4)#4052
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Tightens LDS RegisterServer registration validation to comply with OPC UA spec requirements around SecureChannel client authentication and exact ApplicationUri matching in the client certificate, and adds unit tests for the new rejection/acceptance cases.
Changes:
- Require a SecureChannel client certificate for
RegisterServerand fail closed on malformed certificates. - Enforce exactly one certificate
ApplicationUriand require ordinal equality withRegisteredServer.ServerUri. - Add a new focused test suite covering accept/reject scenarios for LDS registration validation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/Opc.Ua.Lds.Tests/RegistrationValidationTests.cs | Adds new tests validating strict certificate presence/parsing and exact single-ApplicationUri registration behavior. |
| src/Opc.Ua.Lds.Server/LdsServer.cs | Implements stricter validation: require client cert, reject malformed certs, and enforce a single exact ApplicationUri match. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #4052 +/- ##
=======================================
Coverage 73.55% 73.55%
=======================================
Files 1345 1345
Lines 180036 180094 +58
Branches 31677 31684 +7
=======================================
+ Hits 132427 132477 +50
+ Misses 36911 36906 -5
- Partials 10698 10711 +13
🚀 New features to boost your workflow:
|
Description
This PR splits the LDS registration-validation changes from #4021.
Specification
OPC 10000-4 v1.05.07 §5.5.5.1 requires
RegisterServerto use a SecureChannel that supports Client authentication and requires a Discovery Server to reject a registration whenserverUridoes not match theapplicationUriin the Server Certificate used for that SecureChannel.Failure
LDS registration validation previously skipped the ApplicationUri check when the SecureChannel had no Client certificate, accepted a certificate with no ApplicationUri, and logged malformed-certificate parsing errors before continuing with a successful registration.
Fix
BadCertificateInvalidwhen it is malformed.ServerUriwith ordinal equality.BadServerUriInvalidwhen no certificate ApplicationUri exactly matchesServerUri.Validation
Opc.Ua.Lds.Tests: net10.0 (171 passed, 3 skipped), net48 (171 passed, 3 skipped).git diff --checkpassed.Related Issues
Checklist
Only verified claims are checked.