You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bugraoz93 (via GitHub)" <gi...@apache.org> on 2025/04/11 19:54:54 UTC

[I] AIP-81 Handle Empty Credentials [airflow]

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

   ### Body
   
   Check if credentials are loaded in each command (airflowctl) and ask user to login otherwise. 
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow project.


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2800121276

   > I understand the different issues related to this matter, and that’s why I asked for clarification. Apologies for any confusion caused
   
   Thanks a lot @Prab-27 for your interest! I will ping you in case there will be an issue.


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 closed issue #49139: AIP-81 Handle Empty Credentials
URL: https://github.com/apache/airflow/issues/49139


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2798877942

   @aritra24 On a second thought, to keep the logs for users on the `ctl` side, not on the `api` side, we can create a base method for `ActionCommand` and check if credential exists. We can call the `Credentials` method to `check_if_exist` new one to check without loading the credentials. We should also check if it expires to warn, but that can be another issue. What do you think?


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2800121252

   > Yeah, that makes sense. So to confirm we add a base method in actioncommand that calls credentials.check_if_exists before each command? Also I don't fully understand the without loading the credentials. Is there a specific reason to not load it except it'd ask for the password?
   
   As a concept, we are encapsulating the Client with embedded loaded credentials to each ActionCommand itself. This makes a functional Client in the methods. What we shouldn't do is load credentials on the CTL level (ctl package level https://github.com/apache/airflow/tree/main/airflow-ctl/src/airflowctl/ctl) without encapsulating them into the Client. That's why I offered the check_if_exists without actually loading the key but checking if the environment exists, which means `airflowctl auth login` never ran. If it exists but still getting an error for the expired token, that falls into the case of the token being expired. For that, we should do an additional check on the Client side while initialising so that somehow we can prevent being called by the command itself.
   


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "Prab-27 (via GitHub)" <gi...@apache.org>.
Prab-27 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2799548370

   @bugrao, are you referring to providing a warning about token expiration? If so, I'd like to work on that issue. Could you please assign it to me?
   
   cc: @aritra24 


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "Prab-27 (via GitHub)" <gi...@apache.org>.
Prab-27 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2799791226

   I understand the different issues related to this matter, and that’s why I asked for clarification.
   Apologies for any confusion caused 


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2798879557

   Yeah, that makes sense. So to confirm we add a base method in actioncommand that calls credentials.check_if_exists before each command? Also I don't fully understand the without loading the credentials. Is there a specific reason to not load it except it'd ask for the password? 


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2799560146

   Hi @Prab-27, I'm already looking into this one so you can try picking up some other tasks... 


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2809958619

   > 你遇到的是关于 Airflow CLI 工具 (airflowctl) 的开发/提交规范问题,主要是在命令执行前需要检查是否已经加载了凭证(credentials),如果没有需要提示用户登录。同时,你要声明你是 Apache Airflow 项目的 committer 或 maintainer。
   > 
   > 下面分别解释怎么解决:
   > 
   > 1. 在每个 airflowctl 命令中检查凭证
   > 思路:
   > 
   > 每次执行命令时,首先检查凭证是否已经加载。如果没有,提示用户登录。
   > 
   > Python 伪代码实现举例
   > 假设你在开发 airflowctl,可以加一个装饰器或统一的前置检查:
   > 
   > python
   > def require_credentials(func):
   >     def wrapper(*args, **kwargs):
   >         if not credentials_loaded():
   >             print("You are not logged in. Please run 'airflowctl login' first.")
   >             exit(1)
   >         return func(*args, **kwargs)
   >     return wrapper
   > 
   > @require_credentials
   > def run_some_command():
   >     # 你的命令逻辑
   >     pass
   > 
   > def credentials_loaded():
   >     # 判断本地凭证文件、env变量或调用API等方式
   >     # return True or False
   >     ...
   > 在每个命令入口加上 @require_credentials,或者在 CLI 命令解析主入口统一做检查。
   > 
   > 2. 解决 committer 声明问题
   > 你写的
   > 
   > I acknowledge that I am a maintainer/committer of the Apache Airflow project.
   > 
   > 这通常是提交代码到 Apache 项目时的流程要求:
   > 
   > 你如果是 committer,需要在 PR 或 commit message 里加上这类声明,表示你有权限进行相应操作。
   > 如果你不是 committer,你不需要加这句话。  具体回复在我的AI https://code.mayoubang.cn/conversion/share/87060137106
   
   What is your intention to generate AI messages? This is not a proper way to communicate, or this is not a place or environment for you to test some things.


-- 
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] AIP-81 Handle Empty Credentials [airflow]

Posted by "zzzzaaa-000 (via GitHub)" <gi...@apache.org>.
zzzzaaa-000 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2809121511

   你遇到的是关于 Airflow CLI 工具 (airflowctl) 的开发/提交规范问题,主要是在命令执行前需要检查是否已经加载了凭证(credentials),如果没有需要提示用户登录。同时,你要声明你是 Apache Airflow 项目的 committer 或 maintainer。
   
   下面分别解释怎么解决:
   
   1. 在每个 airflowctl 命令中检查凭证
   思路:
   
   每次执行命令时,首先检查凭证是否已经加载。如果没有,提示用户登录。
   
   Python 伪代码实现举例
   假设你在开发 airflowctl,可以加一个装饰器或统一的前置检查:
   
   python
   def require_credentials(func):
       def wrapper(*args, **kwargs):
           if not credentials_loaded():
               print("You are not logged in. Please run 'airflowctl login' first.")
               exit(1)
           return func(*args, **kwargs)
       return wrapper
   
   @require_credentials
   def run_some_command():
       # 你的命令逻辑
       pass
   
   def credentials_loaded():
       # 判断本地凭证文件、env变量或调用API等方式
       # return True or False
       ...
   在每个命令入口加上 @require_credentials,或者在 CLI 命令解析主入口统一做检查。
   
   2. 解决 committer 声明问题
   你写的
   
   I acknowledge that I am a maintainer/committer of the Apache Airflow project.
   
   这通常是提交代码到 Apache 项目时的流程要求:
   
   你如果是 committer,需要在 PR 或 commit message 里加上这类声明,表示你有权限进行相应操作。
   如果你不是 committer,你不需要加这句话。  具体回复在我的AI https://code.mayoubang.cn/conversion/share/87060137106


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