Skip to content

Commit

Permalink
Fix CodeQL Security Issue for Neural Coder (#1857)
Browse files Browse the repository at this point in the history
Signed-off-by: zehao-intel <[email protected]>
  • Loading branch information
zehao-intel authored Jun 10, 2024
1 parent 2634501 commit 47d73b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 47d73b3

Please sign in to comment.