The GitHub Actions job "Tests" on airflow.git/fix-fetch-task-logs-jwk-key has 
succeeded.
Run started by GitHub user ashb (triggered by ashb).

Head commit for run:
a8c0f3e752dc9ee37643cd01e777a6a9128e6674 / Ash Berlin-Taylor <[email protected]>
Force use of symetric JWT algorithm for internal logs server

Since the logs server was hard-coded to use a secret_key, if a user specified
the `api_auth`.`jwt_algorithm` config section it would have interferred and
caused this error:

```
Traceback (most recent call last):
  File 
"/usr/local/lib/python3.12/site-packages/airflow/utils/log/file_task_handler.py",
 line 567, in _read_from_logs_server
    response = _fetch_logs_from_service(url, rel_path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/local/lib/python3.12/site-packages/airflow/utils/log/file_task_handler.py",
 line 112, in _fetch_logs_from_service
    headers={"Authorization": generator.generate({"filename": 
log_relative_path})},
                              
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/local/lib/python3.12/site-packages/airflow/api_fastapi/auth/tokens.py", 
line 458, in generate
    return jwt.encode(claims, self.signing_arg, algorithm=self.algorithm, 
headers=headers)
           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jwt/api_jwt.py", line 78, in 
encode
    return api_jws.encode(
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jwt/api_jws.py", line 170, in 
encode
    key = alg_obj.prepare_key(key)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jwt/algorithms.py", line 738, 
in prepare_key
    raise InvalidKeyError(
jwt.exceptions.InvalidKeyError: Expecting a 
EllipticCurvePrivateKey/EllipticCurvePublicKey. Wrong key provided for EdDSA 
algorithms
```

The fix is to force a use of HS512 (the same one you would get if you didn't
specify an algorithm and did pass just a secret_key)

Fixes #48759

Report URL: https://github.com/apache/airflow/actions/runs/14369184578

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to