[SECURITY] Git tools: whitelist allowed repo paths #135

Closed
opened 2026-03-31 01:40:15 +00:00 by Timmy · 1 comment
Owner

From Audit #131 — Severity: HIGH

uni-wizard/tools/git_tools.py passes user-controlled repo_path directly to subprocess.run(cwd=repo_path). No path validation.

Fix

import os

ALLOWED_REPO_ROOTS = [
    os.path.expanduser("~/timmy"),
    os.path.expanduser("~/shared"),
    "/tmp"
]

def _validate_repo_path(path: str) -> bool:
    abs_path = os.path.abspath(os.path.expanduser(path))
    return any(abs_path.startswith(root) for root in ALLOWED_REPO_ROOTS)

Add validation at the top of every git function. Also validate remote URLs in git_push() — only push to known Gitea remotes.

Acceptance Criteria

  • Repo paths validated against whitelist
  • Absolute path resolution (no symlink tricks)
  • git_push validates remote URL contains 143.198.27.163:3000
  • Clear error on rejected paths
## From Audit #131 — Severity: HIGH `uni-wizard/tools/git_tools.py` passes user-controlled `repo_path` directly to `subprocess.run(cwd=repo_path)`. No path validation. ## Fix ```python import os ALLOWED_REPO_ROOTS = [ os.path.expanduser("~/timmy"), os.path.expanduser("~/shared"), "/tmp" ] def _validate_repo_path(path: str) -> bool: abs_path = os.path.abspath(os.path.expanduser(path)) return any(abs_path.startswith(root) for root in ALLOWED_REPO_ROOTS) ``` Add validation at the top of every git function. Also validate remote URLs in `git_push()` — only push to known Gitea remotes. ## Acceptance Criteria - [ ] Repo paths validated against whitelist - [ ] Absolute path resolution (no symlink tricks) - [ ] git_push validates remote URL contains `143.198.27.163:3000` - [ ] Clear error on rejected paths
allegro was assigned by Timmy 2026-03-31 01:40:16 +00:00
Member

🏷️ Automated Triage Check

Timestamp: 2026-03-31T02:30:03.933725
Agent: Allegro Heartbeat

This issue has been identified as needing triage:

Checklist

  • Clear acceptance criteria defined
  • Priority label assigned (p0-critical / p1-important / p2-backlog)
  • Size estimate added (quick-fix / day / week / epic)
  • Owner assigned
  • Related issues linked

Context

  • No comments yet - needs engagement
  • No labels - needs categorization
  • Part of automated backlog maintenance

Automated triage from Allegro 15-minute heartbeat

## 🏷️ Automated Triage Check **Timestamp:** 2026-03-31T02:30:03.933725 **Agent:** Allegro Heartbeat This issue has been identified as needing triage: ### Checklist - [ ] Clear acceptance criteria defined - [ ] Priority label assigned (p0-critical / p1-important / p2-backlog) - [ ] Size estimate added (quick-fix / day / week / epic) - [ ] Owner assigned - [ ] Related issues linked ### Context - No comments yet - needs engagement - No labels - needs categorization - Part of automated backlog maintenance --- *Automated triage from Allegro 15-minute heartbeat*
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/timmy-home#135