rahul-madaan opened a new issue, #77625:
URL: https://github.com/apache/airflow/issues/77625
### Under which category would you file this issue?
Providers
### Apache Airflow version
main (3.5.0)
### What happened and how to reproduce it?
With `spark_inject_transport_info` (or
`openlineage_inject_transport_info=True` on an operator) and an HTTP transport
that uses `api_key` auth, every OpenLineage event from the Spark job is
rejected with `401` by a backend that checks the key.
`_get_transport_information_as_spark_properties` in
`providers/openlineage/src/airflow/providers/openlineage/utils/spark.py`
injects the result of `get_bearer()`:
```python
properties["auth.apiKey"] = tp.config.auth.get_bearer()
```
`get_bearer()` returns `"Bearer <key>"`, so Spark gets
`spark.openlineage.transport.auth.apiKey=Bearer <key>`. The OpenLineage Spark
integration's `ApiKeyTokenProvider` adds `Bearer ` itself, so the request
header becomes `Authorization: Bearer Bearer <key>`.
This affects every operator that injects transport info: SparkSubmit, Livy,
Dataproc, Databricks, EMR Serverless and Glue. It happens both when the key is
set in the transport config and when it comes from an Airflow connection
(`airflow_connection_api_key`).
To reproduce:
1. Run an HTTP endpoint that only accepts `Authorization: Bearer secret_123`.
2. Configure `[openlineage] transport = {"type": "http", "url":
"http://127.0.0.1:5055", "endpoint": "api/v1/lineage", "auth": {"type":
"api_key", "apiKey": "secret_123"}}`.
3. Run `airflow dags test` on a DAG with a `SparkSubmitOperator`
(`openlineage_inject_transport_info=True`, with the `openlineage-spark` jar and
`OpenLineageSparkListener`).
Result with Spark 4.3.0 and `openlineage-spark` 1.55.0:
| Source | Status | `Authorization` header |
|---|---|---|
| Airflow task events | 201 | `Bearer secret_123` |
| Spark job events (6) | 401 | `Bearer Bearer secret_123` |
The Spark driver logs
`io.openlineage.client.transports.HttpTransportResponseException: code: 401`.
### What you think should happen instead?
The raw API key should be injected, so that Spark sends `Authorization:
Bearer <key>`, the same header Airflow sends.
### Operating System
macOS
### Deployment
Virtualenv installation
### Apache Airflow Provider(s)
openlineage
### Versions of Apache Airflow Providers
apache-airflow-providers-openlineage from `main` (transport injection was
added in 2.1.0, #45326)
### Anything else?
The tests in the openlineage, apache-spark, apache-livy and google providers
expect `"Bearer <key>"` as the injected value.
### Are you willing to submit PR?
- [x] 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]