Aller au contenu

Mass Assignment (ARCH9129)

Ce contenu n’est pas encore disponible dans votre langue.

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

Flags a Fluent model decoded straight from the request body and saved - every column is writable from the request.

let user = try req.content.decode(User.self)
try await user.save(on: req.db)
let dto = try req.content.decode(CreateUserDto.self)
let user = User(name: dto.name)

Decode a DTO with the allowed fields and map explicitly.