Remove deprecated sanitization wrapper functions #284
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The codebase had two deprecated wrapper functions (
sanitizePayloadandsanitizeSecrets) that added indirection without providing value, flagged by semantic function clustering analysis.Changes
sanitizePayload()fromjsonl_logger.goandsanitizeSecrets()frommarkdown_logger.go(15 lines total)sanitize.SanitizeJSON()andsanitize.SanitizeString()throughout logger code and testsauth/header.go:sanitizeForLogging()- implements distinct prefix-based logic for auth header previewsBefore/After
The sanitize package now serves as the single source of truth for regex-based sanitization, with auth-specific sanitization remaining separate by design.
Original prompt
This section details on the original issue you should resolve
<issue_title>[refactor] Semantic Function Clustering Analysis - January 2026 Update</issue_title>
<issue_description>## Overview
Fresh analysis of 43 non-test Go files (~7,830 lines, 299 functions) in the MCP Gateway codebase reveals that significant refactoring progress has been made since previous analyses. The codebase is now well-organized with the newly created
internal/auth/package consolidating authentication logic, and theinternal/logger/sanitize/package providing centralized sanitization.Key Findings:
internal/auth/now provides centralized authentication parsinginternal/logger/sanitize/package with unified APIComparison to Previous Analyses:
Full Report
Analysis Metadata
Package Organization Assessment
✅ Excellent Organization (9 packages)
auth/cmd/difc/guard/launcher/mcp/sys/timeutil/tty/✅ Good Organization (2 packages)
config/testutil/logger/server/Progress Since Previous Analyses
✅ Completed Refactoring (Issues #196, #226, #256)
1. Auth Package Created ✅
Previous Issue: Auth logic was split between
server/auth.goandguard/context.go, creating potential inconsistencies.Resolution: Created
internal/auth/package with:Impact:
server/auth.goandguard/context.gonow reference this packageFiles Updated:
internal/auth/header.go- Created with comprehensive parsing logicinternal/server/auth.go- Comments reference auth packageinternal/guard/context.go- Comments reference auth package2. Sanitization Package Created ✅
Previous Issue: Sanitization functions scattered across multiple packages (launcher, logger files).
Resolution: Created
internal/logger/sanitize/package with:Features:
**Files Using Sanit...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.