[BUG] App Creation stores path to file vs file contents.
gavinelder opened this issue · 2 comments
Background
Currently in streamalert_cli/helpers.py
there is a function called user_input
historically user_input
used python2 raw_input
and as part of calling response_is_valid
called a validation function which returned a string.
This string would then replace the contents of raw_input()
overriding the user inputed string.
In the later releases of StreamAlert and migration to python3 it appears that input()
is no longer having the value manipulated in the same way.
Description
Steps to Reproduce
On a StreamAlert 3.0+ release create a new application such as gsuite
or box
which utilise this value returned by the validation function, once the application is created go to parameter store and look at the contents you should see the String to the path on disk vs the file contents.
Desired Change
Contents of the file on disk to be stored in parameter store.
As @gavinelder pointed out in py3 it uses input()
while py2 uses raw_input()
, but they should behave the same to read the user input as a string which is the keyfile path
in our case. Later, we should read the content of the keyfile
using _required_auth_info
classmethod
streamalert/streamalert/apps/_apps/gsuite.py
Lines 200 to 227 in a0a284c
Definitely there is something wrong when calls _required_auth_info
or it may not be called. Will investigate more.
To add more context about @gavinelder 's issue, the value of gsuite_token_gtoken_app_auth
should be a json blob containing the context of private key. However, instead of storing the context of private key, it stores the path to the private key file which is wrong.
Opened a PR to address this, was forced to spend more time than a quick glance as part of building a new app.