Skip to content

Commit

Permalink
Fix code scanning alert no. 4: Log entries created from user input
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
praseodym and github-advanced-security[bot] authored Dec 12, 2024
1 parent 5af1f35 commit b442359
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ func createLinkController(a *App) gin.HandlerFunc {
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
"errorMessage": fmt.Sprintf("Unable to create link, error: %s", err),
})
sanitizedLinkName := strings.ReplaceAll(link.Name, "\n", "")

Check failure on line 74 in link.go

View workflow job for this annotation

GitHub Actions / lint

undefined: strings
sanitizedLinkName = strings.ReplaceAll(sanitizedLinkName, "\r", "")

Check failure on line 75 in link.go

View workflow job for this annotation

GitHub Actions / lint

undefined: strings
sanitizedLinkRedirect := strings.ReplaceAll(link.Redirect, "\n", "")

Check failure on line 76 in link.go

View workflow job for this annotation

GitHub Actions / lint

undefined: strings
sanitizedLinkRedirect = strings.ReplaceAll(sanitizedLinkRedirect, "\r", "")

Check failure on line 77 in link.go

View workflow job for this annotation

GitHub Actions / lint

undefined: strings (typecheck)
log.WithFields(log.Fields{
"name": link.Name,
"redirect": link.Redirect,
"name": sanitizedLinkName,
"redirect": sanitizedLinkRedirect,
}).Errorf("unable to create link, error: %s", err)
return
}
Expand Down

0 comments on commit b442359

Please sign in to comment.