Skip to content
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

Fix CodeQL Security Issue for Neural Coder #1857

Merged
merged 1 commit into from
Jun 10, 2024
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
2 changes: 1 addition & 1 deletion neural_coder/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def enable(

### Benchmark
if run_bench:
if "github.com" in code and ".py" in code:
if "github" in code and ".com" in code and ".py" in code:
code = globals.list_code_path[0]
entry_code = globals.list_code_path[0]

Expand Down
2 changes: 1 addition & 1 deletion neural_coder/utils/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def check_has(s):

def detect_code_device_compatibility(code_path):
# handle github py url
if "github.com" in code_path and ".py" in code_path:
if "github" in code_path and ".com" in code_path and ".py" in code_path:
import requests

code_path = code_path.replace("github.com", "raw.githubusercontent.com").replace("/blob", "")
Expand Down
4 changes: 2 additions & 2 deletions neural_coder/utils/handle_user_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def get_user_code_path(user_input: str) -> List:
global user_input_type
if type(user_input) == list:
user_input_type = "a list of files"
elif "github.com" in user_input and ".py" in user_input:
elif "github" in user_input and ".com" in user_input and ".py" in user_input:
user_input_type = "url_py"
elif ".py" in user_input:
user_input_type = "file"
elif "github.com" in user_input:
elif "github" in user_input and ".com" in user_input:
user_input_type = "url_repo"
else:
user_input_type = "folder"
Expand Down
Loading