IAWL ideas, group B: sizes before work, one link rule, no stand-in locale, strict switches

- Request bodies from strangers are read only up to a cap, declared length or not:
  mail-service confirm, CSP reports, page views, MCP (maxBytes, 413). readCappedBody moves
  to shared/ (the consent log keeps exporting it).
- searchContent / createSearchRoute / MCP search: queryLimit (default 200 characters,
  10 words) before the database; an unknown ?locale is the default locale throughout.
- Rich text: autolinks and links marked internal pass safeHref too; lexicalToMarkdown
  drops unsafe link targets.
- truncate() never returns more than its limit (summary / meta autofill after validation).
- resolveRoute answers null for a locale the site does not have (xx, all, *): no
  default-locale page under another code (page route past the proxy, /md/xx, MCP).
- A 404 page that is a draft is not shown (resolveNotFoundPage, getNotFoundPage).
- readPublished() access rule (exported); Site integrations readVersions: admin.
- Plugin switches, buildCsp, buildSecurityHeaders and the seed guard refuse nonsense
  values at start; an unknown role name is met by nobody, requireRole throws on one.
- Docs, AGENT.md, iapl-collection and iapl-audit skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 20:25:26 +01:00
co-authored by Claude Opus 5.5
parent e821d52d19
commit ecf03c8dc0
38 changed files with 914 additions and 69 deletions
+12 -1
View File
@@ -169,7 +169,7 @@ They fail closed: where the staff collections are not known, nobody is staff, an
### Collection-level (return boolean | Where)
```ts
import { adminOnly, adminOrEditor, adminOrSelf, adminOrSelfIn, requireRole, authenticated } from '@intecion/ipal-kit'
import { adminOnly, adminOrEditor, adminOrSelf, adminOrSelfIn, readPublished, requireRole, authenticated } from '@intecion/ipal-kit'
export const Articles = {
slug: 'articles',
@@ -191,8 +191,19 @@ access: { read: adminOrSelf } // fine with a single auth collection
// any minimum threshold
access: { update: requireRole('editor') }
// a collection with drafts: editors (or the role you name) read everything; visitors, plain `user` accounts and a
// session that still owes its second factor read published documents only — by id, in lists, with ?draft=true and
// over GraphQL. Payload's open `read: () => true` answers ?draft=true with the draft itself (1.17.1).
access: { read: readPublished(), readVersions: readPublished() }
access: { read: readPublished('admin') }
```
A role name the plugin does not know (`requireRole('Admin')`, `readPublished('superadmin')`) throws where the rule
is written; `hasMinimumRole` / `userMeetsRole` answer `false` for it (before 1.17.1 every staff account met it).
`readPublished` with `?draft=true` on a page whose newest version is a draft answers a visitor `404` (Payload applies
the rule to that version), never the draft.
### Field-level (return boolean)
```ts