-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akn96pk 3 review findings across 3 files #111
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 |
|---|---|---|
|
|
@@ -91,6 +91,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 | ||
|
Comment on lines
91
to
98
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 a partially-cloned directory on shallow-clone failure In π€ Prompt for AI agentsfix confidence: π’ 97 high β react π/π to teach the reviewer |
||
|
|
@@ -99,3 +101,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 |
|---|---|---|
|
|
@@ -22,24 +22,16 @@ def capture_llm_response(): | |
| """Monkey patch to capture LLM response.""" | ||
| global captured_response | ||
| from codewiki.src.be import cluster_modules as cm_module | ||
| from codewiki.src.be.llm_services import create_llm_client | ||
|
|
||
| original_create = create_llm_client | ||
| original_call_llm = cm_module.call_llm | ||
|
|
||
| def patched_create(*args, **kwargs): | ||
| client = original_create(*args, **kwargs) | ||
| original_call = client.call | ||
| def patched_call_llm(*call_args, **call_kwargs): | ||
| result = original_call_llm(*call_args, **call_kwargs) | ||
| global captured_response | ||
| captured_response = result | ||
| return result | ||
|
|
||
| def patched_call(*call_args, **call_kwargs): | ||
| result = original_call(*call_args, **call_kwargs) | ||
| global captured_response | ||
| captured_response = result | ||
| return result | ||
|
|
||
| client.call = patched_call | ||
| return client | ||
|
|
||
| cm_module.create_llm_client = patched_create | ||
| cm_module.call_llm = patched_call_llm | ||
|
|
||
| capture_llm_response() | ||
|
|
||
|
Comment on lines
22
to
37
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. 𦩠π΄ test_clustering_debug.py monkey-patches a non-existent function Rewrote π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
|
|
||
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.
𦩠π safe_open_text ignores O_NOFOLLOW fallback risk and permits TOCTOU between symlink check and open
In safe_open_text(), removed the conditional O_NOFOLLOW fallback: the function now raises PermissionError immediately if os.O_NOFOLLOW is unsupported on the platform, instead of silently opening without it. Additionally, after os.open() succeeds, the code now uses os.fstat() on the resulting file descriptor to verify (via stat.S_ISLNK) that the opened file is not a symlink, and re-runs assert_safe_path() against the target to re-check containment, narrowing (though not eliminating, since path-based re-check is still name-based) the TOCTOU window between the initial check and the open. A fully race-proof fix would require resolving containment purely from the fd (e.g. via /proc/self/fd or os.path realpath of the fd on platforms that support it), which is not attempted here since no such helper exists in this file or repo.
π€ Prompt for AI agents
fix confidence: π‘ 70 medium β react π/π to teach the reviewer