M1 review round 2: the transport is no way round, nobody raises its own role, late staff collections
R2-1 the SMTP password is bound to server, port and user whatever the transport says; the transport alone is not bound.
R2-2 where the plugin's update rule is in force the roles field is closed for the account itself
(the plugin's roles: only an admin; roles of the project's own: never one's own).
R2-3 auth collections a later plugin adds get the account rules, the password rule and the first-user endpoint when
the config goes live; a staff slug that is not an auth collection stops the start.
R2-4 smtpRequireTls is taken out: the branch adds no field, column or collection.
Also: read (a staff account) and unlock (an admin) defaults on staff collections (accounts.staffOnlyRead);
doctor staff-own-roles and read / unlock in staff-accounts-open; r1 NULL against the default, also inside a row;
r2 bound values compared exactly.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
a32329fbb4
commit
7002ebbfa6
@@ -191,16 +191,37 @@ export const securityRules: DoctorRule[] = [
|
||||
check: (ctx) =>
|
||||
(ctx.deep?.staffOpenToOthers ?? []).map((entry) => {
|
||||
const [slug, operation] = entry.split(':')
|
||||
const what: Record<string, string> = {
|
||||
create: ': it can make itself a staff account',
|
||||
read: ': it can list the staff accounts (addresses, roles)',
|
||||
unlock: ': it can lift the lock after failed logins, which helps guessing a password',
|
||||
update: ": it can change a staff account's password",
|
||||
}
|
||||
const option = operation === 'create' ? 'adminOnlyCreate' : operation === 'read' ? 'staffOnlyRead' : 'adminOnlyWrite'
|
||||
return {
|
||||
fix: `give "${slug}" an access.${operation} rule that asks for a staff account (staffCreateAccess, staffUpdateAccess('${slug}'), adminOrSelfIn('${slug}')), or drop accounts: false / accounts.adminOnly${operation === 'create' ? 'Create' : 'Write'}: false`,
|
||||
message: `an account of another auth collection may ${operation} in the staff collection "${slug}"${operation === 'create' ? ': it can make itself a staff account' : operation === 'update' ? ": it can change a staff account's password" : ''}`,
|
||||
severity: 'error' as const,
|
||||
fix: `give "${slug}" an access.${operation} rule that asks for a staff account (staffCreateAccess, staffUpdateAccess('${slug}'), staffReadAccess, adminOrSelfIn('${slug}')), or drop accounts: false / accounts.${option}: false`,
|
||||
message: `an account of another auth collection may ${operation} in the staff collection "${slug}"${what[operation] ?? ''}`,
|
||||
severity: operation === 'read' ? ('warning' as const) : ('error' as const),
|
||||
}
|
||||
}),
|
||||
docs: 'docs/access.md',
|
||||
group: 'security',
|
||||
source: 'deep',
|
||||
},
|
||||
{
|
||||
// A staff collection with role values of its own on the plugin's default rules: the plugin cannot rank
|
||||
// those roles, so inside the collection every account may create an account with any role.
|
||||
id: 'staff-own-roles',
|
||||
check: (ctx) =>
|
||||
(ctx.deep?.staffOnOwnRoles ?? []).map((slug) => ({
|
||||
fix: `write "${slug}"'s own access.create / update / delete rules (and field access on its roles field) from its own roles`,
|
||||
message: `the staff collection "${slug}" has role values of its own and no access rules: accounts of other collections are kept out, but inside it every account may create, change and delete accounts, with any role`,
|
||||
severity: 'warning' as const,
|
||||
})),
|
||||
docs: 'docs/access.md',
|
||||
group: 'security',
|
||||
source: 'deep',
|
||||
},
|
||||
{
|
||||
// Turnstile lets submissions through while it is misconfigured or Cloudflare fails ("degraded") — visible here.
|
||||
id: 'turnstile-degraded',
|
||||
|
||||
Reference in New Issue
Block a user