Skip to content

Commit

Permalink
Merge pull request #2826 from newrelic/0b4u5c@t10n
Browse files Browse the repository at this point in the history
update SQL obfuscation regexes
  • Loading branch information
fallwith committed Aug 23, 2024
2 parents 454d61f + 1ea27bf commit 5beb294
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/new_relic/agent/database/obfuscation_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ module Agent
module Database
module ObfuscationHelpers
COMPONENTS_REGEX_MAP = {
:single_quotes => /'(?:[^']|'')*?(?:\\'.*|'(?!'))/,
:double_quotes => /"(?:[^"]|"")*?(?:\\".*|"(?!"))/,
:dollar_quotes => /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/,
:uuids => /\{?(?:[0-9a-fA-F]\-*){32}\}?/,
:numeric_literals => /-?\b(?:[0-9]+\.)?[0-9]+([eE][+-]?[0-9]+)?\b/,
:boolean_literals => /\b(?:true|false|null)\b/i,
:hexadecimal_literals => /0x[0-9a-fA-F]+/,
:comments => /(?:#|--).*?(?=\r|\n|$)/i,
:multi_line_comments => /\/\*(?:[^\/]|\/[^*])*?(?:\*\/|\/\*.*)/,
:oracle_quoted_strings => /q'\[.*?(?:\]'|$)|q'\{.*?(?:\}'|$)|q'\<.*?(?:\>'|$)|q'\(.*?(?:\)'|$)/
}
single_quotes: /'(?:[^']|'')*?(?:\\'.*|'(?!'))/,
double_quotes: /"(?:[^"]|"")*?(?:\\".*|"(?!"))/,
dollar_quotes: /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/,
uuids: /\{?(?:[0-9a-fA-F]-*){32}\}?/,
numeric_literals: /-?\b(?:[0-9]+\.)?[0-9]+([eE][+-]?[0-9]+)?\b/,
boolean_literals: /\b(?:true|false|null)\b/i,
hexadecimal_literals: /0x[0-9a-fA-F]+/,
comments: /(?:#|--).*?(?=\r|\n|$)/i,
multi_line_comments: %r{/\*.*?\*/}m,
oracle_quoted_strings: /q'\[.*?(?:\]'|$)|q'\{.*?(?:\}'|$)|q'<.*?(?:>'|$)|q'\(.*?(?:\)'|$)/
}.freeze

DIALECT_COMPONENTS = {
:fallback => COMPONENTS_REGEX_MAP.keys,
Expand Down

0 comments on commit 5beb294

Please sign in to comment.