Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/seclab_taskflows/mcp_servers/gh_file_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ async def fetch_file_from_gh(
"""
Fetch the content of a file from a GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +129 to +130
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Suggested change
owner = owner.lower()
repo = repo.lower()

Copilot uses AI. Check for mistakes.

r = await call_api(
url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}",
params={}
Expand All @@ -146,6 +149,9 @@ async def get_file_lines_from_gh(
length: int = Field(description="The ending line number to fetch from the file", default=10)) -> str:
"""Fetch a range of lines from a file in a GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +152 to +153
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Copilot uses AI. Check for mistakes.

r = await call_api(
url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}",
params={}
Expand All @@ -171,6 +177,9 @@ async def search_file_from_gh(
"""
Search for a term in a file from a GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +180 to +181
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Copilot uses AI. Check for mistakes.

r = await call_api(
url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}",
params={}
Expand All @@ -193,6 +202,9 @@ async def search_files_from_gh(
"""
Search for a term in a list of files from a GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +205 to +206
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Copilot uses AI. Check for mistakes.

paths_list = [path.strip() for path in paths.split(',')]
if not paths_list:
return "No paths provided for search."
Expand Down Expand Up @@ -238,6 +250,9 @@ async def list_directory_from_gh(
"""
Fetch the content of a directory from a GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +253 to +254
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Copilot uses AI. Check for mistakes.

r = await call_api(
url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}",
params={}
Expand All @@ -259,6 +274,9 @@ async def search_repo_from_gh(
"""
Search for the search term in the entire repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +277 to +278
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.

Copilot uses AI. Check for mistakes.

with tempfile.TemporaryDirectory() as tmp_dir:
result = await _fetch_source_zip(owner, repo, tmp_dir)
source_path = Path(f"{tmp_dir}/{owner}/{repo}.zip")
Expand Down
15 changes: 15 additions & 0 deletions src/seclab_taskflows/mcp_servers/local_file_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ async def fetch_file_content(
"""
Fetch the content of a file from a local GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +114 to +115
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Suggested change
owner = owner.lower()
repo = repo.lower()

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path or not source_path.exists():
Expand All @@ -133,6 +136,9 @@ async def get_file_lines(
length: int = Field(description="The ending line number to fetch from the file", default=10)) -> str:
"""Fetch a range of lines from a file in a local GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +139 to +140
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path or not source_path.exists():
Expand All @@ -155,6 +161,9 @@ async def list_files(
"""
Recursively list the files of a directory from a local GitHub repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +164 to +165
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path or not source_path.exists():
Expand All @@ -173,6 +182,9 @@ async def list_files_non_recursive(
List the files of a directory from a local GitHub repository non-recursively.
Subdirectories will be listed and indicated with a trailing slash.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +185 to +186
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path or not source_path.exists():
Expand All @@ -191,6 +203,9 @@ async def search_repo(
"""
Search for the search term in the repository or a subdirectory/file in the repository.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +206 to +207
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path or not source_path.exists():
Expand Down
6 changes: 6 additions & 0 deletions src/seclab_taskflows/mcp_servers/local_gh_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ async def fetch_repo_from_gh(
"""
Download the source code from GitHub to the local file system to speed up file search.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +98 to +99
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

result = await _fetch_source_zip(owner, repo, LOCAL_GH_DIR)
source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
if not source_path.exists():
Expand All @@ -106,6 +109,9 @@ async def clear_local_repo(owner: str, repo: str):
"""
Delete the local repo.
"""
owner = owner.lower()
repo = repo.lower()
Comment on lines +112 to +113
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.

Copilot uses AI. Check for mistakes.

source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip")
source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR])
if not source_path:
Expand Down