Skip to content

Bound the settings redactor's matching time (#4348) - #4392

Merged
erikdarlingdata merged 3 commits into
devfrom
fix/4348-redactor-match-time
Sep 26, 2026
Merged

erikdarlingdata merged 3 commits into
devfrom
fix/4348-redactor-match-time

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Refs #4348.

  • Every pattern in PgSettingRedactor has a bounded matching time. The one pattern with no lookarounds or backreferences uses RegexOptions.NonBacktracking. The others carry a 100 ms match timeout.
  • If any pattern times out, the whole value is masked. The warning names only the setting.
  • The three name-matching patterns anchor at a name boundary and check for their separator with a linear lookahead first, so a long name run with no separator costs linear time. The output is unchanged.

Tests

  • Long-input timing: 3,200 and 32,000 characters, with and without a trailing assignment. Each finishes under 50 ms after a warm-up run; measured locally at under 10 ms, up to 100,000 characters.
  • A forced timeout, through a test-only, per-flow timeout seam: the whole value is masked, and the warning names only the setting. A callback that throws doesn't escape.
  • A frozen parity list: 39 crafted inputs whose expected output was captured from the previous redactor.

CHANGELOG entry

SECTION: Fixed
ENTRY:

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 26, 2026 07:38
@erikdarlingdata
erikdarlingdata merged commit 05ec0e3 into dev Sep 26, 2026
16 of 18 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/4348-redactor-match-time branch September 26, 2026 07:39
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.

1 participant