Skip to content

records: check that /latest endpoint has sensible argument n #968

@GraemeWatt

Description

@GraemeWatt

The /record/latest endpoint calls the get_latest function with an argument n to return JSON metadata for the n latest records from the OpenSearch index. This function is only called from the HEPData code with n=3 for displaying information about the three latest records on the HEPData homepage via hepdata_home.js. Recently, I noticed Sentry exceptions from a RequestError with n=12000 arising from this line and a ValueError with n=-5 arising from this line. The get_latest function should check that the value of the argument n is an integer between 0 and 10000, otherwise it should return an error message in JSON format.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions