You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "NickiForte (via GitHub)" <gi...@apache.org> on 2024/01/18 15:33:35 UTC

[I] CSRF token to expire with session when config file exists [airflow]

NickiForte opened a new issue, #36869:
URL: https://github.com/apache/airflow/issues/36869

   ### Apache Airflow version
   
   2.8.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Despite https://github.com/apache/airflow/pull/28730, I encounter the message that the CSRF token has expired, although I checked that the session has not ended:
   
   ![image](https://github.com/apache/airflow/assets/95344621/836479cc-3259-490d-83f7-ded75e59fd76)
   
   The reason why this still happens is because I have defined a custom webserver config, where the argument `WTF_CSRF_TIME_LIMIT` is not specified at all.
   
   ### What you think should happen instead?
   
   As is discussed in https://github.com/apache/airflow/pull/28730, it is completely unnecessary for the CSRF token to expire before the end of a session, as it does not provide any extra security.
   
   The default value of `WTF_CSRF_TIME_LIMIT` should be the same regardless of if there is a webserver config file or not, unless explicitly overridden.
   
   ### How to reproduce
   
   Define a custom webserver config where the argument `WTF_CSRF_TIME_LIMIT` is not specified at all. Then just wait until the CSRF token expires.
   
   And as is seen clearly in this function,
   https://github.com/apache/airflow/blob/681859c7bffabce0c294060d811db2fb16851816/airflow/configuration.py#L2059C1-L2066C96,
   if you have specified a custom webserver config, the values in the default webserver config are ignored. Thus the CSRF expiry time will take on the flask default, i.e. 3600 seconds, instead of the airflow default which is None.
   
   
   
   ### Operating System
   
   MacOS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Amazon (AWS) MWAA
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   It is of course possible to specify the argument `WTF_CSRF_TIME_LIMIT = None` in the custom webserver config. However, this CSRF expiry issue can be a real headache and it took quite some time to figure out the fix, so it would be nice to solve this once and for all.
   
   One could also argue that if one creates a custom webserver config, one should copy the default values first. In my case, however, this was done before https://github.com/apache/airflow/pull/28730, so even if we now use a new airflow version, we still used the same config. I suspect this is the case for many others as well.
   
   ### 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] CSRF token to expire with session when config file exists [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #36869:
URL: https://github.com/apache/airflow/issues/36869#issuecomment-1898708011

   Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
   


-- 
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] CSRF token to expire with session when config file exists [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #36869: CSRF token to expire with session when config file exists
URL: https://github.com/apache/airflow/issues/36869


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