[ 
https://issues.apache.org/jira/browse/CASSANDRA-20208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Konstantinov updated CASSANDRA-20208:
--------------------------------------------
    Description: 
based on the discussion in 
[https://lists.apache.org/thread/3whc30bqfcr1vgwv73zwlv74l2v3c0gt]

a configuration like this:
{code:java}
audit_logging_options:
  enabled: true
  logger:
    - class_name: FileAuditLogger
  included_categories: DCL, ERROR, AUTH {code}
is not sanitized when it is loaded on startup from cassandra.yaml file - spaces 
here are remaining here: " ERROR", " AUTH" after parsing. As a result the audit 
logs filtering works not in a way as a user may expect and it is hard to 
troubleshoot.


When we run nodetool enableauditlog the following logic is invoked: 
https://github.com/apache/cassandra/blob/cassandra-4.1.7/src/java/org/apache/cassandra/service/StorageService.java#L6459
 which rebuild AuditLogOptions using builder API.AuditLogOption.build() has 
sanitisation logic which does the trimming: 
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/audit/AuditLogOptions.java#L235
 

org.apache.cassandra.config.Config#audit_logging_options is created a generic 
reflective code which does not use the builder, so there is no trimming during 
a startup.

It can be fixed by adding sanitisation during the startup parsing too to make 
the behaviour more consistent and less error prone. 

  was:
based on the discussion in 
[https://lists.apache.org/thread/3whc30bqfcr1vgwv73zwlv74l2v3c0gt]

a configuration like this:
{code:java}
audit_logging_options:
  enabled: true
  logger:
    - class_name: FileAuditLogger
  included_categories: DCL, ERROR, AUTH {code}
is not sanitized when it is loaded on startup from cassandra.yaml file - spaces 
here are remaining: " ERROR", " AUTH" after parsing. As a result the audit logs 
filtering works not in a way as a user may expect and it is hard to 
troubleshoot.


When we run nodetool enableauditlog the following logic is invoked: 
https://github.com/apache/cassandra/blob/cassandra-4.1.7/src/java/org/apache/cassandra/service/StorageService.java#L6459
 which rebuild AuditLogOptions using builder API.AuditLogOption.build() has 
sanitisation logic which does the trimming: 
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/audit/AuditLogOptions.java#L235
 

org.apache.cassandra.config.Config#audit_logging_options is created a generic 
reflective code which does not use the builder, so there is no trimming during 
a startup.

It can be fixed by adding sanitisation during the startup parsing too to make 
the behaviour more consistent and less error prone. 


> audit_logging_options parameters are not sanitized when loaded from a 
> configuration file
> ----------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-20208
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20208
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Observability/Logging
>            Reporter: Dmitry Konstantinov
>            Priority: Normal
>
> based on the discussion in 
> [https://lists.apache.org/thread/3whc30bqfcr1vgwv73zwlv74l2v3c0gt]
> a configuration like this:
> {code:java}
> audit_logging_options:
>   enabled: true
>   logger:
>     - class_name: FileAuditLogger
>   included_categories: DCL, ERROR, AUTH {code}
> is not sanitized when it is loaded on startup from cassandra.yaml file - 
> spaces here are remaining here: " ERROR", " AUTH" after parsing. As a result 
> the audit logs filtering works not in a way as a user may expect and it is 
> hard to troubleshoot.
> When we run nodetool enableauditlog the following logic is invoked: 
> https://github.com/apache/cassandra/blob/cassandra-4.1.7/src/java/org/apache/cassandra/service/StorageService.java#L6459
>  which rebuild AuditLogOptions using builder API.AuditLogOption.build() has 
> sanitisation logic which does the trimming: 
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/audit/AuditLogOptions.java#L235
>  
> org.apache.cassandra.config.Config#audit_logging_options is created a generic 
> reflective code which does not use the builder, so there is no trimming 
> during a startup.
> It can be fixed by adding sanitisation during the startup parsing too to make 
> the behaviour more consistent and less error prone. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to