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
@@ -5,12 +5,13 @@ import { describe, expect, test } from 'vitest'
|
||||
import { bottomOverlap } from '../src/modules/consent/CookieButton.js'
|
||||
import { TOTP_TEXTS } from '../src/modules/security/totp/totpTexts.js'
|
||||
import { ipalKit } from '../src/plugin.js'
|
||||
import { withTotpParts } from './helpers.js'
|
||||
|
||||
const i18n = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }, { code: 'en', label: 'English' }] }
|
||||
|
||||
/** Stand-in for @clocklimited/payload-2fa: its own texts and the two views, as the package adds them. */
|
||||
const fakeTotp = () => (config: Config) => ({
|
||||
...config,
|
||||
const fakeTotp = (o: { collection: string }) => (config: Config) => ({
|
||||
...withTotpParts(config, o.collection),
|
||||
admin: {
|
||||
...config.admin,
|
||||
components: {
|
||||
|
||||
Reference in New Issue
Block a user