blabla1337 / skf-flask

Security Knowledge Framework (SKF) Python Flask / Angular project
https://www.securityknowledgeframework.org
Apache License 2.0
810 stars 308 forks source link

skf-api.sh error on line 12 #828

Closed cptfixit closed 1 year ago

cptfixit commented 1 year ago

Good day,

During startup via docker-compose the skf-api_container shows the following snippets of logging. It includes a clear indication of a mistake on line twelve (12) of the skf-api.sh script.

skf-api_container | + touch /home/user_api/.kube/config
skf-api_container | + base64 -d
skf-api_container | + echo
skf-api_container | + export KUBECONFIG=/home/user_api/.kube/config
skf-api_container | + KUBECONFIG=/home/user_api/.kube/config
skf-api_container | + '[' '' -gt 10 ']'
skf-api_container | /home/user_api/Docker/alpine-cloud/api/skf-api.sh: line 12: [: : integer expression expected
skf-api_container | + cd /home/user_api
skf-api_container | + export FLASK_APP=/home/user_api/skf/app.py
skf-api_container | + FLASK_APP=/home/user_api/skf/app.py
skf-api_container | + export PYTHONPATH=.
skf-api_container | + PYTHONPATH=.

To call out the exact line: skf-api_container | /home/user_api/Docker/alpine-cloud/api/skf-api.sh: line 12: [: : integer expression expected

github-actions[bot] commented 1 year ago

Thank you for creating an issue ticket for our SKF project, we highly appriciate the feedback so we can improve the project and make it more awesome for everyone! We will shortly come back to you after the evaluation of the issue.

cptfixit commented 1 year ago

This issue relates to the following piece of code:

if [ "$GOOGLE_CREDENTIALS" -gt 10 ]
then
 echo $GOOGLE_CREDENTIALS | base64 -d  > /home/user_api/.kube/gsa-key.json 
 export GOOGLE_APPLICATION_CREDENTIALS=/home/user_api/.kube/gsa-key.json 
fi

So, the error occurs when the Google credentials are not set at all. I suggest adding an additional test to first test for null/zero on the relevant variable.

cptfixit commented 1 year ago

This issue appears to be resolved in a later version of the container image. If you use version 4.1.0 of the image, this error no longer occurs.