Panel actions only from the site's own origin (adminSameOrigin); doctor reads serverURL from the running config

The plugin's panel actions (mail service connect / disconnect, test e-mail,
cookie scan, approval, crawl) act with the panel's login cookie and read a
text/plain body, which another origin sends without a CORS preflight; a
sibling subdomain is same-site and Payload's csrf list is empty without
serverURL. On 1.17.1 such a page reached connect with an admin's cookie
(it called the mail service). Now each refuses a request a browser marks as
coming from elsewhere (403 before anything is read), the rule of the 2FA
endpoints; only endpoints the plugin added; logged once per origin, naming
adminSameOrigin. adminSameOrigin: false / { origins } (owner's Q6).
iapl-doctor csrf-empty: the deep status reports originKnown (serverURL or
csrf in the running config, never the value) and it wins over the file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 10:46:05 +01:00
co-authored by Claude Opus 5.5
parent 97c62f21f0
commit 03f5cf1a8d
19 changed files with 308 additions and 10 deletions
+10 -1
View File
@@ -26,6 +26,7 @@ import type { FormsOption } from './modules/forms/types.js'
import type { RevalidatePathFn } from './modules/hooks/buildRevalidateHook.js'
import type { I18nConfig } from './modules/i18n/types.js'
import type { PagesOption } from './modules/pages/types.js'
import type { AdminSameOriginOption } from './modules/security/adminSameOrigin.js'
import type { SafeBackRule } from './modules/security/totp/safeBack.js'
import type { RequireSetupOptions } from './modules/security/totp/setupRequired.js'
import type { VerifyLimitOptions } from './modules/security/totp/verifyLimit.js'
@@ -57,7 +58,6 @@ export type IaplOptions = {
* Keys the project sets in its own `admin.meta` always win. `false` = Payload's defaults.
*/
adminMeta?: AdminMetaOptions | false
/**
* Custom admin panel route, e.g. '/its' instead of the default '/admin'.
* The plugin sets config.routes.admin. IMPORTANT: this alone isn't enough —
@@ -70,6 +70,15 @@ export type IaplOptions = {
*/
adminRoute?: string
/**
* The plugin's panel actions — `POST` mail service connect / disconnect, test e-mail, cookie scan, cookie
* approval, cookie crawl — refuse (`403`) a request a browser marks as coming from another origin, before
* anything is read (1.17.2). Own origins: the request's host (`Host`, `X-Forwarded-Host`), `serverURL`,
* Payload's `csrf` and `cors` lists, and `origins` here. `false` = no check (as before 1.17.2).
* The 2FA endpoints follow `twoFactor.sameOrigin`. docs/security.md "Panel actions only from the site's own origin".
*/
adminSameOrigin?: AdminSameOriginOption
/**
* Who supports the technology, named in the admin credit, the panel's link
* description and its preview image. Default `{ name: 'Intecion.com', url: 'https://intecion.com' }`.