Skip to content
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

[ BUG ] Passing bad credentials to a Service Class when using Credential or Object authentication produces a KeyError #134

Closed
jshcodes opened this issue Apr 19, 2021 · 0 comments · Fixed by #133
Assignees
Labels
API usage General API usage issues and questions bug 🐛 Something isn't working

Comments

@jshcodes
Copy link
Member

Describe the bug
If you try to use Credential or Object authentication with a Service Class and provide invalid credentials when doing so, a KeyError is generated for the key 'access_token'.

To Reproduce

from falconpy import cloud_connect_aws as FalconAWS
falcon = FalconAWS.Cloud_Connect_AWS(creds={"client_id":"BadID","client_secret":"BadSecret"})
result = QueryAWSAccounts()

Results in

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/falconpy/_service_class.py", line 60, in __init__
    self.headers = {'Authorization': 'Bearer {}'.format(auth_object.token()['body']['access_token'])}
KeyError: 'access_token'

Expected behavior
The object should instantiate successfully, then generate a HTTP 401 error (access denied, invalid bearer token) when a call to the API is made.

Environment (please complete the following information):

  • OS: Discovered using MacOS 10.15, assume impacts all operating systems
  • Python: Discovered using Python 3.9, assume impacts all versions
  • FalconPy: Affects versions 0.4.0 - 0.4.5

Additional context
Discovered while working on the multi-CID classes.

@jshcodes jshcodes added the bug 🐛 Something isn't working label Apr 19, 2021
@jshcodes jshcodes self-assigned this Apr 19, 2021
jhseceng pushed a commit that referenced this issue Apr 19, 2021
…essment Service Classes, Uber class endpoint submodule and linting refactor, Default value decorator, Gitbooks updates, Fixes (#133)

* Added Zero Trust Assessment Service Class, Unit test adjustments

* Removed _endpoint.py

* Uber class endpoint private submodule

* Fixed workflow naming convention that bugged me

* Bump version 0.4.5 -> 0.4.6

* Added MSSP Service Class (Falcon Flight Control)

* Updated main README.md

* Updated package README.md

* Fist shaking at the whitespace

* Updated CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update wordlist.txt

* Update wordlist.txt

* Update wordlist.txt

* Update README.md

* Unique ID parameter naming convention fixes

* Removing old gitbooks content

* Update gitbooks content

* Update wordlist.txt

* Update wordlist.txt

* Typo fixes

* Update wordlist.txt

* Add Gitbook assets

* Fix formatting issue

* Update gitbook base README

* Fixed the checkmark

* Update README.md

* Uber class linting refactor, updated default handling, new helper functions

* Update CHANGELOG.md

* Fix whitespace

* Fix formatting

* Fix KeyError on invalid creds to Service Class (Credential / Object auth), Closes #134

* Update CHANGELOG.md

* Update wordlist.txt

* Update CHANGELOG.md

* Unit test coverage parameters moved to stand-alone configuration file
@jshcodes jshcodes added the API usage General API usage issues and questions label Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API usage General API usage issues and questions bug 🐛 Something isn't working
Projects
None yet
1 participant