You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Max (Jira)" <ji...@apache.org> on 2020/02/03 16:55:00 UTC

[jira] [Comment Edited] (AIRFLOW-6273) databricks_hook.py changed how host is pulled

    [ https://issues.apache.org/jira/browse/AIRFLOW-6273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17029087#comment-17029087 ] 

Max edited comment on AIRFLOW-6273 at 2/3/20 4:54 PM:
------------------------------------------------------

[~ash] why *should* the host be set in extras? This was changed in [this commit|https://github.com/apache/airflow/pull/5635] and it feels more like a workaround for an underlying issue. I agree that setting the host in extras is unintuitive and doesn't fit the general Schema for connections.

Also, by setting the {{token}} in extras we're now displaying a password in clear text; anyone with access to connections can now retrieve this value.

The logic [here|https://github.com/apache/airflow/blob/d02ee3a2010175e40d4d562fb1c0723181fc8ba0/airflow/providers/databricks/hooks/databricks.py#L152], should be something like this instead:

{code:python}
if self.databricks_conn.password[0:4] == "dapi":
    auth = _TokenAuth(self.databricks_conn.password)
else:
    auth = (self.databricks_conn.login, self.databricks_conn.password)
{code}

or set a boolean in {{extras}} like {{useTokenAuth: true}}:
{code:python}
if self._parse_host(self.databricks_conn.extra_dejson['useTokenAuth']:
    auth = _TokenAuth(self.databricks_conn.password)
else:
    auth = (self.databricks_conn.login, self.databricks_conn.password)
{code}




was (Author: fl-max):
[~ash] why *should* the host be set in extras? This was changed in [this commit|https://github.com/apache/airflow/pull/5635] and it feels more like a workaround for an underlying issue. I agree that setting the host in extras is unintuitive and doesn't fit the general Schema for connections.

Also, by setting the {{token}} in extras we're now displaying a password in clear text; anyone with access to connections can now retrieve this value.

The logic [here|https://github.com/apache/airflow/blob/d02ee3a2010175e40d4d562fb1c0723181fc8ba0/airflow/providers/databricks/hooks/databricks.py#L152], should be something like this instead:

{code:python}
if self.databricks_conn.password[0:4] == "dapi":
    auth = _TokenAuth(self.databricks_conn.password)
else:
    auth = (self.databricks_conn.login, self.databricks_conn.password)
{code}


> databricks_hook.py changed how host is pulled
> ---------------------------------------------
>
>                 Key: AIRFLOW-6273
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6273
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: hooks
>    Affects Versions: 1.10.6
>            Reporter: Ameer Elkordy
>            Priority: Major
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> AIRFLOW-4923 made a change to how host is pulled based on whether tokens are used or not.  The change results in the host no longer being pulled from the UI host field.  Current work around is to add host to the host field AND to add host to the extra_dejson, which is not intuitive.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)