Bug 16520 - layerindex: a NUL byte in a search or URL gives 500 on PostgreSQL
Summary: layerindex: a NUL byte in a search or URL gives 500 on PostgreSQL
Status: NEW
Alias: None
Product: Layer Index
Classification: Yocto Project Subprojects
Component: Layer Index (show other bugs)
Version: 6.1
Hardware: All Multiple
: Medium normal
Target Milestone: 6.2
Assignee: Tim Orling
QA Contact: apoorv sangal
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2026-11-16 04:19 UTC by Tim Orling
Modified: 2026-11-16 04:45 UTC (History)
0 users

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Orling 2026-11-16 04:19:33 UTC
PostgreSQL text can't hold a NUL byte, so a query that compares a column with a string containing one raises DataError and gives a 500:

    /layerindex/branch/master/recipes/?q=%00
    /layerindex/api/recipes/?filter=pn:%00
    /rrs/recipes/%00/6.2/M1/
    DataError: PostgreSQL text fields cannot contain NUL (0x00) bytes

MariaDB accepts these and returns no results. This needs fixing before the move to PostgreSQL (bug 16476): reject or strip NUL in search terms and path values before they reach the database (e.g. Django's ProhibitNullCharactersValidator on the search forms, or one middleware returning 400). Found by fuzz testing a bench instance running PostgreSQL 17.