bugraoz93 commented on issue #45304:
URL: https://github.com/apache/airflow/issues/45304#issuecomment-2569795695

   > What would this log from the CLI code that shouldn't already be logged by 
the REST API itself?
   
   We are passing the event as a `cli_` with `extra` as `full_command` 
(`json.dumps({"host_name": host_name, "full_command": full_command})`). This is 
a specific event sent by the CLI that wraps all the CLI action commands. Below, 
`cli_action_logger` will stay for `local commands`, but it should be replaced 
for `remote commands` because this uses the `session`. There are two things to 
consider here. The first is API call Audit Logs, which will again come from 
`signed in` users, which is the regular API auditing. The second one is we 
should also log this event coming from CLI means `event: cli_<>` and `extra: 
full_command`, while understanding that the requests are coming from the CLI 
via `headers` or similar. If we only use the API auditing, there will be 
nothing to differentiate if the action is taken from the CLI or not. This again 
requires bespoke implementation on the API end to make it possible. This brings 
about maintaining code pieces in the API for the CLI, which can make the
  two things more tightly coupled. That's why I thought it would be easier just 
to implement an endpoint for it. I think understanding if a call is coming from 
the CLI would make things a lot easier to debug in case of security emergencies 
or for collecting evidence for breaches.
    
   
https://github.com/apache/airflow/blob/a2c5a48434a95432ef369a1ffcd69a1dac435ed7/airflow/utils/cli.py#L117
   
   
https://github.com/apache/airflow/blob/52ed7d72e9669a7bdfaf11caeea6daa29911bc8f/airflow/utils/cli_action_loggers.py#L118-L160
   


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

Reply via email to