You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "mtsadler-branch (via GitHub)" <gi...@apache.org> on 2024/07/10 21:12:31 UTC
[I] Visible Secrets in XCOM Outputs [airflow]
mtsadler-branch opened a new issue, #40704:
URL: https://github.com/apache/airflow/issues/40704
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
v2.8.4
### What happened?
My task was decorated with `@task(multiple_outputs=True)` and had `return {"password": "abc"}`.
`password`'s value is exposed in clear-text in the XCOM tab of Airflow UI.
### What you think should happen instead?
XCOM Keys matching `core.sensitive_var_conn_names` should mask their associated Values in `XCOM Tab` of Airflow Task
### How to reproduce
```
from datetime import datetime
from airflow.decorators import dag, task
from airflow.operators.empty import EmptyOperator
@dag(
dag_id="test_xcom_output",
description="Test XCOM Output from Airflow Task",
schedule_interval=None,
start_date=datetime(2023, 4, 19),
tags=["type_adhoc"],
catchup=False,
)
def test_xcom_output():
start_task = EmptyOperator(
task_id="start_task",
)
end_task = EmptyOperator(
task_id="end_task",
)
@task(multiple_outputs=True)
def verify_dag_run_params(
conn_id: str,
):
"""
Parse password from Airflow Connection.
Args:
conn_id: The SFTP Connection ID to use.
Returns:
A dictionary containing SFTP connection details.
"""
from airflow.exceptions import AirflowException
from airflow.models import Connection
sftp_conn = Connection.get_connection_from_secrets(conn_id=conn_id)
password = sftp_conn.password
return {
"conn_id": conn_id,
"password": password,
}
verify_dag_run_params_task = verify_dag_run_params(
conn_id="sftp_conn",
)
start_task >> verify_dag_run_params_task >> end_task
dag = test_xcom_output()
```
### Operating System
Mac OS Sonoma
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
`docker compose` built `FROM apache/airflow@sha256:64e58748b6b970400d097d9e8a47dd4a3470cfe3c210edde466a15cfd22a70c0`
### Anything else?
Appears that all XCOM values are cleartext
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Visible Secrets in XCOM Outputs [airflow]
Posted by "kunaljubce (via GitHub)" <gi...@apache.org>.
kunaljubce commented on issue #40704:
URL: https://github.com/apache/airflow/issues/40704#issuecomment-2241538082
@shahar1 Do we want to add `mask_secret` functionality to XCOM? I can look into this if that's the case.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Visible Secrets in XCOM Outputs [airflow]
Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on issue #40704:
URL: https://github.com/apache/airflow/issues/40704#issuecomment-2241748862
> I don't think it's a bug, as secrets in XCOM are not protected based on Airflow [doc](https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/index.html). But I think it's debatable whether XCOM should be protected, or maybe at least making `mask_secret` working in XCOM tab as well.
It seems that you're right - I changed the label into a feature.
> @shahar1 Do we want to add `mask_secret` functionality to XCOM? I can look into this if that's the case.
I think that it could be useful - feel free to explore this area and come up with a PR.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Visible Secrets in XCOM Outputs [airflow]
Posted by "gyli (via GitHub)" <gi...@apache.org>.
gyli commented on issue #40704:
URL: https://github.com/apache/airflow/issues/40704#issuecomment-2226997292
I don't think it's a bug, as secrets in XCOM are not protected based on Airflow [doc](https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/index.html). But I think it's debatable whether XCOM should be protected, or maybe at least making `mask_secret` working in XCOM tab as well.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Visible Secrets in XCOM Outputs [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #40704:
URL: https://github.com/apache/airflow/issues/40704#issuecomment-2241776385
Generally XCOMs are not encrypted by FERNET key. Which means that if you are passing secrets through Xcoms, anyone who has access to DB or DB logs can know the secret. I'd say NOT masking secret is a feature. It tells you you should not pass secrets via Xoms - they are not designed to be used for that. Masking secrets in XCom might give you false sense of security that it is protected in some ways, where it - in fact - is not.
Converting it to a discussion.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Visible Secrets in XCOM Outputs [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #40704: Visible Secrets in XCOM Outputs
URL: https://github.com/apache/airflow/issues/40704
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org