Dipstick for Craft CMS

Dipstick is a Craft 6 plugin. Craft 6 is still in beta, and so is Dipstick (6.0.0-beta.1) — try it on staging first and use caution on production sites.

Findings

Dipstick is for Craft 6, which is in beta. Use caution on production.

The score starts at 100: each critical finding costs 25, each warning 10, each notice 3. Ready means no critical or warning findings. Findings are grouped per rule per source (the app, a plugin package, the templates), with every matching line as evidence.

RuleSeverityUsual fix
static-request-stateCriticalKeep per-request values on a scoped() service, or reset the static on RequestReceived
singleton-captures-requestCriticalBind with scoped() / #[Scoped], or read the user/site when needed
controller-captures-requestCriticalTake the request in the action, not the constructor
static-array-growthWarningonce(), a scoped() service, or cap and reset the array
static-property-write, static-variable, global-stateWarningMove the value onto a scoped() service
superglobal-accessWarningrequest()->query(), ->ip(), ->header()
native-responseWarningSet headers and cookies on the Laravel response; use session()
worker-exitWarningabort() or ->throwResponse()
process-state, shutdown-functionWarningDo it once at boot, or defer()
listener-in-request, runtime-define, constructor-captures-requestNoticeRegister once in boot(); guard define()
probe-request-leak, probe-user-leak, probe-site-leakCriticalDon't keep the request, user or site on a long-lived service
probe-static-growth, probe-memory-growthWarningFind what collects per request; cap or reset it
probe-static-mutation, probe-render-error, probe-unresolvableNoticeCheck what the static holds; check the page renders

Accepting a finding

Each finding and each row of evidence has a 12-character fingerprint that doesn't change between audits (it has no line numbers). Put it in Settings → Dipstick → Ignore, one per line (# starts a comment), or add a @dipstick-ignore comment on, or just above, the line of code. Leave out takes paths as the report shows them, with * wildcards (app/Legacy/*).

More plugins

Pairs well with Dipstick