You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Trevor Edwards (JIRA)" <ji...@apache.org> on 2017/10/05 20:51:00 UTC

[jira] [Created] (AIRFLOW-1687) Models.py Connection failing from base64 TypeError when encryption is not used.

Trevor Edwards created AIRFLOW-1687:
---------------------------------------

             Summary: Models.py Connection failing from base64 TypeError when encryption is not used.
                 Key: AIRFLOW-1687
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1687
             Project: Apache Airflow
          Issue Type: Bug
            Reporter: Trevor Edwards


This issue appears to be related to AIRFLOW-1516 and was noticed when testing 1.9.0alpha0 from 1.8.2.

If the user has configured the fernet key to be "cryptography_not_found_storing_passwords_in_plain_text", airflow/models.py's Connection class fails when attempting to call set_extra. The error raised is:

{code:python}
File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 574, in __init__
self.extra = extra
File "<string>", line 1, in __set__
File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 635, in set_extra
fernet = get_fernet()
File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 102, in get_fernet
return Fernet(configuration.get('core', 'FERNET_KEY').encode('utf-8'))
File "/usr/local/lib/python2.7/site-packages/cryptography/fernet.py", line 34, in __init__
key = base64.urlsafe_b64decode(key)
File "/usr/local/lib/python2.7/base64.py", line 119, in urlsafe_b64decode
return b64decode(s.translate(_urlsafe_decode_translation))
File "/usr/local/lib/python2.7/base64.py", line 78, in b64decode
raise TypeError(msg)
TypeError: Incorrect padding
{code}

It appears that 1.8 would catch any error as a flag to disable encryption:
https://github.com/apache/incubator-airflow/blob/v1-8-stable/airflow/models.py#L94

Whereas 1.9 only catches ValueError, allowing a TypeError to pass through:
https://github.com/apache/incubator-airflow/blob/v1-9-test/airflow/models.py#L103

A possible solution is to also catch TypeError here, or revert to catching any error.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)