question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashing on missing <input> value

See original GitHub issue

I saw this while trying to auth today:

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/build/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/build/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/build/aws_google_auth/google.py", line 325, in do_login
    sess = self.handle_prompt(sess)
  File "/build/aws_google_auth/google.py", line 621, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'

The code in question:

https://github.com/cevoaustralia/aws-google-auth/blob/3f3b73bea5b3c0a8161942b2ffc8423dbda93a4a/aws_google_auth/google.py#L619-L628

Running with --save-flow, I looked in aws-google-auth-2021-01-29T001110/ac.go.com~o~saml2~initsso_2.html and found that I was missing an for checkedDomains and pstMsg:

  <input type="hidden" name="" value="">
  <input type="hidden" name="gxf" value="...">
  <input type="hidden" name="continue" value="...">
  <input type="hidden" name="followup" value="...">
  <input type="hidden" name="ltmpl" value="popup">
  <input type="hidden" name="scc" value="1">
  <input type="hidden" name="sarp" value="1">
  <input type="hidden" name="oauth" value="1">
  <input type="hidden" name="faa" value="1">
  <input id="profile-information" name="ProfileInformation" type="hidden" value="">
  <input id="session-state" name="SessionState" type="hidden" value="...">
  <input name="flowName" type="hidden" value="...">
  <input type="hidden" id="_utf8" name="_utf8" value="&#9731;"/>
  <input type="hidden" name="bgresponse" id="bgresponse" value="js_disabled">

I got past this locally by skipping over those fields:

diff --git a/aws_google_auth/google.py b/aws_google_auth/google.py
index 398eff5..6b35966 100644
--- a/aws_google_auth/google.py
+++ b/aws_google_auth/google.py
@@ -561,6 +561,7 @@ class Google:
         return self.post(challenge_url, data=payload)
 
     def handle_prompt(self, sess):
         response_page = BeautifulSoup(sess.text, 'html.parser')
         challenge_url = sess.url.split("?")[0]
 
@@ -616,16 +617,8 @@ class Google:
             response_page.find('input', {
                 'name': 'sarp'
             }).get('value'),
-            'checkedDomains':
-            response_page.find('input', {
-                'name': 'checkedDomains'
-            }).get('value'),
             'checkConnection':
             'youtube:1295:1',
-            'pstMsg':
-            response_page.find('input', {
-                'name': 'pstMsg'
-            }).get('value'),
             'TL':
             response_page.find('input', {
                 'name': 'TL'
@@ -642,6 +635,14 @@ class Google:
             }).get('value'),
             'TrustDevice':
             'on',
         }
 
         return self.post(challenge_url, data=payload)

Which got me credentials, and they work, but I don’t know what I’m doing when I skip adding those fields to the request, nor can I speak to why they’re not in the payload Google handed back to me today.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vkatsikaroscommented, Feb 3, 2021

I have also run into the same problem with the most recent 0.0.37 version.

$ aws-google-auth --version
aws-google-auth 0.0.37

$ aws-google-auth   -p google   -u user@example.com   -I IIIIIIIIIIIIIIIIII   -S SSSSSSSSSS   -R eu-west-1   -d 36000   --save-failure-html -l debug
INFO:root:aws_google_auth: SAML cache not found
Google Password: 
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): accounts.google.com:443
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "GET /o/saml2/initsso?idpid=IIIIIIIIIIIIIIIIII&spid=SSSSSSSSSS&forceauthn=false HTTP/1.1" 302 0
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "GET /ServiceLogin?passive=1209600&continue=https://accounts.google.com/o/saml2/initsso?idpid%3DIIIIIIIIIIIIIIIIII%26spid%3DSSSSSSSSSS%26forceauthn%3Dfalse%26from_login%3D1%26as%3DAAAAAAAAAAAAAAAAAAAA&followup=https://accounts.google.com/o/saml2/initsso?idpid%3DIIIIIIIIIIIIIIIIII%26spid%3DSSSSSSSSSS%26forceauthn%3Dfalse%26from_login%3D1%26as%3DAAAAAAAAAAAAAAAAAAAA&ltmpl=popup&oauth=1&faa=1&sarp=1&scc=1 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "POST /signin/v1/lookup HTTP/1.1" 302 565
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "GET /signin/challenge/pwd/1?continue=https%3A%2F%2Faccounts.google.com%2Fo%2Fsaml2%2Finitsso%3Fidpid%3DIIIIIIIIIIIIIIIIII%26spid%3DSSSSSSSSSS%26forceauthn%3Dfalse%26from_login%3D1%26as%3DAAAAAAAAAAAAAAAAAAAA&sarp=1&scc=1&flowName=GlifWebSignIn&faa=1&oauth=1&ltmpl=popup&TL=TTTTTTTTTTTTTTTTTTTTTTTTTTTT HTTP/1.1" 200 None
INFO:root:Handling new-style login page
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "POST /signin/challenge/pwd/1 HTTP/1.1" 302 564
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "GET /signin/challenge/az/2?continue=https%3A%2F%2Faccounts.google.com%2Fo%2Fsaml2%2Finitsso%3Fidpid%3DIIIIIIIIIIIIIIIIII%26spid%3DSSSSSSSSSS%26forceauthn%3Dfalse%26from_login%3D1%26as%3DAAAAAAAAAAAAAAAAAAAA&sarp=1&scc=1&flowName=GlifWebSignIn&faa=1&oauth=1&ltmpl=popup&TL=TTTTTTTTTTTTTTTTTTTTTTTTTTTT HTTP/1.1" 200 None
numerical code for prompt: 28
Open the Google App, and tap 'Yes' on the prompt to sign in ...
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): content.googleapis.com:443
DEBUG:urllib3.connectionpool:https://content.googleapis.com:443 "POST /cryptauth/v1/authzen/awaittx?alt=json&key=kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk HTTP/1.1" 200 None
ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/home/ubuntu/.venv/aws-google-auth/lib/python3.8/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/home/ubuntu/.venv/aws-google-auth/lib/python3.8/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/home/ubuntu/.venv/aws-google-auth/lib/python3.8/site-packages/aws_google_auth/google.py", line 325, in do_login
    sess = self.handle_prompt(sess)
  File "/home/ubuntu/.venv/aws-google-auth/lib/python3.8/site-packages/aws_google_auth/google.py", line 620, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'
0reactions
fernandolsantoscommented, Feb 11, 2021

Confirming @LucasSymons’s post, I was having the same problem. Downgraded to version 0.0.36 and it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Program crashes when no value is entered - Stack Overflow
I have created a program and have come across a problem. when I debug the program and don't enter a value e.g. a...
Read more >
Missing tablet input app causing (easyanticheat protected)
Missing tablet input app causing (easyanticheat protected) games to crash. I have unistalled the tablet input app when debloating my os.
Read more >
Crash on clear time input value · Issue #1670 - GitHub
Open DatePicker popup Click on the clear button in the time input (or enter invalid value use 'delete' or 'backspace' buttons)
Read more >
How to Prevent Android App From Crashing Due to Invalid Input
0:00 Talking about the video topic1:09 Creating the if-statement to prevent invalid input from being parsed2:33 Using the if-statement with ...
Read more >
Detect and diagnose crashes - Android Developers
There are many situations that can cause a crash in your app. Some reasons are obvious, like checking for a null value or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found