Closed madflojo closed 4 months ago
Recent modifications in the codebase focus on enhancing the security and readability of log statements in the server.go
file of the pkg/app
package by sanitizing URL paths before logging them. The sanitize
package has been introduced to facilitate this by providing a function that removes non-alphanumeric and newline characters from strings.
File/Path | Summary |
---|---|
pkg/app/server.go | Added import for sanitize and updated logging statements to use sanitize.String for URL path sanitization. |
pkg/sanitize/sanitize.go | Introduced String function to sanitize input by removing non-alphanumeric characters. |
pkg/sanitize/tests.go | Added TestCase struct and TestSanitize function to verify the sanitize.String functionality. |
sequenceDiagram
participant Client
participant Server
participant Logger
participant Sanitize
Client->>Server: HTTP Request with URL
Server->>Sanitize: sanitize.String(URL.EscapedPath())
Sanitize-->>Server: Cleaned URL Path
Server->>Logger: Log "HTTP Request to [Sanitized URL] received"
Server-->>Client: Handle Request
Server->>Sanitize: sanitize.String(URL.EscapedPath())
Sanitize-->>Server: Cleaned URL Path
Server->>Logger: Log "HTTP Request to [Sanitized URL] complete"
In the server’s gentle light we stand,
Logging paths, by a rabbit's hand.
Sanitized clean, no threat in sight,
Each URL shines, pure and bright.
With safety and clarity, we code anew,
In each log, a safer view. 🌟🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 80.10%. Comparing base (
4b757b9
) to head (724496b
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Addressing log sanitization security warnings
Summary by CodeRabbit
Bug Fixes
New Features