server: system accounts cannot be registered
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

While refactoring the previous commit, it seemed like the previous
authors expected that a system account could be registered somehow
and that this would be an error condition. However, as now made
explicit with this, it is not possible to register a system account.

This means that any account by that name could only ever have been
created by the system itself so fetching them should be fine and not
an error condition.
This commit is contained in:
Johann150 2023-04-20 22:10:31 +02:00
parent 688deda218
commit 9b8438cdfc
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -26,6 +26,8 @@ type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends bo
const ajv = new Ajv(); const ajv = new Ajv();
// It is important that localUsernameSchema does not allow any usernames
// containing dots because those are used for system actors.
const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const; const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const;
const passwordSchema = { type: 'string', minLength: 1 } as const; const passwordSchema = { type: 'string', minLength: 1 } as const;
const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;