Skip to content

fix(watcher): sanitize tenant_id in asyncio task and thread names#106

Merged
zeevdr merged 1 commit into
mainfrom
fix/sanitize-task-names
May 25, 2026
Merged

fix(watcher): sanitize tenant_id in asyncio task and thread names#106
zeevdr merged 1 commit into
mainfrom
fix/sanitize-task-names

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 25, 2026

Summary

  • Task and thread names included tenant_id verbatim, allowing user-controlled control characters to appear in asyncio task names and threading.Thread names.
  • Adds a module-level compiled regex that strips everything outside the printable ASCII range (0x20–0x7E) before embedding the ID in the name.

Test plan

  • test_thread_name_sanitizes_control_chars — verifies sync watcher strips \x00 and \x1f from thread name
  • test_task_name_sanitizes_control_chars — verifies async watcher strips same chars from asyncio task name
  • 254 tests pass, 97.55% coverage (above 95% threshold)

Closes #70

Strip non-printable characters from tenant_id before embedding it in the
asyncio task name (async_watcher) and threading.Thread name (watcher).
A module-level compiled regex removes everything outside the printable
ASCII range (0x20–0x7E), so user-controlled tenant IDs containing
control characters no longer propagate into task/thread names.

Closes #70

Co-Authored-By: Claude <noreply@anthropic.com>
@zeevdr zeevdr added this to the Beta Readiness milestone May 25, 2026
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P2 Nice-to-have labels May 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zeevdr zeevdr merged commit cb495ad into main May 25, 2026
15 checks passed
@zeevdr zeevdr deleted the fix/sanitize-task-names branch May 25, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P2 Nice-to-have size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sanitize tenant_id in asyncio task names

1 participant