* style(backend): reformat and rearrange java/xml sources
Apply code cleanup across dc3-common and dc3-driver: whitespace and
indent normalization, import sorting, member rearrangement, and javadoc
normalization. No semantic changes; compilation verified.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* style(docs): reformat vitepress vue diagram components
Expand compact svg templates and normalize formatting across diagram
components, the seo module, and the theme stylesheet. No behavior
changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* style(docs): reformat markdown pages
Normalize markdown formatting. Restore the <script setup> component
imports that an earlier unused-import pass had wrongly stripped; every
<Diagram> tag now resolves to a backing import again.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* style: reformat point view and trim pom whitespace
Normalize whitespace in the point view and drop trailing whitespace in
pom.xml. No behavior changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(security): sanitize agentic assistant HTML with DOMPurify (XSS)
RenderedAssistantMessage rendered model output via v-html after a
hand-rolled regex sanitizer that CodeQL flagged 5 ways: bad-tag-filter,
incomplete-multi-character-sanitization (on* attributes, javascript:),
incomplete-url-scheme-check (data:/vbscript:). Replace with DOMPurify,
which covers all these plus mutation XSS. Fixes CodeQL #2146-2150.
* fix(security): harden log-injection + CAN command injection
log-injection (7): pass user-derived log args (conversationId, model,
candidate/fallback) through LogSanitizer.sanitize in AgenticChatServiceImpl,
ChatClientFactory, AgenticChatRequestPreparer — strips CR/LF that could
forge log lines.
relative-path-command / command injection (2, CanDriver): executeCommand
runs `sh -c` with a command built from driver config (interfaceName) and
request data (canId/frame), so add a CAN_COMMAND_PATTERN whitelist
(^[A-Za-z0-9 _#,.=%/-]+$) rejecting shell metacharacters, and validate
interfaceName against ^[A-Za-z0-9_]+$ at all 3 entry points. Fixes
CodeQL #2173,#2172,#2120,#1514,#1513,#1022,#1017,#1016,#1014.
Verified: mvn compile agentic+can clean.
M6 relocated CoapExchange from core.server.resources to core (verified
via compile). dc3-driver-coap uses only the core CoAP API
(CoapClient/Server/Endpoint/Resource/Configuration) and avoids the
DTLS/observe/MessageObserver areas where M3→M6 broke, so this single
import is the whole adaptation. Supersedes dependabot #81.
Gains: M4-M6 bugfixes (deferred CID records, CON notify reliability,
anonymous cipher-suite), Java 21 virtual-thread support, RFC 7252
compliance. 4.0.0 GA has no timeline; no reason to stall on M3.
28 driver application.yml add dc3.driver.buffer; Dockerfile each stage adds dc3/data dir and VOLUME; docker-compose main/dev add driver_data named volume
Add LogSanitizer and apply it to agentic conversationId/model and the listening-virtual netty deviceName so they are not emitted verbatim in log output.
Co-Authored-By: Claude <noreply@anthropic.com>
Wrap unchecked Integer/Long/Byte.parse* calls in topic/dashboard/oauth/facade and the BACnet-IP, Ethernet-IP, FINS, SNMP drivers plus the agentic action payload, so malformed values fall back to a safe default instead of aborting.
Co-Authored-By: Claude <noreply@anthropic.com>
Remove configuration duplicated verbatim by the auto-activated shared profile bases: the dc3-center-manager gRPC channel in several drivers, the management.* block in center/gateway services, the gateway swagger-ui.path, duplicate logging sub-packages, and dead dc3.driver.mqtt config in dc3-center-data (no dc3-common-mqtt dependency). spring.env/spring.group are kept (consumed by RabbitmqEnvironmentConfig/WebFluxSecurityConfig/HmacAuthConfig). Effective configuration unchanged; validated via YAML parse + Maven process-resources.
Co-Authored-By: Claude <noreply@anthropic.com>
The server was constructed with only CoapConfig.COAP_PORT set, so
Californium created a default endpoint bound to 0.0.0.0 (all
interfaces) — coapProperties.serverHost was never applied, yet the
startup log printed it as the listen host. Setting serverHost to a
specific interface silently failed to restrict binding. Add an explicit
CoapEndpoint bound to InetSocketAddress(serverHost, serverPort) so the
property takes effect and the log is accurate.
Verified: dc3-driver-coap compiles.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two runtime bugs in the FINS driver:
1. read() hardcoded a 1-word (2-byte) memory-read request regardless of
dataType, so INT32/UINT32/FLOAT decodes (which need 4 bytes) always
threw BufferUnderflowException — 32-bit points could never be read.
Derive the word count from dataType (2 words for 32-bit types).
2. encodeWriteData grouped FLOAT with INT32/UINT32, doing
Integer.parseInt + putInt. Writing "3.14" threw NumberFormatException
and "3" was written as int bits (read back as ~4.2E-45 via getFloat).
Give FLOAT its own branch using Float.parseFloat + putFloat.
Relaxed encodeWriteData/decodeValue/wordCount to package-private and
added round-trip tests (FLOAT, INT32) plus wordCount coverage.
Verified: dc3-driver-fins 7 tests pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Align @param tag indentation in AgenticChatResponseCodec, GrpcFacadeSupport, PlcS7DriverCustomServiceImpl
- Align markdown table columns in docs/en and docs/zh architecture, technology-stack, operation, quickstart
- Reformat vitepress config group items for readability
- PlcS7DriverCustomServiceImpl: document getS7PLC/buildVariable/
readByType/writeByType/invalidateConnection/closeConnection
- MelsecDriverCustomServiceImpl: document the same six helpers
(McPLC variant); both drivers shared the undocumented helper pattern
while modbus-tcp/mqtt/opc-ua already documented theirs
Fix @since 2026.6.2 -> @since 2026.5.22 on 40 files across 17 protocol
drivers (serial, dlms, fins, mysql, ethernet-ip, zigbee, bacnet-ip,
snmp, ble, can, oracle, postgresql, iec104, lwm2m, tcp-udp, http,
sqlserver). The @since value was later than @version 2026.5.22, which
is impossible — a class cannot exist in 5.22 yet be introduced in 6.2.
Replace unused catch exception parameter names ('e', 'ex', etc.) with
the conventional 'ignored' identifier to suppress IDE warnings across
the codebase. This is a purely mechanical rename — no behavioral change.
Affected modules: enums (40+), drivers (12+), common-data, common-driver,
common-manager, common-auth, common-public, common-agentic, common-web,
common-resource-registrar, and all driver implementations.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(driver-mqtt): report real broker connection state in driver health
* fix(driver-opc-ua): expose certificate-degraded marker in health description
* fix(driver-opc-ua): use x509 identity provider when certificate is configured
* fix(driver-opc-ua): add connection backoff to prevent connect storms on unreachable devices
Add the first driver integration test: spins a real PostgreSQL container and
verifies the shared JDBC read path returns stored values and that the write
path binds the point value as a parameter — a SQL-injection payload is stored
verbatim and cannot drop the table, confirming the parameterised-write fix
end-to-end. Set the Failsafe classesDirectory so integration tests run against
the plain compiled classes instead of the Spring Boot repackaged fat jar.
Add offline MockitoExtension tests for bacnet-ip, can, ethernet-ip, fins, http,
lwm2m, mysql, oracle, postgresql, serial, snmp, sqlserver, and tcp-udp. Each
covers configuration validation (validate/validatePoint flag missing required
attributes) and deterministic lifecycle behavior. Network/hardware paths
(read/write/getConnector) are deliberately excluded to keep the suite fast and
deterministic. Takes these drivers from zero tests to baseline coverage.
The shared JDBC driver base interpolated the point value into the write SQL via
writeQuery.replace("${value}", ...), allowing a crafted write command value to
alter the statement. Bind the value with PreparedStatement#setString against a
single ? placeholder instead. Update the mysql/oracle/postgresql/sqlserver
writeQuery attribute docs to the ? convention and add the module's first test.
The DLMS and IEC 104 drivers are work-in-progress skeletons whose protocol I/O
is unimplemented. They previously returned a null-valued ReadPointValue / cached
echo and reported write success, so the SDK emitted fabricated point values and
masked that the drivers do not work. Make read/write throw Read/WritePointException
so the SDK records failures and applies backoff. Remove the dead connection
scaffolding and add the drivers' first unit tests.
validate(driverConfig) required commandTopic/commandQos, but those are
per-point attributes read from pointConfig in write(), so driver-level
validation always failed. Drop the misplaced checks (and the now-unused
helper); this driver declares no required driver-level attributes.
Document 31 modules that had no README: dc3-center-agentic, dc3-e2e,
common modules (agentic, sql, test, resource-registrar) and the facade
subsystem (api/grpc/local-auth/local-data/local-manager), plus 21
drivers. Content is grounded in each module's pom/yaml/source; WIP
skeleton drivers (can, dlms, ethernet-ip, iec104, lwm2m, zigbee) are
flagged as such.
Move misclassified point attributes out of the driver-attribute tables
(modbus-tcp Slave ID, virtual Tag, listening-virtual), drop plcs7's
fabricated Data Length and add the required PLC Type, document
command/event attributes, and flag the mqtt driver as a WIP skeleton.
Part of the x-dc3-ai annotation-standard rollout. Complete method/param javadoc (TokenService, RepositoryService, RuleEngine, ...), flag work-in-progress utilities and drivers (X509Util, MQTT/CAN/DLMS/... ) with explicit WARNING notes, and remove redundant inline comments / blank lines from query/VO/ext/constant classes plus mapper indentation. Comment/doc only, no behavior change.
Replace the mixed-purpose ResponseEnum with a ResponseCode interface implemented
by SuccessCode (OK/ADD/DELETE/UPDATE) and ErrorCode (NOT_FOUND/UNAUTHORIZED/
TOKEN_INVALID/IP_INVALID/FORBIDDEN/PASSWORD_*/VALIDATION/OUT_OF_RANGE/FAILURE),
each carrying its HTTP status so the envelope body code and transport status no
longer diverge.
- Introduce abstract BusinessException carrying an ErrorCode; all 23 business
exceptions extend it and bind a fixed code. ExceptionConfig reads the carried
code to set both body code and HTTP status (404->R404, 401->R401, 422->R422).
- Add GrpcRFactory (ok/fail/notFound) and remove the hand-written GrpcR builder
boilerplate across 19 gRPC servers.
- Drop the dead @EnumValue index and ofIndex/ofCode/ofName lookups; OUT_OF_RANGE
is now carried by OutRangeException.
- Update R factory methods to accept ResponseCode; migrate 90+ controllers,
11 gRPC facades, OpenAPI specs and README to the split enums.
Also fix several pre-existing red tests surfaced by the full suite:
- OAuthMcpRuntimeServiceImplTest: setUp set @Value fields refactored into
OAuthProperties; inject the properties object instead.
- DriverReadServiceImplTest: reset leaked ConnectionBackoff static state via a
new clear() in @BeforeEach.
- modbus-rtu/tcp: make the static modbusFactory non-final so tests can swap it.
- ble: override no-arg health() to report OFFLINE before initialization.
- PlcS7/facade-local tests: expect the thrown exception / use the single-arg
overload matching production behaviour.
- Remove a duplicate dc3-common-constant dependency in dc3-common-data/pom.xml.
- Update test references to the renamed *TypeEnum/RuleStatusEnum.
- Add the new builder/PermissionProvider constructor args to the affected
service-impl test setups.
- Fix pre-existing failures unrelated to this work: String-vs-Long assertions
(DriverStatusServiceImplTest), save->saveBatch (EntityStateExpiryScannerTest),
List.of(null) NPE (AlarmRulePipelineServiceImplTest), and the cache/batch
refactor expectations (PointValueServiceImplTest).
Align the DO/BO/VO model and enums with the project domain-modeling rules:
- Rename 24 multi-valued *FlagEnum to *TypeEnum (closed classifications) and
RuleStateFlagEnum to RuleStatusEnum (state machine); keep true 0/1 toggles as
*FlagEnum (EnableFlagEnum/DefaultFlagEnum/ConfirmFlagEnum). Add the new
ConfirmFlagEnum.
- Give every enum the consistent triplet + ofIndex/ofCode/ofName (fill the two
Agentic enums) and switch underscore codes to hyphen-case.
- Replace bare Byte/Integer/String flag fields on VOs with their domain enums
(EventHistory, AlertItem, ...); centralize index/code<->enum conversion in the
MapStruct builders instead of services; drop ad-hoc (byte) enum casts.
- Stop leaking DO out of the data history services/controllers: the command /
point-command / event history services now return VO, converting inside the
service via the builder.
- Add @Schema (description + example/required, verified enum constants) across
VO/BO/Query DTOs and the entity/ext nested beans; @Schema the R<T> wrapper;
exclude credential fields from @ToString.
- Replace obsolete nexus-staging-maven-plugin with central-publishing-
maven-plugin in dc3-api and dc3-common
- Remove 20 redundant version declarations from dc3-coverage dependencies
- Fix snmp4j version from non-existent 3.8.3 to available 3.7.4
Add final to ~30 public static fields in RabbitConstant — without final,
any code could reassign exchange/queue/routing-key constants at runtime,
silently corrupting messaging routes across the entire distributed system.
Add final to ModbusFactory static fields in ModbusRtu/Tcp drivers and
Random field in OPC-DA Group class.
Replace System.setProperty-based tag isolation in RabbitmqEnvironmentConfig
with a static initializer block in RabbitConstant to preserve immutability.
- Replace e.getMessage() with exception object in 12 SLF4J log calls
across 8 files to preserve full stack traces
- Replace hardcoded date pattern in @JsonFormat with TimeConstant
reference in LatestPointValueVO and TimeseriesPointVO
- Standardize TopicVO: replace @Data with @Getter/@Setter/@ToString,
add @NoArgsConstructor/@AllArgsConstructor, @JsonInclude, Serializable
- Replace fully-qualified class names with imports in DashboardController
Replace string concatenation in SLF4J log calls with {} placeholders
across 13 driver implementations. Parameterized logging avoids string
construction when the log level is disabled, reducing CPU overhead.
Affected: listening-virtual (6 files), virtual, modbus-tcp, modbus-rtu,
opc-da, opc-ua, mqtt, coap.
Remove unused imports, dead constructors, redundant fields, and unreferenced
local variables across 16 protocol driver implementations and supporting
classes. Add type-specific Encodable creation for BACnet write operations.
Prevent PointValue double-scaling on write echo by adding a static
ofRawValue() factory method that skips the ReadPointValue.calculate()
pipeline. Write values are already in final device-level form and must
not have point scaling (base/multiple/decimal) re-applied.
Add ConnectionBackoff with per-device exponential backoff (1s initial,
2x multiplier, 5min cap) to prevent reconnection storms during device
or network recovery. Integrated transparently into DriverReadServiceImpl
and DriverWriteServiceImpl — applies to all driver types.
Add Modbus TCP connect/read timeout (5s via ModbusMaster.setTimeout)
replacing OS-level default 60-120s timeout that blocked Quartz threads.
Override health() in OPC UA and MQTT drivers to check live connectivity
rather than defaulting to ONLINE. OPC UA uses a 1-second connect() probe;
MQTT marks a TODO for Spring Integration CachingConnectionFactory access.
Remove DEFAULT_KEY and DEFAULT_PASSWORD constants from AlgorithmConstant.
Require DC3_SECURITY_KEY env var at startup — fail with IllegalStateException
if not configured instead of silently falling back to a well-known string.
Remove hardcoded default HMAC secret from HmacAuthProperties. Log a warning
when request signing is disabled in WebFilterConfig.
Require DC3_SECURITY_DEFAULT_PASSWORD for password reset operations instead
of falling back to the hardcoded 'dc3dc3dc3'.
Replace all YAML password fallback values (dc3dc3dc3) with empty defaults so
misconfigured deployments fail at connection time with a clear error rather
than silently connecting with a well-known password.
## Common Foundation
- dc3-common-sql: AbstractJdbcDriverCustomService base class with HikariCP
pool management and JDBC template methods
## Serial & General-Purpose (3)
- Serial: RS232/RS485/RS422 with configurable frame parsing (CRC16/XOR)
- HTTP: REST Client using Spring WebClient with JSON path extraction
- TCP/UDP Raw: generic socket driver with pluggable frame protocol
## Database Drivers (4)
- MySQL, PostgreSQL, Oracle (SID/ServiceName), SQL Server
## IoT & Wireless Protocols (3)
- LwM2M: Eclipse Leshan 2.0.0-M14 with CoAP server and device observation
- Zigbee: Z-Smart Systems 1.4.16.1 with Telegesis dongle support
- BLE: Sputnikdev Bluetooth Manager 1.5.3 with TinyB transport
## Building Automation & Smart Metering (2)
- BACnet IP: BACnet4J 6.0.1 with ReadProperty/WriteProperty support
- DLMS/COSEM: Gurux DLMS 4.0.79 for smart metering (TCP/Serial transport)
## Industrial & Power Protocols (4)
- IEC 104: OpenMUC j60870 1.7.2 for power telecontrol
- SNMP: SNMP4J 3.7.4 for network device monitoring
- EtherNet/IP: CIP Data Table Read/Write for Rockwell AB PLCs
- FINS: Omron PLC memory area read/write over TCP
## Automotive & Fieldbus (1)
- CAN Bus: SocketCAN interface with standard/extended frame support
## Build
- Register all 17 driver modules and dc3-common-sql in parent POMs
- Add version properties and dependencyManagement entries
Match incoming station addresses against device code/name, look up the
configured byte index per point, and ship element values through
DriverSenderService instead of only logging them. Load the xingshuangs
SL651 server and listener through reflection so the driver still starts
when the optional protocol library is absent, logging a warning instead
of failing.