Skip to content

Conversation

@Chapoly1305
Copy link

Background

The Connectivity Standards Alliance Distributed Compliance Ledger (DCL) does not enforce the Matter Specification requirements for validating OtaChecksumType in OTA Software Image records. The DCL accepts any integer value from 0 to 65535, including reserved values, unassigned values, and weak hash algorithms with less than 256-bit security. According to the Matter Specification, only values [1, 7, 8, 10, 11, 12] representing ≥256-bit hash algorithms (sha-256, sha-384, sha-512, sha3-256, sha3-384, sha3-512) shall be accepted. This may lead to firmware update failures or undefined behavior in downstream OTA Providers and Matter devices that cannot interpret invalid hash algorithm identifiers.
This pull request introduces stricter validation for the OtaChecksumType field in the MsgCreateModelVersion message, ensuring that only specific, IANA-approved checksum types are allowed when an OTA URL is provided. It also updates error handling and unit tests to reflect these new requirements.

Validation and error handling improvements:

  • Added a new error type, ErrOtaChecksumTypeInvalid, and an associated error constructor to handle cases where the OTA checksum type is not valid. (x/model/types/errors.go) [1] [2]
  • Implemented a map of valid OTA checksum types and an IsValidOtaChecksumType helper function to check if a given checksum type is allowed. (x/model/types/messages_model_version.go)
  • Updated the ValidateBasic method for MsgCreateModelVersion to enforce that the OTA checksum type must be one of the allowed values if an OTA URL is set, returning the new error if validation fails. (x/model/types/messages_model_version.go)

Unit test updates:

  • Modified and expanded unit tests for MsgCreateModelVersion.ValidateBasic to cover invalid and valid OTA checksum types, ensuring proper error handling and coverage for all allowed and disallowed values. (x/model/types/messages_model_version_test.go) [1] [2]

Validate that OtaChecksumType is within the allowed list [1, 7, 8, 10, 11, 12]
per IANA Named Information Hash Algorithm Registry (RFC 6920) when OtaUrl
is provided. These values correspond to hash algorithms with minimum 256-bit
digest length: sha-256, sha-384, sha-512, sha3-256, sha3-384, sha3-512.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant