Potential fix for code scanning alert no. 115: Clear-text logging of sensitive information#3832
Open
fiftin wants to merge 1 commit into
Open
Potential fix for code scanning alert no. 115: Clear-text logging of sensitive information#3832fiftin wants to merge 1 commit into
fiftin wants to merge 1 commit into
Conversation
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
|
||
| func (t *LocalJob) Log(msg string) { | ||
| t.Logger.Log(msg) | ||
| t.Logger.Log(t.sanitizeLogMessage(msg)) |
There was a problem hiding this comment.
Security review (automation)
Scope: services/tasks/LocalJob.go — sanitizeLogMessage + wiring in Log.
Assessment: No medium / high / critical vulnerabilities introduced by this change.
- What changed: Task log lines passed through
LocalJob.Lognow replacehttp(s)://…userinfo@withhttp(s)://***@, which addresses clear-text logging of embedded HTTP(S) URL credentials for the common lowercase-scheme form. - Residual risk (low): The pattern is case-sensitive (
https?only), so mixed-case schemes (e.g.HTTPS://user:pass@…) would not be redacted; many tools normalize to lowercase, so practical exposure is limited. Non-HTTP URL schemes (e.g.git@,ftp://) are unchanged — pre-existing breadth of logging, not expanded by this PR. - Out of scope for this diff: Call sites that invoke
t.Logger.Logdirectly (e.g. git client helpers) bypassLocalJob.Log; that behavior predates this PR.
Slack-style summary
- PR: Potential fix for code scanning alert 115 (clear-text logging of sensitive info in
LocalJob.Log). - Outcome: No medium+ security findings on the added/modified code; change is a targeted redaction improvement with minor edge-case coverage limits noted above.
Sent by Cursor Automation: Find vulnerabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Potential fix for https://github.com/semaphoreui/semaphore/security/code-scanning/115
General fix: ensure all log messages are sanitized before emission so secrets (especially credentials embedded in URLs like
https://user:pass@host/...) are redacted.Best single fix without changing functionality: update
services/tasks/LocalJob.gosoLog(msg string)passes a sanitized message tot.Logger.Log. Add a helper that redacts userinfo inhttp:///https://URLs fromuser[:password]@to***@. This preserves operational logging context while removing sensitive data. No behavior change outside log content redaction.Changes needed:
services/tasks/LocalJob.goregexpLocalJob(or private function) to sanitize log message.Log(msg string)to call sanitizer before logging.db/Repository.gofor this alert, since the sink-side sanitization addresses both variants centrally.Suggested fixes powered by Copilot Autofix. Review carefully before merging.