52 Commits

Author SHA1 Message Date
Andreas Ebner 90effffe86 feat(driver): close file handles without activity after a timeout
The activity-timeout parameter closes handles without a Method call like Close,
e.g. for the ActivityTimeout of a TrustList (Part 12 7.8.2.1).
2026-10-15 22:05:04 +02:00
Andreas Ebner 0c253ab297 feat(driver): report an unknown file size as Bad_NotSupported (Part 20 4.2.1)
A backend can mark the size in the FileInfo as unknown, e.g. for content that
is generated on Open like a TrustList (Part 12 7.8.2.1).
2026-10-15 22:05:04 +02:00
Andreas Ebner c1180cdb96 feat(driver): open file handles from FileType subtype Methods
UA_FileTransferDriver_openHandle creates a Session handle with the checks of
Open, e.g. for OpenWithMasks of a TrustList (Part 12). Its openContext reaches
the backend open.
2026-10-15 22:05:04 +02:00
Andreas Ebner 0503c8fd97 feat(driver): open files with the Session of the caller (Part 20 4.2.2)
The backend open gets the caller as a context: the Session of Open, CreateFile
and the copies of MoveOrCopy, NULL for direct calls. Its result reaches the
client.
2026-10-15 22:05:04 +02:00
Andreas Ebner a83ee91bf9 fix(driver): preserve Object contexts and reject incomplete file listings
Restore application contexts before subtree deletion and keep original ownership separate from explicit Delete/move operations. Preserve contexts allocated by constructors for driver-created Objects as well.

