CakePHP 5.4
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- CakePHP 5.487 lines · 4.6K tokens
Total232 lines · 10K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 93
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 252
- 256
- 295
- 306
- 323
- 338
- 340
- 352
- 354
- 362
- 367
- 384
- 390
- 404
- 409
- 413
- 434
- 470
- 488
- 502
- 522
- 524
- 525
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 675
- 732
- 770
- 776
- 798
- 799
- 807
- 829
- 862
- 915
- 916
- 918
- 940
- 942
- 1004
- 1275
- 1287
- 1333
- 1395
Prompt Preview
Apply the PHP 8.5 baseline first. These rules cover CakePHP 5.4 on PHP 8.5; the line requires PHP 8.2 or later. Apply the authentication and authorization plugin rules when those plugins are installed.
Requests, routing, and proxy trust
- Wrap downstream request processing with
ErrorHandlerMiddleware. RunRoutingMiddlewarebefore checks that use route parameters, andBodyParserMiddlewarebefore authentication or CSRF checks that consume parsed bodies. Review middleware coverage for plugin, prefix, fallback, and API routes. - Restrict routes to their intended verbs and call
$request->allowMethod()in mutation actions. Keep GET and HEAD free of mutations. Account for_methodandX-Http-Method-Override; inspectORIGINAL_REQUEST_METHODor reject overrides where the endpoint requires the original transport verb. - Enforce accepted media types and body-size limits before parsing.
BodyParserMiddlewareenables JSON and disables XML by default; its JSON decoder casts valid scalar and null values to arrays. UseaddParser()with strict decoding and explicit top-level shape checks when the contract requires an object or list; do not treat successful parsing as validation. - Give
#[RequestToDto]an explicitRequestToDtoSource::Bodyor::Querywhere only one source is allowed.Autocan fall back to query parameters when a mutation body is empty, andRequestmerges query and body data. Validate fields and invariants in the DTO'screateFromArray()path before business use. - Enable
ServerRequest::$trustProxyor callsetTrustedProxies()only behind an