Security: staff checks only for staff collections; 2FA covers what the plugin adds
Staff check (userMeetsRole): the 'no roles field = every account passes' rule applied to the account's own collection, so an account of a second auth collection (customers) passed every staff check. It now applies only to staff collections: the panel's login collection plus the new access.staffCollections. The injected auth collection uses the new adminOrSelfIn(slug), so an account of another collection with the same numeric id is not 'self'. 2FA: @clocklimited/payload-2fa wraps the collections and globals present when it runs; ipalKit's own globals and collections were added later and stayed unwrapped, so a password without the TOTP code opened them over REST and GraphQL. ipal-kit now has its own second-factor check (secondFactorPassed / requireSecondFactor): applied to every collection and global at the end of ipalKit, again in onInit for entities added by plugins listed after it, and inside userMeetsRole and the endpoints that take a project access function. It fails closed: an unrecognised user shape is refused, and startup stops when the injected 2FA plugin lacks the parts the check reads (twoFactor.guard: false opts out). Tests through real HTTP requests (REST and GraphQL) against Payload's route handlers, plus the reference smoke test. Docs, agent guide, skills and the reference skills copy updated; changelog entry without a version. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
bc1045a5b7
commit
0c61ac231b
@@ -231,6 +231,15 @@ export type IpalOptions = {
|
||||
* injects). Must be an auth collection.
|
||||
*/
|
||||
collectionSlug?: CollectionSlug
|
||||
/**
|
||||
* ipal-kit's own second-factor check on every collection and global —
|
||||
* also the ones added after the 2FA package ran (ipal-kit's own, other
|
||||
* plugins') — and in `userMeetsRole`. On by default. `false` leaves only
|
||||
* the package's wrapper, which does not cover those: a staff password
|
||||
* without the TOTP code then reads them over the API. Only for a 2FA
|
||||
* package version the check does not recognise; docs/security.md.
|
||||
*/
|
||||
guard?: false
|
||||
/** Name shown in the authenticator app (e.g. company/site name). */
|
||||
issuer: string
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user