Skip to content

Commit 247403f

Browse files
henrybarretogustavosbarreto
authored andcommitted
fix(api): use device name custom rule for field validation
We have been using the `hostname_rfc1123` for validating the device name, which isn't compatible with [Docker's daemon naming convention](https://github.com/moby/moby/blob/master/daemon/names/names.go#L6), causing containers with `underscore` to be denied by the server for invalid entity format. Closes #3291
1 parent e3b0969 commit 247403f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/api/requests/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type DeviceInfo struct {
7979
type DeviceAuth struct {
8080
Info *DeviceInfo `json:"info" validate:"required"`
8181
Sessions []string `json:"sessions,omitempty"`
82-
Hostname string `json:"hostname,omitempty" validate:"required_without=Identity,omitempty,hostname_rfc1123" hash:"-"`
82+
Hostname string `json:"hostname,omitempty" validate:"required_without=Identity,omitempty,device_name" hash:"-"`
8383
Identity *DeviceIdentity `json:"identity,omitempty" validate:"required_without=Hostname,omitempty"`
8484
PublicKey string `json:"public_key" validate:"required"`
8585
TenantID string `json:"tenant_id" validate:"required"`

0 commit comments

Comments
 (0)