Skip to content

fix: escape the word boundary in the IPv4 redaction example - #1110

Merged
odubajDT merged 1 commit into
Dynatrace:mainfrom
knQzx:fix/redaction-ipv4-pattern
Jul 31, 2026
Merged

odubajDT merged 1 commit into
Dynatrace:mainfrom
knQzx:fix/redaction-ipv4-pattern

Conversation

@knQzx

@knQzx knQzx commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

in config_examples/redaction.yaml the IPv4 entry uses a single-backslash \b:

- "^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\b){4}$" ## IPv4 addresses

inside a double-quoted YAML scalar \b is the backspace escape, so the pattern that reaches the redaction processor ends with a literal 0x08 byte instead of a word boundary. it can never match an address. every other escape in the same list is already doubled, so this one looks like a slip rather than intent

parsing the file with yaml.v3 and compiling the result, the pattern matches none of 192.168.1.100, 10.0.0.1, 8.8.8.8, 255.255.255.255, 1.2.3.4, while the three neighbouring patterns work. with the fix it matches all five

the same IPv4 regex lives in internal/testcommon/oteltest/sinks.go:37 without the \b and behaves correctly there

someone copying this example to strip IPs before shipping telemetry gets a config that looks right and redacts nothing. the shipped allow_all_keys: false limits how much that bites in practice, but the example is still wrong

changes

double the backslash so the word boundary survives YAML parsing, plus a changelog entry

@knQzx
knQzx requested a review from a team as a code owner July 30, 2026 21:05
Inside a double-quoted YAML scalar \b is the backspace escape, so the pattern
ended up requiring a literal 0x08 and matched no address at all. The
neighbouring escapes in the same list are already doubled.
@knQzx
knQzx force-pushed the fix/redaction-ipv4-pattern branch from ca4fd4f to 3ec47d5 Compare July 30, 2026 21:05
@odubajDT
odubajDT merged commit d68046e into Dynatrace:main Jul 31, 2026
41 checks passed
@odubajDT

Copy link
Copy Markdown
Contributor

Thank you for your contribution @knQzx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants