<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>16519</bug_id>
          
          <creation_ts>2026-11-16 04:19:33 +0000</creation_ts>
          <short_desc>layerindex: non-numeric ids in URLs and branch_comparison parameters give 500 instead of 404</short_desc>
          <delta_ts>2026-11-16 04:45:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Layer Index</product>
          <component>Layer Index</component>
          <version>6.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Orling">tim.orling</reporter>
          <assigned_to name="Tim Orling">tim.orling</assigned_to>
          
          
          <qa_contact name="apoorv sangal">apoorvsangal</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>107495</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2026-11-16 04:19:33 +0000</bug_when>
    <thetext>Several URL patterns in layerindex/urls.py capture the primary key with [-\w]+, which matches any word, and the views pass it to the id field, so a non-numeric value raises ValueError and gives a 500:

    /layerindex/recipe/NaN/
    /layerindex/recipe/_/
    /layerindex/oe-classic/recipe/x/
    /layerindex/comparison/recipe/x/
    ValueError: Field &apos;id&apos; expected a number but got &apos;NaN&apos;.

The from_branch and to_branch query parameters of /layerindex/branch_comparison/ (and _plain, _rst) have the same problem through get_object_or_404(Branch, id=...):

    /layerindex/branch_comparison/?from_branch=&amp;to_branch=1
    ValueError: Field &apos;id&apos; expected a number but got &apos;&apos;.

The URL patterns should use &lt;int:pk&gt; (or \d+) so these are a 404, and the branch parameters should be validated (404 or 400). Found by fuzz testing a bench instance; the same on MariaDB and PostgreSQL.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>