[security] Mass assignment fix sweep
fix: [security] Mass assignment fix sweep
[security] Mass assignment fix sweep7acf82-fix-security-mass-assignment-fix-sweep-cve-2026-56422fixsecurity mass assignment fix sweep
Committed by iglocska
commit message
fix: [security] Mass assignment fix sweep
CRUDComponent::edit() central id-pin (Milestone 0 of the controller
mass-assignment audit).
- CRUDComponent::edit() copied every supplied field onto the loaded record,
including a payload-supplied primary key, so an injected id redirected the
save() onto an arbitrary row (CakePHP treats an id in the save data as an
UPDATE target). The scope/auth check only validated the loaded record.
- Capture the loaded record's id before the field copy and re-pin it afterwards
so a payload id can never move the write off the authorised row. Robust even
when a controller passes a custom 'get' query (pins to the loaded id, not the
route id).
- Closes the id-redirection vector for all CRUD-edit controllers in one place.
Ownership foreign-key pinning (org_id/user_id/...) remains per-controller.
- Verified live on Allowedlists admin_edit: editing record A while injecting
record B's id now updates A and leaves B untouched (hijacks B without the fix).
- as reported by Jeroen Pinoy
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>Editor assessment
This commit patches CVE-2026-56422. The body explains the central id-pin added to CRUDComponent::edit(), where the loaded record's fields were copied along with any payload-supplied primary key, so an injected id redirected save onto an arbitrary row while the authorisation check only covered the loaded record. Capturing the id before the copy and re-pinning it afterwards is a proportionate fix, and the note that it also holds when a controller supplies a custom get query shows the author considered edge cases. Mentioning that ownership foreign keys remain per-controller honestly scopes the change. The only weakness is the blanket subject.