You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2024/10/02 20:29:38 UTC

(airflow) branch main updated: Make `private_key_content` a sensitive field in Snowflake connection (#42649)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a5eb22df1 Make `private_key_content` a sensitive field  in Snowflake connection (#42649)
8a5eb22df1 is described below

commit 8a5eb22df1ac94a3792f8eaf0760b4c0f8f316f2
Author: Kalyan <ka...@live.com>
AuthorDate: Thu Oct 3 01:59:31 2024 +0530

    Make `private_key_content` a sensitive field  in Snowflake connection (#42649)
    
    * use PasswordField
    
    * use PasswordField
---
 airflow/providers/snowflake/hooks/snowflake.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/airflow/providers/snowflake/hooks/snowflake.py b/airflow/providers/snowflake/hooks/snowflake.py
index a09217f9e5..4b4143fdd1 100644
--- a/airflow/providers/snowflake/hooks/snowflake.py
+++ b/airflow/providers/snowflake/hooks/snowflake.py
@@ -96,9 +96,12 @@ class SnowflakeHook(DbApiHook):
     @classmethod
     def get_connection_form_widgets(cls) -> dict[str, Any]:
         """Return connection widgets to add to connection form."""
-        from flask_appbuilder.fieldwidgets import BS3TextAreaFieldWidget, BS3TextFieldWidget
+        from flask_appbuilder.fieldwidgets import (
+            BS3PasswordFieldWidget,
+            BS3TextFieldWidget,
+        )
         from flask_babel import lazy_gettext
-        from wtforms import BooleanField, StringField
+        from wtforms import BooleanField, PasswordField, StringField
 
         return {
             "account": StringField(lazy_gettext("Account"), widget=BS3TextFieldWidget()),
@@ -107,8 +110,8 @@ class SnowflakeHook(DbApiHook):
             "region": StringField(lazy_gettext("Region"), widget=BS3TextFieldWidget()),
             "role": StringField(lazy_gettext("Role"), widget=BS3TextFieldWidget()),
             "private_key_file": StringField(lazy_gettext("Private key (Path)"), widget=BS3TextFieldWidget()),
-            "private_key_content": StringField(
-                lazy_gettext("Private key (Text)"), widget=BS3TextAreaFieldWidget()
+            "private_key_content": PasswordField(
+                lazy_gettext("Private key (Text)"), widget=BS3PasswordFieldWidget()
             ),
             "insecure_mode": BooleanField(
                 label=lazy_gettext("Insecure mode"), description="Turns off OCSP certificate checks"