- Created `qa-test-output-after-fix.txt` and `qa-test-output.txt` to log results of certificate page authentication tests. - Added `build.sh` for deterministic backend builds in CI, utilizing `go list` for efficiency. - Introduced `codeql_scan.sh` for CodeQL database creation and analysis for Go and JavaScript/TypeScript. - Implemented `dockerfile_check.sh` to validate Dockerfiles for base image and package manager mismatches. - Added `sourcery_precommit_wrapper.sh` to facilitate Sourcery CLI usage in pre-commit hooks.
20 lines
447 B
Go
20 lines
447 B
Go
// Package util provides utility functions used across the application.
|
|
package util
|
|
|
|
import (
|
|
"regexp"
|
|
"strings"
|
|
)
|
|
|
|
// SanitizeForLog removes control characters and newlines from user content before logging.
|
|
func SanitizeForLog(s string) string {
|
|
if s == "" {
|
|
return s
|
|
}
|
|
s = strings.ReplaceAll(s, "\r\n", " ")
|
|
s = strings.ReplaceAll(s, "\n", " ")
|
|
re := regexp.MustCompile(`[\x00-\x1F\x7F]+`)
|
|
s = re.ReplaceAllString(s, " ")
|
|
return s
|
|
}
|