From 690a8fc42af46b700b60314b0fc84cd09da96d16 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 9 Jun 2021 10:56:41 +0000 Subject: [PATCH] stages/users: fix user names schema validation Use `patternProperties` instead of `propertyNames` and `pattern`, which is not in draft 4 and so did not work (but also did not throw an error). Co-Developed-by: Achilleas Koutsou --- stages/org.osbuild.users | 76 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/stages/org.osbuild.users b/stages/org.osbuild.users index e48a9286..3c91bf21 100755 --- a/stages/org.osbuild.users +++ b/stages/org.osbuild.users @@ -22,48 +22,48 @@ SCHEMA = """ "additionalProperties": false, "properties": { "users": { + "additionalProperties": false, "type": "object", "description": "Keys are usernames, values are objects giving user info.", - "propertyNames": { - "pattern": "^[A-Za-z0-9_][A-Za-z0-9_-]{0,31}$" - }, - "additionalProperties": { - "type": "object", - "properties": { - "uid": { - "description": "User UID", - "type": "number" - }, - "gid": { - "description": "User GID", - "type": "number" - }, - "groups": { - "description": "Array of group names for this user", - "type": "array", - "items": { + "patternProperties": { + "^[A-Za-z0-9_][A-Za-z0-9_-]{0,31}$": { + "type": "object", + "properties": { + "uid": { + "description": "User UID", + "type": "number" + }, + "gid": { + "description": "User GID", + "type": "number" + }, + "groups": { + "description": "Array of group names for this user", + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "description": "User account description (or full name)", + "type": "string" + }, + "home": { + "description": "Path to user's home directory", + "type": "string" + }, + "shell": { + "description": "User's login shell", + "type": "string" + }, + "password": { + "description": "User's encrypted password, as returned by crypt(3)", + "type": "string" + }, + "key": { + "description": "SSH Public Key to add to ~/.ssh/authorized_keys", "type": "string" } - }, - "description": { - "description": "User account description (or full name)", - "type": "string" - }, - "home": { - "description": "Path to user's home directory", - "type": "string" - }, - "shell": { - "description": "User's login shell", - "type": "string" - }, - "password": { - "description": "User's encrypted password, as returned by crypt(3)", - "type": "string" - }, - "key": { - "description": "SSH Public Key to add to ~/.ssh/authorized_keys", - "type": "string" } } }