ExtantApe

payload plugin whitehat

by ExtantApe
Logging & monitoring
v3
^3.80.0
MIT

Overview

Summary generated from the README

Whitehat tests a Payload site for security holes using plain functions that run in your test suites, plus a plugin that adds a whitehat-alerts collection to the admin. It checks read and write access per role with canary records, forged credentials, and a checklist of header, cookie, CORS, GraphQL and secrets checks. It only reports findings and never fixes anything; some probes write, so use a throwaway database. Requires Payload 3.80 or newer.

Features

  • Access check that signs in as each role and looks for canary markers on every read path
  • Forbidden-write probes that fail when a role is allowed or the refusal message leaks data
  • Forged-credential checks using fake session cookies and spoofed forwarding headers
  • Checklist checks for headers, cookies, CORS, open redirects, GraphQL, admin exposure, client secrets and uploads
  • Alerts collection with fingerprinting, bulk snooze, Retest selected and an onCritical callback
  • Findings ranked critical to info, with unrun checks reported as not checked

Use cases

  • Catch private records leaking through public reads or relationships before release
  • Verify that roles cannot perform writes they should be refused
  • Track and triage recurring security findings from the admin panel

From the author

Whitehat for Payload: finds security holes in a Payload site, its database, code and UI, with severity-ranked alerts and a checklist that grows with every incident.

Installation

npm i @extantape/payload-plugin-whitehat

0

Stars

0

Forks

0

Open Issues

1 weeks ago

Last Updated

295

Weekly Downloads

v0.5.0

npm Version

247.1 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Nov 8

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20260
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
npm weekly downloads

316+316 since Nov 11

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026316
Dec 5, 2026472
Dec 4, 2026629
Dec 3, 2026608
Dec 2, 2026595
Dec 1, 2026570
Nov 30, 2026380
Nov 29, 2026354
Nov 28, 2026190
Nov 27, 202630
Nov 26, 202633
Nov 25, 202636
Nov 24, 202638
Nov 23, 2026197
Nov 22, 2026192
Nov 21, 2026189
Nov 20, 2026182
Nov 19, 2026174
Nov 18, 2026169
Nov 17, 2026161
Nov 16, 20260
Nov 15, 2026441
Nov 14, 2026441
Nov 13, 2026403
Nov 12, 2026166
Nov 11, 20260

Each point is npm's rolling 7-day download count.

Health Score

