Repository navigation
fix(streaming): redact NATS endpoint credentials in logs - #11291
Conversation
Remove URI usernames and passwords from every configured NATS seed endpoint before writing connection and JetStream log fields. Preserve the configured client URLs for authentication and retain endpoint addresses for diagnostics. Extracted from dotnet#10798. Original implementation: 61eefc2 (Reuben Bond <reuben.bond@gmail.com>). Add focused offline exact-output regressions for user/password, token, multi-seed, and invalid endpoint descriptions.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain, and focused regression tests are included.
Review effort: Lite
Findings: None
What changed in this PR
This PR prevents NATS endpoint credentials from appearing in logs while preserving original URLs for authentication.
Changes:
- Adds credential-safe endpoint descriptions at all logging call sites.
- Adds regression tests for redaction, normalization, and invalid endpoints.
| File | Description |
|---|---|
test/Extensions/Orleans.Streaming.NATS.Tests/NatsConnectionManagerTests.cs |
Tests credential redaction and endpoint handling. |
src/Orleans.Streaming.NATS/Providers/NatsConnectionManager.cs |
Redacts credentials before endpoint logging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292. Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292. Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
Code coverage
Report-only conclusion: regressed. The current-main baseline is commit Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities. The comparison remains report-only while normal line and branch variance is calibrated. Coverage details |
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292. Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292. Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292. Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
Problem
The NATS connection manager writes configured server URLs directly into connection and JetStream log fields. Seed URLs can contain username/password or token credentials, exposing them in logs.
Solution
Extract the endpoint-description helper from #10798 and apply it at all five existing endpoint logging call sites. Each comma-separated seed endpoint has its URI username and password removed, while its address remains available for diagnostics. Connection options retain their original URLs for authentication.
Focused offline regression tests assert exact descriptions for username/password and token credentials, multiple seed endpoints, encoded credentials, endpoint normalization, and invalid endpoint placeholders.
Rationale
This isolates the existing logging fix as a small prerequisite to the Aspire integration: one runtime source file and one focused test file. The original implementation is from commit 61eefc2 by Reuben Bond reuben.bond@gmail.com; the extraction preserves that authorship and records the source commit.
#10798 retains the helper and its shared-connection use until this prerequisite is human-merged.
Microsoft Reviewers: Open in CodeFlow