Signature did not match digest & InvalidToken

Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

Technical details:

  • Redash Version: 9.0.0-alpha
  • Browser/OS: Edge
  • How did you install Redash:
    ===========
    Im setup Redash by helmchart base on helm contrib-helm-chart
    And get issue below:
    [2020-09-03 08:00:04,549][PID:30][ERROR][redash.app] Exception on /api/data_sources [GET]
    Traceback (most recent call last):
    File “/usr/local/lib/python3.7/site-packages/cryptography/fernet.py”, line 104, in _verify_signature
    h.verify(data[-32:])
    File “/usr/local/lib/python3.7/site-packages/cryptography/hazmat/primitives/hmac.py”, line 66, in verify
    ctx.verify(signature)
    File “/usr/local/lib/python3.7/site-packages/cryptography/hazmat/backends/openssl/hmac.py”, line 74, in verify
    raise InvalidSignature(“Signature did not match digest.”)
    cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1949, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/local/lib/python3.7/site-packages/flask_restful/init.py”, line 458, in wrapper
resp = resource(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask_login/utils.py”, line 261, in decorated_view
return func(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask/views.py”, line 89, in view
return self.dispatch_request(*args, **kwargs)
File “/app/redash/handlers/base.py”, line 33, in dispatch_request
return super(BaseResource, self).dispatch_request(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask_restful/init.py”, line 573, in dispatch_request
resp = meth(*args, **kwargs)
File “/app/redash/permissions.py”, line 71, in decorated
return fn(*args, **kwargs)
File “/app/redash/handlers/data_sources.py”, line 116, in get
for ds in data_sources:
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py”, line 105, in instances
util.raise_from_cause(err)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py”, line 398, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py”, line 153, in reraise
raise value
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py”, line 85, in instances
rows = [proc(row) for row in fetch]
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py”, line 85, in
rows = [proc(row) for row in fetch]
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py”, line 572, in _instance
populators,
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py”, line 693, in populate_full
dict
[key] = getter(row)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py”, line 1266, in process
return process_value(impl_processor(value), dialect)
File “/app/redash/models/types.py”, line 31, in process_result_value
super(EncryptedConfiguration, self).process_result_value(value, dialect)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py”, line 409, in process_result_value
decrypted_value = self.engine.decrypt(value)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py”, line 216, in decrypt
decrypted = self.fernet.decrypt(value)
File “/usr/local/lib/python3.7/site-packages/cryptography/fernet.py”, line 75, in decrypt
return self._decrypt_data(data, timestamp, ttl)
File “/usr/local/lib/python3.7/site-packages/cryptography/fernet.py”, line 117, in _decrypt_data
self._verify_signature(data)
File “/usr/local/lib/python3.7/site-packages/cryptography/fernet.py”, line 106, in _verify_signature
raise InvalidToken
cryptography.fernet.InvalidToken

=>> I have checked REDASH_COOKIE_SECRET and REDASH_SECRET_KEY. Both of them exist in env os.

I have resolved above issue. maybe problem when generate REDASH_COOKIE_SECRET !