geido commented on code in PR #45068:
URL: https://github.com/apache/superset/pull/45068#discussion_r4444372408
##########
superset/databases/schemas.py:
##########
@@ -1146,25 +1237,39 @@ def validate_masked_encrypted_extra(
"File contains both `encrypted_extra` and
`masked_encrypted_extra`"
)
- if db.session.query(Database).filter_by(uuid=data["uuid"]).first():
- # Existing DB: sensitive values will be revealed from existing
- # encrypted_extra in import_database()
- return
-
masked_encrypted_extra = json.loads(data["masked_encrypted_extra"])
- # Determine engine spec from sqlalchemy_uri to get sensitive fields
- sqlalchemy_uri = data["sqlalchemy_uri"]
- url = make_url_safe(sqlalchemy_uri)
- backend = url.get_backend_name()
- driver = url.get_driver_name()
- db_engine_spec = get_engine_spec(backend, driver=driver)
-
- # Check if any sensitive field is still masked
- masked_fields = get_masked_fields(
- masked_encrypted_extra,
- db_engine_spec.encrypted_extra_sensitive_field_paths(),
- )
+ if existing :=
db.session.query(Database).filter_by(uuid=data["uuid"]).first():
+ if not self.overwrites_existing:
+ return
Review Comment:
I think this needs the `can_write` check `import_database()` uses, since
without it the connection is left alone. As Alpha, an "overwrite all" dashboard
re-import now asks for the OAuth2 client secret and drops it, and
`/api/v1/assets/import/` 500s when the bundle's URI or `engine_params` differ.
Could we skip this for users who can't write databases? Both worked for Alpha
at bdf7917.
Alpha user, flags off, previous head then this one:
https://github.com/user-attachments/assets/1cc6daa6-b4a7-4505-a536-f5ebc6064e29
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]