Repository navigation
Closed
Description
Summary
plugins/omi-github-app has critical flaws in repository resolution, input sanitization, and response parsing:
- Short repo names / voice inputs cause downstream 404s: When users speak or pass short repository names (e.g.
"omi"or"backend"),get_repo_for_requestpreviously passed the raw single segment directly. Downstream API calls construct endpoints like/repos/omi/issues, causing 100% HTTP 404 errors. - Ambiguity risks across orgs and forks: Multiple accessible repositories sharing the same short name lacked disambiguation guards, risking operations executing against unintended repositories.
- Unhandled
TypeErroron null fields:github_client.get_issueandlist_issuesreadissue.get("labels", [])andissue.get("assignees", []). When GitHub returns explicitnullfor these fields,.get()returnsNone, causingTypeError: 'NoneType' object is not iterablein list comprehensions. - Invalid format submissions in
tool_create_issue: Non-listlabelspayloads (e.g. strings or null from LLMs) resulted in malformed requests and GitHub API 422 errors. - Missing route alias: The Omi tool schema and conventions reference
/tools/add_issue_comment, but only/tools/add_commentwas bound, returning 404 for standard callers. - URL parsing edge cases & SSH support: Bare
split(":")allowed spoofeduserinfohosts in URLs, failed on single-segment URLs, and rejected standard[email protected]:SSH format. - Storage corruption risk:
save_users()insimple_storage.pyused unbuffered non-atomic write without file locking, risking zero-byte corruption under concurrency.
Root Cause Analysis
get_repo_for_request: lacked resolution logic againstuser["available_repos"]anduser["selected_repo"], and lacked whitelist validation (^[a-zA-Z0-9_.-]+$).github_client.py: list comprehensions directly iterated over.get(..., [])without checking forNone.main.py:tool_create_issue: expectedlabelsto strictly be alist, failing when strings orNonewere supplied.simple_storage.py:save_users: usedopen(USERS_FILE, 'w')directly withouttempfile+os.replaceor concurrency locks.
Key Changes
-
Strict Repository Resolution & Disambiguation (
main.py):- Implemented
_validate_owner_repowith strict regex whitelist (^[a-zA-Z0-9_.-]+$), blocking control characters (\n,\r,\t,\0), and forbidding./... - Added short-name resolution against
available_reposandselected_repowith unambiguous match resolution, explicit candidate disambiguation errors, and substring matching threshold (len >= 3). - Robust URL handling using
urllib.parse.urlparsecheckingparsed.hostname, blocking spoofed hosts, and supporting[email protected]:SSH URLs. - Enforced validation across
/update-repoandtool_code_feature.
- Implemented
-
Null-Safety in Client (
github_client.py):- Replaced
.get("labels", [])with(issue.get("labels") or [])guarded byisinstance(label, dict) and "name" in label. - Applied identical guards for
assigneesanduser. - Replaced non-ASCII status log emojis (
❌,⚠️) with[ERROR]and[WARN]to prevent encoding crashes on Windows/ASCII environments. - Added explicit
timeout=self.timeoutacross allrequestsnetwork calls.
- Replaced
-
Input Normalization & Route Aliasing (
main.py):- Added string-to-list parsing for
labelsintool_create_issue. - Added
@app.post("/tools/add_issue_comment")route alias for full compatibility.
- Added string-to-list parsing for
-
Thread-Safe Atomic File Persistence (
simple_storage.py):- Wrapped
save_users()inthreading.Lock()using temporary file creation and atomicos.replace.
- Wrapped
-
Test Suite & CI Manifest (
test_main.py,checks-manifest.yaml):- Added 73 pure standard-library hermetic unit tests covering all resolution paths, injection attacks, null fields, route aliases, and endpoint contracts.
- Updated
.github/checks-manifest.yamlcheck definition; verified passing all 52 manifest check tests.
Bounty & Contributor Reward Proposal
US$50 Bounty + 1-PR Contributor DevKit Reward (@josancamon19 @kodjima33):
- Bitcoin (BTC):
1NkUnv23H65ZYJn64pseAcWRA6sJitxh2f(Network: Bitcoin Mainnet) - Contact Email:
[email protected] - Contributor Reward: Omi DevKit Device (Necklace / Glasses) under official Omi Contribution Guidelines.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsIn review
Activity