Skip to content

Include example and recommendation for proper schema validation in A8:2019 Injection #4

@flascelles

Description

@flascelles

Injection could cover case where validation is done but does not go far enough as well as an associated recommendation using this example below.

Scenario #
“An e-commerce API validates that a quantity input parameter in a shopping cart represented in JSON is an integer but stops short at validating that the value is not a negative value. Attacker uses this vulnerability to get zero-sum totals in a transaction:
POST /ecommerce/cart
{
items:[
{
id: 123456,
quantity: 1,
price: 200
},
{
id: 789123,
quantity: -2,
price: 100
}
]
}”

How to Prevent
“Validate incoming structured data using schemas (e.g. JSON schema) that include sufficient filters to only allow valid values for each input parameter.”

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