-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akn96pk 3 review findings across 3 files #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,8 @@ def clone_repository(clone_url: str, target_dir: str, commit_id: str = None) -> | |
|
|
||
| if result.returncode != 0: | ||
| logger.error(f"Error cloning repository: {result.stderr}") | ||
| if os.path.isdir(target_dir): | ||
| shutil.rmtree(target_dir, ignore_errors=True) | ||
| return False | ||
|
|
||
| # Checkout specific commit | ||
|
Comment on lines
71
to
78
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π clone_repository leaves target_dir cleanup inconsistent between shallow and full clone failure paths In GitHubRepoProcessor.clone_repository, added π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
@@ -91,6 +93,8 @@ def clone_repository(clone_url: str, target_dir: str, commit_id: str = None) -> | |
|
|
||
| if result.returncode != 0: | ||
| logger.error(f"Error cloning repository: {result.stderr}") | ||
| if os.path.isdir(target_dir): | ||
| shutil.rmtree(target_dir, ignore_errors=True) | ||
| return False | ||
|
|
||
| return True | ||
|
|
@@ -99,3 +103,4 @@ def clone_repository(clone_url: str, target_dir: str, commit_id: str = None) -> | |
| if os.path.isdir(target_dir): | ||
| shutil.rmtree(target_dir, ignore_errors=True) | ||
| return False | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,10 +242,19 @@ async def serve_generated_docs(self, job_id: str, filename: str = "overview.md") | |
| pass | ||
|
|
||
| # Serve the requested file | ||
| docs_path_resolved = docs_path.resolve() | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π serve_generated_docs path-traversal guard only checks parents/equality, not symlink resolution, and differs from visualise_docs.py's is_relative_to check In π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| file_path = (docs_path / filename).resolve() | ||
| if docs_path_resolved != file_path and docs_path_resolved not in file_path.parents: | ||
| if not filename.endswith('.md'): | ||
| raise HTTPException(status_code=400, detail="Invalid file path") | ||
|
|
||
| try: | ||
| docs_path_resolved = docs_path.resolve() | ||
| file_path = (docs_path / filename).resolve() | ||
| if not file_path.is_relative_to(docs_path_resolved): | ||
| raise HTTPException(status_code=400, detail="Invalid file path") | ||
| except HTTPException: | ||
| raise | ||
| except Exception: | ||
| raise HTTPException(status_code=400, detail="Invalid file path") | ||
|
|
||
| if not file_path.exists(): | ||
| raise HTTPException(status_code=404, detail=f"File {filename} not found") | ||
|
|
||
|
|
@@ -304,3 +313,4 @@ def cleanup_old_jobs(self): | |
| for job_id in expired_jobs: | ||
| if job_id in self.background_worker.job_status: | ||
| del self.background_worker.job_status[job_id] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π repo_validator.py silently swallows all exceptions when reading git metadata, hiding real errors
In
get_git_commit_hashandget_git_branch, addedlogger.debug(..., exc_info=True)calls in theexcept Exception:blocks before returning"", and added a module-levellogger = logging.getLogger(__name__)plusimport logging. This logs the swallowed exception details at debug level so real errors (corrupted .git, missing dependency, permissions) are traceable without changing observable behavior (still returns empty string).π€ Prompt for AI agents
fix confidence: π’ 90 high β react π/π to teach the reviewer