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

Error 500 when switching from EncryptedCookieStorage to NaClCookieStorage #316

Closed
tardyp opened this issue Sep 10, 2018 · 2 comments
Closed

Comments

@tardyp
Copy link
Contributor

tardyp commented Sep 10, 2018

  File "[..]/site-packages/aiohttp/web_protocol.py", line 390, in start
    resp = await self._request_handler(request)
  File "[..]/site-packages/aiohttp/web_app.py", line 366, in _handle
    resp = await handler(request)
  File "[..]/site-packages/aiohttp/web_middlewares.py", line 106, in impl
    return await handler(request)
  File "[..]/site-packages/aiohttp_session/__init__.py", line 149, in factory
    response = await handler(request)
  File "/Users/az02096/dev/nestor/elasticsearch_authorizations/elasticsearch_authorizations/app.py", line 122, in index_handler
    session = await get_session(request)
  File "[..]/site-packages/aiohttp_session/__init__.py", line 113, in get_session
    session = await storage.load_session(request)
  File "[..]/site-packages/aiohttp_session/nacl_storage.py", line 32, in load_session
    encoder=Base64Encoder).decode('utf-8')
  File "[..]/site-packages/nacl/secret.py", line 112, in decrypt
    ciphertext = encoder.decode(ciphertext)
  File "[..]/site-packages/nacl/encoding.py", line 73, in decode
    return base64.b64decode(data)
  File "[..]/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
INFO:aiohttp.access:::1 [10/Sep/2018:14:27:23 +0000] "GET / HTTP/1.1" 500 330 "http://localhost:8000/" 

Same issue when changing the secret.

probably we need to port this patch to NaClCookieStorage:
0741f5a

Not sure what is the benefit of NaClCookieStorage over EncryptedCookieStorage.

@asvetlov
Copy link
Member

To process non-decodable data as a new session?

Makes sense to me.
Would you make a pull request?
BTW raising a warning if the data cannot be processed would be fine

@tardyp
Copy link
Contributor Author

tardyp commented Sep 10, 2018

@asvetlov PR sent. I sniped in a doc fix as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants