Open
Description
Kazuki Shimizu opened DATACMNS-966 and commented
I'll suggest to add annotation that specify allowed sort properties to limit an injection as follow:
@Documented
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface AllowedSortProperties {
String[] value();
}
@RequestMapping("/accounts")
@RestController
public class AccountsRestController {
@GetMapping
public Page<Account> findPage(@AllowedSortProperties({"id", "name"}) Pageable pageable) {
// ...
}
}
When an invalid property is detected, i think better it is ignore from sort property.
What do you think for this suggestion ?
I will submit pull request at later.
Thanks.
Affects: 1.12.6 (Hopper SR6)
Referenced from: pull request #190
1 votes, 3 watchers