73/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1451881672-root.svg)](https://payloaddirectory.dev/plugins/1451881672-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1451881672-root"><img src="https://payloaddirectory.dev/badge/1451881672-root.svg" alt="Payload Directory"></a>
Updated Nov 29, 2026Created Nov 9, 2026Published Nov 28, 2026

README

payload-plugin-whitehat

Whitehat for Payload: finds security holes in a Payload site, its database, code and UI, with severity-ranked alerts and a checklist that grows with every incident.

Status: early. 0.5.0 is the latest release. Releases go to npm as @extantape/payload-plugin-whitehat. 272 tests.

  • The access check works; its tests include the two real leaks it was written to catch (a private related record's id in a public read, and a refusal that answered a question it shouldn't).
  • Checklist checks: 26 are automated, each tested against made-up responses (CHECKLIST.md says which).
  • Alerts: the collection, bulk snooze and Retest selected were tried in a real Payload admin on a local copy of a site, with made-up findings. Saving a snooze, retesting and the refusal messages worked.
  • Not tried yet: running against a real site's own suites; dependency advisories (still planned).

What it does

  • Access check. You declare canaries: records only some roles may see, each carrying a unique marker. Whitehat signs in as every role you give it and looks for the marker on every read path: list and by-id reads at depths 0 to 2 (payloadReadPaths), plus any REST or GraphQL paths you add through your route handlers. You also declare forbidden writes: things a role must not be able to do. It tries each one, and fails it if it's allowed, or if the refusal's message says something it mustn't. Only a real refusal passes: HTTP 401 or 403 by default, or what you describe with refusal (a pattern or a function) when the site refuses another way. Any other error, such as a validation error from a probe missing a field, is not checked, because an allowed write that failed for another reason looks the same.
  • Untrusted credentials. runCredentialCheck asks each page, endpoint, action or gate you list as a signed-out visitor, then again with forged credentials (fake, expired, malformed and foreign session cookies; forged role, tenant or preview cookies you name; forged x-forwarded-* and Vercel bypass headers). A forgery that gets more than the signed-out request is a finding: high if data or an action is behind it, medium for a courtesy gate. Where a signed-out visitor already gets a 2xx (a sign-in page served as 200), a bypass looks the same, so give secretMarkers (text only someone let through would see); without them that target is not checked.
  • Findings are ranked critical, high, medium, low or info, and each says how it was found and how to reproduce it. A check that can't run is reported as not checked, never as passed.
  • Checklist checks (checkHeaders, checkCookies, checkCors, checkOpenRedirects, checkGraphql, checkAdminExposure, checkClientSecrets, checkUploads, scanUserContent): each takes plain answers or config, so it runs the same against dev, test or (read-only) a live site.
    • The secrets and content scans name the pattern and the record, never the matching text.
  • Alerts in the site's own database (the whitehat plugin, whitehat-alerts).
    • Findings are recorded by fingerprint, so a re-run updates an alert rather than adding one; an alert resolves when its check passes, or when its suite runs in full and no longer reports it (a cleaned record). A suite that reports nothing at all resolves nothing. An alert is resolved by absence only after a full run where every finding passed or failed. If any check reports not checked, alerts the run didn't report stay as they are. A suite must return every check's findings, including not-checked ones. Name client bundles without their content hash, so a rebuilt bundle keeps its fingerprint.
    • Snooze several at once with the admin's own bulk Edit: an end date (at most 90 days) and a reason are required, and the snooze holds through later runs until it ends. People can only change the snooze, never what was found.
    • Retest selected re-runs only the checks behind the selected alerts.
    • New critical alerts call onCritical once, so the site can tell the owner.
    • Nobody sees alerts without the site's access, and only an answer of exactly true lets someone in. Anything else is a no: false, 1, 'yes', an object (one shaped like a query included, so it can't become a read filter), or an error thrown or rejected. A broken rule refuses with 403 instead of a 500, and nobody who isn't signed in gets in, whatever access says. Since 0.2.2: before, any truthy answer let someone in, and an object went to Payload as the alerts' read and update access.
  • It only finds. It never fixes anything or changes settings. Some checks do write. The ones that write by themselves (the record checks and runServerBackDoorCheck) need allowWrites: true. Others run the writes you give them, such as the access check's forbidden writes, without it. Run anything that writes on a throwaway database. The whitehat plugin also stores its alerts in the site's database.
  • Review-finding checks. Functions a plugin repo runs in its own tests against a Payload instance: a response-difference probe, a transactions-off check, server-code back doors (bulk, disableTransaction, overrideAccess), host rules that replace defaults, flags a plugin leaves on the caller's req.context, and a small source lint. They report and never fix, but the probes write: they try to create, change and delete rows in the collections you name, so run them on a throwaway database. Only the marker (an APIError your plugin throws with status 403 and { refusal: 'transactions-required' }), or an error with a bare 401, 403 or 404 status, counts as a refusal; any other error, text included, is reported as not checked, never as a pass. See docs/review-checks.md. runServerBackDoorCheck needs allowWrites: true too. The other checks only run the callbacks you give them, and Whitehat can't stop those callbacks from writing.
  • Record checks. Functions for the same kind of test run: a write that changes nothing must not answer with a record the caller can't read, a real id and a made-up id must get the same answer from someone who isn't allowed, and duplicating a record must follow the create rules for the copied data and leave out fields the person can't read. They write, so each one refuses to run unless you pass allowWrites: true, and inside a site suite only when the suite is declared { run, writes: true } and allowWriteProbes is true. Anything else is reported as not checked and nothing is written. Each check deletes the records it made itself, and only those, when it finishes, even after an error, and reports any it couldn't delete. Rows that appear in the checked collection during a check and that the check didn't make itself (from your writes, operations, hooks or other writers) are listed by id in a left-behind finding and never deleted. Rows added to other collections aren't seen. Rows that appear at other moments, such as while your seed runs, during the create-rules check's two test creates, while a check reads the stored record, or during clean-up aren't listed, and they aren't deleted either. Updates and deletes that got through are the hole being shown, and they aren't undone. What they can't judge is not checked. Your delete hooks, afterDelete included, run during clean-up.

Run it against a throwaway or test database. Never point write probes at a live site. A suite that tries writes is declared as { run, writes: true }, and the plugin refuses to start with one unless allowWriteProbes: true, which belongs only on a throwaway test copy: Retest selected runs suites inside the site.

On its own, and with others

On its own: the checks are plain functions that take your site's read and write functions, so they run with no other plugin. The whitehat plugin adds the alerts collection and needs your access.

Needs: Payload ^3.80.0 as a peer dependency, with @payloadcms/ui ^3.80.0, Next.js >=15 and React ^19.0.0 optional. No other EXTANT APE plugin is required.

Works with: nothing is wired to another plugin. It tests whatever access rules the site has, including ones other plugins add. Hats' design plans a Whitehat canary for it: an admin wearing Member must not read admin-only records.

Color Theory: no direct link. Its one admin control, the retest button, uses Payload's button styles and --theme-* colors, so it follows Color Theory's admin colors when its applyToAdmin option is on.

Family: It's part of the Defense family (a working draft): plugins designed to sit together to find and stop abuse. The other member, Guardrails (rate limits), isn't built yet.

Use

import { formatReport, payloadReadPaths, runAccessCheck } from '@extantape/payload-plugin-whitehat'

const findings = await runAccessCheck({
  viewers: [{ role: 'signed-out', user: null }, { role: 'member', user: member }, { role: 'staff', user: admin }],
  canaries: [
    {
      id: 'private-note',
      title: 'A private note is readable by others',
      marker: privateNote.id,
      visibleTo: ['staff'],
      paths: payloadReadPaths(payload, { collection: 'notes', ids: [privateNote.id], where: { site: { equals: site.id } } }),
    },
  ],
  writes: [{ id: 'edit-others', title: 'A member edits someone else’s note', role: 'member', attempt: (v) => payload.update({ collection: 'notes', id: othersNote.id, data: { text: 'x' }, overrideAccess: false, user: v.user as never }) }],
})
console.log(formatReport(findings))

Commands

npm test          # Vitest
npm run typecheck
npm run build     # dist/

Releasing: see RELEASING.md.

License

MIT

Similar plugins