Propagate entry metadata errors so a cross-driver move cannot delete an uncopied source file. Add lifecycle and local filesystem regressions covering both findings.
2026-10-14 08:11:28 +02:00
Andreas Ebner 8d28921d72 fix(driver): reject wrongly typed parameters and document the Method ownership
A known parameter with another type was ignored silently, e.g. read-only as
Int32. The header states that the drivers own the shared Method nodes.
2026-10-14 08:11:28 +02:00
Andreas Ebner 6774f9cc9e fix(driver): reject IndexRange on file Properties and check ancestors for Writable
Size, LastModifiedTime, Writable and UserWritable returned the scalar for an
IndexRange (Part 4 7.27). Writable and UserWritable ignored a denied Traverse
on a managed ancestor that Open enforces (Part 20 4.2.1).
2026-10-14 08:11:28 +02:00
Andreas Ebner 6299a405bc fix(driver): delete reused Objects with a client Delete or move (Part 20 4.3.5)
The Delete and MoveOrCopy Methods kept application Objects of the removed
storage entries; teardown and refresh still only release them. The subtree
release iterates the children instead of re-reading the child index.
2026-10-14 08:11:28 +02:00
Andreas Ebner 20fe8e1713 fix(driver): report enumeration errors and open write-only local files
A readdir() error ended the listing early, so a move to another driver could
delete source files that were never copied. Writing a file needs no read
access anymore (Part 20 4.2.2).
2026-10-14 08:11:28 +02:00
Andreas Ebner 54fcc04ccc fix(drivers): only warn when the GDS role setup fails
UA_GDSReceiver_start did not start when initGDSRolePermissions failed,
but left the push method callbacks installed. The RolePermissions are
one way to restrict the methods to SecurityAdmin (Part 12, 7.10). RBAC
is optional, and the AccessControl plugin can restrict the methods as
well. So a failed role setup is now logged as a warning and the receiver
starts.
2026-10-13 08:55:20 +02:00
Julius Pfrommer a59a620301 refactor(drivers): name namespace zero source consistently (#8563)
Co-authored-by: Julius Pfrommer <julius.pfrommer@o6-automation.com>
2026-10-12 19:26:17 +02:00
Andreas Ebner a109401823 feat(driver): resolve file handles for FileType subtype methods
Methods like CloseAndUpdate of the PubSubConfiguration (Part 14) map the
client FileHandle to the backend handle and close it as Close does.
2026-10-12 00:14:33 +02:00
Andreas Ebner 0d36d460b5 fix(driver): keep file handles and Read results consistent (Part 20 4.2)
Handles survive a vanished file or a replaced parent, Read at the end returns an
empty ByteString, the root is queried with the complete backend, failed starts
are logged and the analyzer accepts releaseSubtree.
2026-10-12 00:14:33 +02:00
Andreas Ebner edfbf9516e feat(driver): make the directory refresh optional and enforce the scan limits
refresh-interval 0 disables the timer, UA_FileTransferDriver_refresh() reconciles
on demand. The directory Methods respect max-scan-depth; skipped entries and cut
trees are logged at start and when they change.
2026-10-12 00:14:33 +02:00
Andreas Ebner bd7a445560 feat(driver): add local file and directory backends
Serve a single file or a directory using the shared file backend operations.
Validate relative paths, create entries exclusively, and avoid replacing an
existing rename destination. Support Windows UTF-16 paths and filter links
to directories and special files during enumeration.

Co-authored-by: Julius Pfrommer <julius.pfrommer@o6-automation.com>
2026-10-12 00:14:33 +02:00
Andreas Ebner 5514c756e6 feat(driver): add per-backend Part 20 file transfer drivers
Expose one file or directory backend through FileType and FileDirectoryType
Objects. Bind Objects to the driver lifetime, preserve reused application
nodes, and close session handles on stop or session cleanup.

Enforce file and directory access rights in Properties and Methods. Index
entries and handles with zip trees, reconcile storage changes, and retain
removed entries while their handles remain open. Include the reduced
namespace model and compile the driver with Method-call support in every
Namespace Zero configuration. Export the API unconditionally.

Co-authored-by: Julius Pfrommer <julius.pfrommer@o6-automation.com>
2026-10-12 00:14:33 +02:00
Julius Pfrommer 6901aedc07 Merge remote-tracking branch 'origin/1.5' into merge_15_master
Port keyless certificate validation into the GDS receiver driver instead
of restoring the removed server implementation. Preserve master's timer
batching, PubSub lifecycle and client HTTP configuration handling.

Adapt Publish cancellation to response tokens and the HEL/fuzz harnesses
to the explicit TCP driver. Keep SKS policy history and custom datatype
ownership intact, including failed replacement configuration cleanup.
Retain TPM error cleanup while enforcing key-handle and nonce lengths.

Validation:
- Full mbedTLS unit-test build with full namespace, GDS, SKS and Query.
- 21 affected suites passed with ASan/UBSan, plus 9 isolated SKS ownership
  and lifecycle checks.
- OpenSSL certificate update, GDS information model and client encryption
  suites passed with sanitizers.
- OPN, MSG and binary-message fuzzers each completed 100 sanitizer runs.
- Both TPM PubSub policy sources passed compilation checks.

The full SKS client suite timed out after multicast UDP sends reported
"No route to host" on this machine; its affected ownership and lifecycle
cases passed separately. No live TPM hardware validation was performed.
2026-10-04 16:49:17 +02:00
Andreas Ebner fc0bf5614e fix(drivers): let the owning session continue its transaction with Open
Open was refused while any transaction was pending, also for the session
that owns it, so UpdateCertificate followed by a TrustList write failed.
Part 12 §7.8.2.2 says a write-mode Open continues an existing transaction.
Allow that for the owner unless ApplyChanges is queued; OpenWithMasks and
other sessions still get BadTransactionPending. Close discards only the
written data and keeps the staged changes. ApplyChanges refuses to run
while any TrustList is open for writing (§7.10.9).
2026-10-01 16:09:59 +02:00
Andreas Ebner af94d97375 fix(drivers): advertise and accept only configured certificate types
CertificateTypes always listed RsaMin and RsaSha256. With no RsaMin policy
configured (the default), an RsaMin UpdateCertificate and ApplyChanges
answered Good without changing anything, and CreateSigningRequest returned
an empty CSR. Now only types with an endpoint policy in the
DefaultApplicationGroup are advertised. UpdateCertificate and
CreateSigningRequest refuse the others with BadInvalidArgument (Part 12
7.10.5, 7.10.10), and applying a type that no policy uses is an error.
2026-10-01 16:09:59 +02:00
Andreas Ebner 7395a9d1dd fix(drivers): read the SetPosition offset as UInt64
SetPosition read its UInt64 Position argument through a UInt32 pointer.
Offsets above 4 GiB were truncated, and big-endian targets read the wrong
half. Read the argument with its declared type.
2026-10-01 16:09:59 +02:00
Andreas Ebner e1a2e07cda fix(drivers): wipe staged private keys before freeing them
Private keys staged by UpdateCertificate were freed without zeroing, when
they were replaced, on allocation failures and when the transaction ended.
Zero them with UA_ByteString_memZero first, as the CSR path already does.
2026-10-01 16:09:59 +02:00
Andreas Ebner 128eb7868a fix(drivers): clear the transaction when RemoveCertificate fails
RemoveCertificate creates a transaction and applies it right away. When
the TrustList could not be copied into the transaction, it returned with
the transaction still pending and no session watchdog installed, so all
later TrustList changes were refused. Clear the transaction on that path.
2026-10-01 16:09:59 +02:00
Andreas Ebner b822aae1ff fix(drivers): refuse certificate updates while ApplyChanges is queued
ApplyChanges defers the completion of the transaction to a delayed
callback. An UpdateCertificate in between was accepted into the queued
transaction and then silently discarded with it. Refuse it with
BadTransactionPending until the transaction is completed.
2026-10-01 16:09:59 +02:00
Andreas Ebner 10fb09e051 fix(drivers): answer BadNothingToDo for ApplyChanges without a transaction
ApplyChanges compared the caller with the owner of the transaction before
checking its state. A fresh transaction has no owner, so every caller got
BadUserAccessDenied. Check the state first, as Part 12 §7.10.9 requires.
2026-10-01 16:09:59 +02:00
Andreas Ebner 2ecedb825c fix(drivers): update the None endpoint certificate in UpdateCertificate
After a certificate push the SecurityPolicy#None endpoint kept presenting
the replaced certificate, while the encrypted endpoints showed the new one.
A None SecurityPolicy with a replaced certificate is now updated as well.
2026-09-29 23:11:55 +02:00
Andreas Ebner a34a68357e fix(drivers): accept a null CertificateGroupId in UpdateCertificate
Part 12 says a null CertificateGroupId selects the DefaultApplicationGroup.
The GDS receiver rejected it with Bad_NotSupported, so GDS pushes failed.
An unsupported group or type now returns Bad_InvalidArgument as specified.
2026-09-29 20:31:27 +02:00
Andreas Ebner 918f2cfd4b fix(docs): typos in comments, docs and messages
Fix misspellings found with codespell across headers, sources, examples,
tests and the documentation, including "propably" in the nodeset
compiler docs. Identifiers, companion spec names and generated code are
left untouched.
2026-09-28 16:20:44 +02:00
Julius Pfrommer 9a43b33a4b Merge remote-tracking branch 'origin/1.5' into merge_15_master
# Conflicts:
#	plugins/crypto/mbedtls/create_certificate.c
#	plugins/crypto/mbedtls/securitypolicy_aes256sha256rsapss.c
#	plugins/crypto/mbedtls/securitypolicy_common.c
#	src/client/ua_client.c
#	src/pubsub/ua_pubsub_config.c
#	src/pubsub/ua_pubsub_keystorage.c
#	src/pubsub/ua_pubsub_keystorage.h
#	src/pubsub/ua_pubsub_ns0.c
#	src/pubsub/ua_pubsub_ns0_sks.c
#	src/pubsub/ua_pubsub_securitygroup.c
#	src/pubsub/ua_pubsub_writer.c
#	src/pubsub/ua_pubsub_writergroup.c
#	src/server/ua_server_ns0.c
#	src/server/ua_server_ns0_gds.c
#	src/server/ua_server_utils.c
#	src/server/ua_services_session.c
#	src/server/ua_subscription_alarms_conditions.c
#	src/ua_types_encoding_xml.c
#	tests/check_types_builtin_xml.c
#	tests/encryption/check_cert_generation.c
#	tests/pubsub/check_pubsub_configuration.c
#	tests/pubsub/check_pubsub_informationmodel_methods.c
#	tests/pubsub/check_pubsub_publish.c
#	tests/pubsub/check_pubsub_sks_client.c
#	tests/pubsub/check_pubsub_sks_keystorage.c
#	tests/pubsub/check_pubsub_sks_push.c
#	tests/pubsub/check_pubsub_sks_securitygroups.c
#	tests/server/check_server_alarmsconditions.c
2026-09-20 10:02:09 +02:00
Julius Pfrommer a300dc0338 fix(discovery): provide full mDNS parser buffer 2026-09-15 21:18:00 +02:00
Julius Pfrommer 781c031cac fix(driver): For MDNSD explicitly process local replies 2026-08-29 12:45:10 +02:00
Mark Leon Giraud 24f01ed6ce fix(plugin): open an outbound socket for mDNS sends
The mDNSd driver used listen=true for both UDP connections. The POSIX connection manager therefore created two receive sockets. Calls to sendto on the second socket failed with EINVAL.

Set listen=false before the driver opens the send connection. The regression test verifies one receive connection and one send connection at startup.
2026-08-29 06:15:54 +02:00
Julius Pfrommer b26e44ce3d fix(server): validate built-in method output arity 2026-08-28 19:13:18 +02:00
Julius Pfrommer bdd6ed40d4 Merge remote-tracking branch 'origin/1.5' into merge_15_master_2
# Conflicts:
#	plugins/crypto/mbedtls/certificategroup.c
#	src/pubsub/ua_pubsub_config.c
#	src/server/ua_discovery_mdns.c
#	src/server/ua_server.c
#	src/server/ua_server_internal.h
#	src/server/ua_server_ns0_gds.c
#	src/server/ua_services_nodemanagement.c
#	src/server/ua_subscription_alarms_conditions.c
#	src/ua_types_definition.c
#	tests/server/check_services_nodemanagement.c
2026-08-16 16:46:48 +02:00
MrAlaskan 165f773ebb fix(drivers): Publish configured max trust list size in GDS receiver 2026-08-04 13:44:22 +02:00
Andreas Ebner 4167bde39d feat(server): restrict GDS methods to the SecurityAdmin role 2026-07-19 09:29:55 +02:00
Julius Pfrommer 629e3e9c1f refactor(driver): More cleanup for GDS Receiver 2026-07-18 21:26:33 +02:00
Julius Pfrommer 5a0f29fcee fix(driver): Propagate GDS Receiver allocation failures 2026-07-18 21:26:33 +02:00
Julius Pfrommer 0a934139e1 fix(driver): Preflight GDS Receiver certificate updates 2026-07-18 21:26:33 +02:00
Julius Pfrommer dde1f93019 refactor(driver): Directly use the GDS Receiver pointer as node context 2026-07-18 21:26:33 +02:00
Julius Pfrommer 30e5fb3e93 refactor(driver): Rename GDS Driver files for consistency 2026-07-18 21:26:33 +02:00
Julius Pfrommer 7c2a5cae42 refactor(driver): Internal consistent naming in the GDS Receiver 2026-07-18 21:26:33 +02:00
Julius Pfrommer e3f7c05569 refactor(driver): Make GDS Receiver thread-safe 2026-07-18 21:26:33 +02:00
Julius Pfrommer 00c0a7f54e refactor(drivers): Only allow one GDS Receiver per server 2026-07-18 21:26:33 +02:00
Julius Pfrommer edb4b19d8b refactor(drivers): Only close impacted SecureChannels after cert update in GDS Receiver 2026-07-18 21:26:33 +02:00
Julius Pfrommer d80ee619e7 refactor(driver): Give the GDSReceiver a dedicated driver type 2026-07-18 21:26:33 +02:00
Julius Pfrommer f2fe9f6ea5 refactor(driver): Rename GDS-Receive to GDS-Receiver 2026-07-18 21:26:33 +02:00
Julius Pfrommer 712ffde692 refactor(driver): Move _updateCertificat and _createSigningRequest into the GDS receive driver 2026-07-18 21:26:33 +02:00
Julius Pfrommer 31e4278ce0 refactor(driver): Move the GDS receive side into a driver 2026-07-18 21:26:33 +02:00
Julius Pfrommer 93d7097a8d refactor(build): Update build options for the new driver structure 2026-07-05 23:46:24 +02:00
Julius Pfrommer 042623af07 refactor(driver): Make the A&C driver independent from server internals 2026-07-05 23:46:24 +02:00