Skip to content

Mass Assignment (ARCH8129)

Key kotlin.security.mass-assignment · Severity warning · Category security · CWE CWE-915

Flags a @RequestBody bound straight to a persisted entity and saved - every column, including the protected ones, is writable from the request.

@PostMapping fun create(@RequestBody user: User) = repo.save(user)
@PostMapping fun create(@RequestBody dto: CreateUserDto) = repo.save(dto.toEntity())

Bind requests to a DTO with the allowed fields and map explicitly.