Repository navigation
Port info: bad port.json, ports.json and ports_info.json files can't … - #357
Merged
Merged
Conversation
…stop PortMaster
A hand-written version 3 port.json without "attr.runtime" stopped
PortMaster starting (KeyError: 'runtime'). A fuzzer found the rest:
- port_info_load hands back the types everything else expects: name,
status, source and files are checked and cleaned, min_glibc must be
a version, runtimes must be plain file names.
- A port.json name with nothing left once cleaned ("/") is found from
its items, like a missing one.
- ports.json: entries that aren't objects, have no download url, or
have bad sections are skipped, not fatal. A string entry is no longer
read as a port.json path. Util and runtime names must be file names.
- ports_info.json is cleaned when loaded: a port.json is only written
to a "file" inside the ports folder, and owners need a usable name.
port_stats.json download counts must be numbers.
- JSON nested too deeply loads as None instead of raising.
- is_safe_port_item also refuses NUL bytes and names too long for the
file system; installed screenshots use it.
- muOS: the application folder comes from the script's own name, so a
"../" in a files key can't reach outside the applications folder.
- Text the font can't draw ("\n", zero-width characters, a width
narrower than a character) no longer crashes the GUI.
tests/test_fuzz_port_json.py fuzzes all of this through startup,
sources, zip installs, ports_info.json and script signatures, the CLI
and the GUI screens, checking every delete and write stays in the
test's tmp dir. A short fixed-seed run is part of the suite; 100,000
cases per path on Python 3.7 and 3.11 found nothing more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NxABmR1rUUgi4iicVLZchY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…stop PortMaster
A hand-written version 3 port.json without "attr.runtime" stopped PortMaster starting (KeyError: 'runtime'). A fuzzer found the rest:
tests/test_fuzz_port_json.py fuzzes all of this through startup, sources, zip installs, ports_info.json and script signatures, the CLI and the GUI screens, checking every delete and write stays in the test's tmp dir. A short fixed-seed run is part of the suite; 100,000 cases per path on Python 3.7 and 3.11 found nothing more.