{"id":"GHSA-q9m2-fhv9-3jcf","aliases":[],"url":"https://o3.security/vulnerability/GHSA-q9m2-fhv9-3jcf","summary":"`potato-annotation` has a Project-Boundary Bypass","details":"## Summary\n`validate_path_security` uses string-prefix containment (`startswith`) for boundary checks. This allows paths that are **outside** the intended project directory but share its prefix string (e.g., `/tmp/potato_proj_demo_evil/...` vs `/tmp/potato_proj_demo`) to be accepted.\n\n## Details\n### Affected source location (root cause)\n**File:** `potato/server_utils/config_module.py`\n\n**Snippet (lines 370–373):**\n```python\nreal_path = os.path.realpath(normalized_path)\nreal_base = os.path.realpath(base_dir)\nif not real_path.startswith(real_base):\n    raise ConfigSecurityError(...)\n```\n\n**Snippet (lines 384–389):**\n```python\nreal_path = os.path.realpath(normalized_path)\ncheck_dir = project_dir if project_dir else base_dir\nreal_check_dir = os.path.realpath(check_dir)\nif not real_path.startswith(real_check_dir):\n    raise ConfigSecurityError(...)\n```\n\n`startswith()` is string-based, so `/tmp/potato_proj_demo_evil/...` passes when checked against `/tmp/potato_proj_demo`.\n\n### Confirmed affected call sites\n**File:** `potato/server_utils/config_module.py`\n\n1) `validate_file_paths` task_dir branch (line 2113)\n```python\nvalidated_task_dir = validate_path_security(task_dir, project_dir)\n```\n\n2) `validate_file_paths` data_files branch (line 2151)\n```python\nvalidated_path = validate_path_security(file_path, base_dir, project_dir)\n```\n\n3) `validate_training_config` training.data_file branch (line 2286)\n```python\nvalidated_path = validate_path_security(data_file, base_dir, project_dir)\n```\n\n## PoC\n```python\nfrom potato.server_utils.config_module import validate_path_security\n\nbase = '/tmp/potato_proj_demo'\nvuln = '/tmp/potato_proj_demo_evil/file.txt'\n\ntry:\n    print('inside=', validate_path_security('/tmp/potato_proj_demo/file.txt', base, base))\nexcept Exception as e:\n    print('inside_error=', type(e).__name__, e)\n\ntry:\n    validate_path_security('/tmp/other_demo/file.txt', base, base)\nexcept Exception as e:\n    print('baseline=', type(e).__name__, e)\n\nprint('trigger=', validate_path_security(vuln, base, base))\n```\n\n## Impact\n- Can allow unauthorized sibling-prefix file access outside intended project boundary.\n- Can affect read paths (`data_files`, `training.data_file`, `base_css`, `header_logo`) and output/path placement depending on configuration.","published":"2026-05-08T17:31:07Z","modified":"2026-05-08T17:49:17.517037Z","cvss":{"score":5.1,"severity":"MEDIUM","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"PyPI","name":"potato-annotation","fixedVersion":"2.4.5"}],"fix":null,"references":[{"type":"WEB","url":"https://github.com/davidjurgens/potato/security/advisories/GHSA-q9m2-fhv9-3jcf"},{"type":"PACKAGE","url":"https://github.com/davidjurgens/potato"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-05-08T17:49:17.517037Z"}}