Changelog - 2026-11-07
A request cannot filter or sort on a hidden field
Security Breaking ChangeIn one line. A hidden property is never returned, but a where or an order on it reveals its value one question at a time. A request filter that names one is refused now.
What changed
- Refused with 400. On the generated CRUD controllers (
count,find,findOne,findById,updateBy,deleteBy) and on the generated search controllers, a request whosewhere,orderor includescopenames a property its model hides answers400, and nothing is read or changed. - Everywhere in the filter. The
whereat any depth ofandandor, a JSON path in any spelling (meta.pin,[meta].pin,.meta.pin,[meta]pinall name the columnmeta), theorderentries, and thescopeof an include, including a nested include. Each include level is judged by the properties of the model it reads, not by the parent's. - Same answer as an unknown column, byte for byte. The refusal is the error the query gives for a column or field that does not exist, in the same form for the same key (the table or relation name included). The message never says the field is hidden, so a caller cannot tell a hidden field from one that is missing.
- Nested search fields. A search model that hides a nested field (
meta.pin) refuses the field, any path under it, and its parent object (meta), which holds it. - Server code is unchanged. The repository's own methods (
find,count,updateBy, ...) still filter and sort on a hidden property, and a model's own default filter may name one. - Search. The search controllers hold
filter.whereandfilter.orderto it too. The repository's existing refusal of a hidden field inqueryBy,facetBy,facetQuery,groupByand the highlight fields is unchanged.
Who is affected
- Clients that filter or sort on a property the model hides. They get
400. Filter on a visible property, or do it in server code that calls the repository. - Everyone else. No action needed.
Breaking changes
WARNING
A request whose where, order or include scope names a hidden property answers 400.
Before:
typescript
// GET /products?filter={"where":{"costPrice":{"gt":100}}} -> 200, the rowsAfter:
typescript
// GET /products?filter={"where":{"costPrice":{"gt":100}}} -> 400, the error of a column that does not exist
// Server code on the repository is unchanged:
await productRepository.find({ filter: { where: { costPrice: { gt: 100 } } } });Details
| File | Package |
|---|---|
src/base/repositories/common/request-filter-guard.ts | kernel |
src/base/repositories/core/abstract.ts | kernel |
src/base/controllers/factory/crud/ | kernel |
src/relational/core/repositories/core/base.ts | connectors |
src/common/keys.ts | filter |
src/search/core/controllers/abstract.ts | connectors |