CodeIgniter 4.7
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- CodeIgniter 4.770 lines · 3.9K tokens
Total215 lines · 9.3K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 252
- 256
- 295
- 306
- 307
- 323
- 330
- 338
- 340
- 352
- 354
- 367
- 384
- 390
- 404
- 409
- 434
- 470
- 488
- 502
- 522
- 524
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 698
- 732
- 770
- 776
- 798
- 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 CodeIgniter 4.7 on PHP 8.5; the framework requires PHP 8.2 or newer with intl and mbstring. CodeIgniter maintains only its latest release, so move to each new CodeIgniter 4 release, including a new minor, instead of staying on an older one. When maintaining or backporting framework code, keep the trusted-proxy check on forwarded HTTPS headers, deleteBatch() bind escaping, the extension checks in is_image and mime_in, and default upload-filename sanitizing.
Routes, filters, and authorization
- Keep
Config\Routing::$autoRoute = falseand define routes with explicit HTTP verbs and constrained placeholders. Avoid$routes->add()for mutations: it accepts unexpected verbs, while CSRF checks cover only POST, PUT, PATCH, and DELETE. Keep GET and HEAD free of state changes. - Attach the application's authentication and authorization filters to every protected route or group. Deny access in
before()by returning a response or throwing; returningfalse, merely constructing a redirect, or returning a redirect frominitController()does not stop the controller. Perform record and tenant authorization before its side effects. - When Shield authenticates an API, put its
tokens,hmac, orjwtfilter on every protected route group, issue access tokens with explicit scopes instead of the wildcard default, and check any further scopes withtokenCan(), orhmacTokenCan()for HMAC keys, because a route filter checks only the first one. Set$unusedTokenLifetimeand per-token$expiresAtto your policy rather