-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Semgrep checks and shellcheck braces checks #835
Changes from 6 commits
de7b5ec
a17bf74
b3c4516
17d0894
fb9da90
275bea8
f771ba3
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
# Description: Openai questioning module for container #2 | ||
# Note: Important requirement for Q-modules is the self termination when a certain phase ends | ||
|
||
Q02_openai_question() { | ||
Q02_openai_question() { | ||
if [[ "${GPT_OPTION}" -gt 0 ]] && [[ -n "${OPENAI_API_KEY}" ]]; then | ||
module_log_init "${FUNCNAME[0]}" | ||
# Prints title to CLI and into log | ||
|
@@ -51,7 +51,7 @@ ask_chatgpt() { | |
local GPT_FILE_DIR_="${LOG_PATH_MODULE}""/gpt_files" | ||
local GPT_PRIO_=3 | ||
# default vars | ||
local GPT_QUESTION_="" | ||
local GPT_QUESTION_="" | ||
local CHATGPT_CODE_="" | ||
local GPT_RESPONSE_="" | ||
local GPT_RESPONSE_CLEANED_="" | ||
|
@@ -89,7 +89,7 @@ ask_chatgpt() { | |
GPT_TOKENS_="${GPT_TOKENS_//cost\=/}" | ||
GPT_RESPONSE_="$(echo "${ELEM}" | cut -d\; -f7)" | ||
GPT_INPUT_FILE_="$(basename "${SCRIPT_PATH_TMP_}")" | ||
|
||
# in case we have nothing we are going to move on | ||
[[ -z "${SCRIPT_PATH_TMP_}" ]] && continue | ||
print_output "[*] Identification of ${ORANGE}${SCRIPT_PATH_TMP_} / ${GPT_INPUT_FILE_}${NC} inside ${ORANGE}${LOG_DIR}/firmware${NC}" "no_log" | ||
|
@@ -160,7 +160,8 @@ ask_chatgpt() { | |
local CNT=0 | ||
while [[ "${CNT}" -lt 1000 ]]; do | ||
CNT=$((CNT+1)) | ||
(( "${CNT}" % 100 == 0 )) && print_output "[*] Rate limit handling ... sleep mode - ${CNT}" "no_log" | ||
temp="$(( "${CNT}" % 100 ))" | ||
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. why this way? 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. need to declare temp as local and capital pls.
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.
This way semgrep does not skip the analysis |
||
(( "${temp}" == 0 )) && print_output "[*] Rate limit handling ... sleep mode - ${CNT}" "no_log" | ||
if grep -q "Testing phase ended" "${LOG_DIR}"/"${MAIN_LOG_FILE}"; then | ||
break 2 | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,8 @@ S110_yara_check() | |
ulimit -Sv unlimited | ||
|
||
while read -r YARA_OUT_LINE; do | ||
if [[ "$YARA_OUT_LINE" == *" [] [author="* ]]; then | ||
author_string=" [] [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. capital and local |
||
if [[ "${YARA_OUT_LINE}" == *"${author_string}"* ]]; then | ||
YRULE=$(echo "$YARA_OUT_LINE" | awk '{print $1}') | ||
MATCH_FILE=$(echo "$YARA_OUT_LINE" | grep "\ \[\]\ \[author=\"" | rev | awk '{print $1}' | rev) | ||
MATCH_FILE_NAME=$(basename "$MATCH_FILE") | ||
|
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.
in this BINARY variable could be something like:
binary parameter parameter ...
In this special case we can't add the "" to it.
Please, could you add a comment to ensure we do not forget about this situation?
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.
Ok, but I am renaming the variable to _BINARY, so semgrep won't flag it as an unquoted variable.