Skip to main content

obfuscate_sql_string

Function obfuscate_sql_string 

Source
pub fn obfuscate_sql_string(s: &str) -> String
Expand description

Obfuscates an sql string by replacing litterals with ‘?’ chars.

The algorithm works by finding the places where a litteral could start (so called splitters) and then identifies them by looking at their first few characters.

It does not attempt at rigorous parsing of the SQL syntax, and does not take any context sensitive decision, contrary to the more exhaustive datadog-agent implementation.

based off https://github.com/DataDog/dd-trace-java/blob/36e924eaa/internal-api/src/main/java/datadog/trace/api/normalize/SQLNormalizer.java