airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edgar Rodriguez (JIRA)" <>
Subject [jira] [Closed] (AIRFLOW-1516) Potential uncaught errors when getting fernet object in airflow/
Date Fri, 18 Aug 2017 18:47:00 GMT


Edgar Rodriguez closed AIRFLOW-1516.
    Resolution: Fixed

> Potential uncaught errors when getting fernet object in airflow/
> -------------------------------------------------------------------------
>                 Key: AIRFLOW-1516
>                 URL:
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Edgar Rodriguez
>            Assignee: Edgar Rodriguez
> There are unhandled cases for exceptions when importing fernet in ``. This seems
to be a remanent of a previous refactor, replacing logic that would depend on the definition
of a global variable for Fernet if it was imported correctly.
> Lazy-loading fernet into a function won't have the same behavior and would raise an ImportError
> Code like: 
> {code}
>     def set_val(self, value):
>         if value:
>             try:
>                 fernet = get_fernet()
>                 self._val = fernet.encrypt(bytes(value, 'utf-8')).decode()
>                 self.is_encrypted = True
>             except NameError:
>                 self._val = value
>                 self.is_encrypted = False
> {code}
> won't catch the right exception since it won't raise {{NameError}}, letting it bubble
leading to undetermined behavior.
> Remediation would be to either catch the right exceptions coming out of {{get_fernet()}}
function or generally catch all exceptions , given that it's the way other functions are already
handling it and the only error handling case here is to not use encryption anyways. 

This message was sent by Atlassian JIRA

View raw message