Skip to content

[Telemetry] Mask user info of configured URLs in logs, messages and UI - #305

Merged
LarsLaskowski merged 16 commits into
mainfrom
claude/nice-curie-340hld
Oct 24, 2026
Merged

LarsLaskowski merged 16 commits into
mainfrom
claude/nice-curie-340hld

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Pull Request

📖 Description

Configured base URLs of Docker instances and Portainer could carry credentials (https://user:secret@host) that reached logs, exception and scan-run error messages, the database and the Docker Instances pages. A new helper, UrlRedaction.RedactUserInfo, now replaces the user info with *** at every such output site, including the retry handler's request target, the named-pipe exception message and the stored EndpointUri/PortainerEndpoint.BaseUrl; the UI masks again on display so older rows never show credentials. The helper rebuilds a URL only when it has exactly one @, parses and has non-empty user info, and masks every other value containing @ up to its last @, so unusual passwords (starting with #, ? or /) cannot leak. Connecting still uses the configured URL, and event IDs and template parameter names are unchanged. This is a security fix.

🎫 Issues

Closes #295

Decision record: 0005

💬 Reviewer Notes

Focus on Infrastructure/UrlRedaction.cs (fail-closed rule) and the call sites in TransientHttpRetryHandler, PortainerClient, DockerInstanceClient, InstanceDiscoveryService and ApplicationViewService. HTTP client span url.full carries no user info (checked in the OpenTelemetry and .NET runtime sources, so no extra test). The Docker Engine client has no retry handler, so the Docker retry example in the issue cannot occur.

📑 Test Plan

New UrlRedactionTests (all forms, each asserting that neither user name nor password appears) plus tests in TransientHttpRetryHandlerTests, PortainerClientTests, DockerInstanceClientTests, InstanceDiscoveryServiceTests and ApplicationViewServiceTests. Format, build, 570 + 21 tests, Coverage gate (new code 100 %, overall 84.5 %) and Analyzer gate pass locally.

✅ Checklist

  • I have added or updated Unit Tests for the change.
  • I have tested my changes.
  • I have run Format and Build from .squad/stack.md, and the Analyzer gate reports no diagnostic in a changed file.
  • The Coverage gate in .squad/stack.md passes (line coverage on new or changed production code and overall).
  • I have updated the project documentation (README.md, ARCHITECTURE.md) to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the project's code style guidelines.
  • New dependencies, if any, were added the way Dependencies in .squad/stack.md prescribes.
  • The C# rules in csharp.instructions.md are followed.

⏭ Next Steps

claude added 16 commits October 24, 2026 10:48
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019unkFPP5TCRVosCsDJtYGB
@sonarqubecloud

Copy link
Copy Markdown

@LarsLaskowski
LarsLaskowski marked this pull request as ready for review October 24, 2026 11:34
@LarsLaskowski
LarsLaskowski merged commit d822166 into main Oct 24, 2026
4 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/nice-curie-340hld branch October 24, 2026 12:29
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.

[BUG] Credentials embedded in configured URLs leak into logs, error messages and the UI

2 participants