-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a simple param inspector to prevent malicious code
- Loading branch information
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Dict | ||
|
||
from localtypes import ResponseEnum | ||
|
||
|
||
def inspector(params: Dict[str, str]): | ||
error_string = "{symbol} is not allowed in commands" | ||
for value in params.values(): | ||
if "&&" in value: | ||
return ResponseEnum.BadRequest, error_string.format(symbol="&&") | ||
elif "||" in value: | ||
return ResponseEnum.BadRequest, error_string.format(symbol="||") | ||
elif ">" in value: | ||
return ResponseEnum.BadRequest, error_string.format(symbol=">") | ||
return ResponseEnum.OK, "" |
Empty file.