You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jscheffl (via GitHub)" <gi...@apache.org> on 2025/10/31 18:25:22 UTC

[PR] Remove global from Fernet Crypto tooling [airflow]

jscheffl opened a new pull request, #57642:
URL: https://github.com/apache/airflow/pull/57642

   As I was attempting to clean code toward ruff rule PLW0603 (https://docs.astral.sh/ruff/rules/global-statement/) I noticed that some code is a bit... outdated to be refactored.
   
   First proposal is to get rid of the global statement in the Fernet/crypto wrapper which just used the global variable as cache.
   
   Whereas I would like to have feedback as well as in airflow-core/src/airflow/configuration.py:2108 actually we changed in the past to always generate a FERNET_KEY even if none is provided, so could we erase-out some complexity as we assume durnog start there will be always one FERNET_KEY being around?


-- 
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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on PR #57642:
URL: https://github.com/apache/airflow/pull/57642#issuecomment-3493348436

   > > Whereas I would like to have feedback as well as in airflow-core/src/airflow/configuration.py:2108 actually we changed in the past to always generate a FERNET_KEY even if none is provided, so could we erase-out some complexity as we assume durnog start there will be always one FERNET_KEY being around?
   > 
   > I think that one is needed. When you want to do `uv run airflow` (clean installation), the fernet key should be generated.
   
   I was referring to that in crypto.py there is a `NullFernet` (See https://github.com/apache/airflow/pull/57642/files#diff-ea01949f936d456948b59bea1b89f14e28c7ecfc952063998ca4d0176c761d4fR44) which implements the protocol but is a NOP crypt. It is selected if no FERNET_KEY is configured (see https://github.com/apache/airflow/pull/57642/files#diff-ea01949f936d456948b59bea1b89f14e28c7ecfc952063998ca4d0176c761d4fR111)... but if configuration.py:2108 always generates one if not configured we can potentially consider dropping the NullFernet?


-- 
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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl merged PR #57642:
URL: https://github.com/apache/airflow/pull/57642


-- 
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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #57642:
URL: https://github.com/apache/airflow/pull/57642#issuecomment-3490654175

   Nice :) . Globals are evil :)


-- 
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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #57642:
URL: https://github.com/apache/airflow/pull/57642#issuecomment-3494014300

   > I was referring to that in crypto.py there is a `NullFernet` (See https://github.com/apache/airflow/pull/57642/files#diff-ea01949f936d456948b59bea1b89f14e28c7ecfc952063998ca4d0176c761d4fR44) which implements the protocol but is a NOP crypt. It is selected if no FERNET_KEY is configured (see https://github.com/apache/airflow/pull/57642/files#diff-ea01949f936d456948b59bea1b89f14e28c7ecfc952063998ca4d0176c761d4fR111)... but if configuration.py:2108 always generates one if not configured we can potentially consider dropping the NullFernet?
   
   Likely :). Don't know why else we would use it.


-- 
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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on PR #57642:
URL: https://github.com/apache/airflow/pull/57642#issuecomment-3498848035

   > Likely :). Don't know why else we would use it.
   
   If I have time will clean in a follow-up 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: [PR] Remove global from Fernet Crypto tooling [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #57642:
URL: https://github.com/apache/airflow/pull/57642#issuecomment-3490659883

   > Whereas I would like to have feedback as well as in airflow-core/src/airflow/configuration.py:2108 actually we changed in the past to always generate a FERNET_KEY even if none is provided, so could we erase-out some complexity as we assume durnog start there will be always one FERNET_KEY being around?
   
   I think that one is needed. When you want to do `uv run airflow`, the fernet key should be generated.


-- 
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