Skip to content

The usage of xorm get has risk #11921

@yuyuanshifu

Description

@yuyuanshifu

Description

Such as the usage of xorm get in models/attachment.go, if the id or uuid is empty, the query sql will be no where: select ... from attachment limit 1. The query will not be an error, but the query result could be not the result you want.
I suppose we use xorm get by this way:
attach := new(Attachment)
has, err := engine.Where("id=?", id).Get(attach)

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions