Hello everyone,
When the gadget snap was first introduced, we aimed to provide developers with the flexibility to define custom serial values for their devices. This process involves SnapD requesting a recommendation from the gadget snap during the first-boot serial request, which is then processed by the appropriate store service (currently Serial Vault, with an upcoming migration to Model Service).
While this approach has been largely successful, we have observed instances of inconsistent or malformed serials, such as those containing unexpected quoted strings. To ensure the long-term health of the ecosystem and maintain robust parsing of device identifiers across all services, we are planning to introduce server-side validation for this field.
These validation rules will be implemented alongside the roll out of the new Model Service by the store team. Once deployed, requests for serials to this service that do not meet these criteria will be declined. Although there are no immediate plans to apply these rules to the existing Serial Vault, certain upcoming SnapD features, such as remote confdb, will rely on these standardized serial formats.
New Validation Criteria
To support common formats like, MAC addresses, and other structured IDs, serials should now adhere to the following:
-
Use only alphanumeric characters (a-z, A-Z, 0-9) and the separators :, +, or -.
-
Begin and end with an alphanumeric character.
-
Not use consecutive separators.
-
Contain at least one alphanumeric character (cannot be empty).
The corresponding regular expression for these rules is: ^[a-zA-Z0-9](?:[:±]?[a-zA-Z0-9])*$
Please note that validation for brands and models remains unchanged.
Recommended Actions
If you maintain any gadget snaps, we kindly ask you to review your serial generation logic to ensure compatibility with these upcoming changes.
Should you have any questions or require further clarification, please feel free to reach out via this thread.
Best regards,
Michael Croft-White