Remove newlines from log messages. (#4777)

Since Boulder's log system adds checksums to lines, but log-validator
processes entries on a per-line basis, including newlines in log
messages can cause a validation failure.
This commit is contained in:
Jacob Hoffman-Andrews 2020-04-16 16:49:08 -07:00 committed by GitHub
parent bcfdec50c7
commit 2d7337dcd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 14 deletions

View File

@ -527,7 +527,7 @@ func logDNSError(
if underlying == dns.ErrId {
packedMsgBytes, err := msg.Pack()
if err != nil {
logger.Errf("logDNSError failed to pack msg: %v\n", err)
logger.Errf("logDNSError failed to pack msg: %v", err)
return
}
encodedMsg := base64.StdEncoding.EncodeToString(packedMsgBytes)
@ -537,7 +537,7 @@ func logDNSError(
if resp != nil {
packedRespBytes, err := resp.Pack()
if err != nil {
logger.Errf("logDNSError failed to pack resp: %v\n", err)
logger.Errf("logDNSError failed to pack resp: %v", err)
return
}
encodedResp = base64.StdEncoding.EncodeToString(packedRespBytes)

View File

@ -19,7 +19,7 @@ func newCertificatesJob(
WHERE
id > :startID
LIMIT :limit`
log.Debugf("Creating Certificates job from config: %#v\n", config.Janitor.Certificates)
log.Debugf("Creating Certificates job from config: %#v", config.Janitor.Certificates)
return &batchedDBJob{
db: dbMap,
log: log,

View File

@ -22,7 +22,7 @@ func newCertificatesPerNameJob(
WHERE
id > :startID
LIMIT :limit`
log.Debugf("Creating CertificatesPerName job from config: %#v\n", config.Janitor.CertificatesPerName)
log.Debugf("Creating CertificatesPerName job from config: %#v", config.Janitor.CertificatesPerName)
return &batchedDBJob{
db: dbMap,
log: log,

View File

@ -18,7 +18,7 @@ func newCertificateStatusJob(
WHERE
id > :startID
LIMIT :limit`
log.Debugf("Creating CertificateStatus job from config: %#v\n", config.Janitor.CertificateStatus)
log.Debugf("Creating CertificateStatus job from config: %#v", config.Janitor.CertificateStatus)
return &batchedDBJob{
db: dbMap,
log: log,

View File

@ -24,7 +24,7 @@ func newOrdersJob(
WHERE
id > :startID
LIMIT :limit`
log.Debugf("Creating Orders job from config: %#v\n", config)
log.Debugf("Creating Orders job from config: %#v", config)
j := &ordersJob{
batchedDBJob: &batchedDBJob{
db: dbMap,

View File

@ -337,7 +337,7 @@ func main() {
logger.Infof("WFE using key policy: %#v", kp)
logger.Infof("Server running, listening on %s...\n", c.WFE.ListenAddress)
logger.Infof("Server running, listening on %s....", c.WFE.ListenAddress)
handler := wfe.Handler(stats)
srv := &http.Server{
Addr: c.WFE.ListenAddress,

View File

@ -335,8 +335,8 @@ func main() {
}
}
}
logger.Infof("Found %d certificate orphans and added %d to the database\n", certOrphansFound, certOrphansAdded)
logger.Infof("Found %d precertificate orphans and added %d to the database\n", precertOrphansFound, precertOrphansAdded)
logger.Infof("Found %d certificate orphans and added %d to the database", certOrphansFound, certOrphansAdded)
logger.Infof("Found %d precertificate orphans and added %d to the database", precertOrphansFound, precertOrphansAdded)
case "parse-der":
ctx := context.Background()

View File

@ -91,7 +91,7 @@ func (log grpcLogger) Fatalln(args ...interface{}) {
}
func (log grpcLogger) Error(args ...interface{}) {
log.Logger.AuditErr(fmt.Sprintln(args...))
log.Logger.AuditErr(fmt.Sprint(args...))
}
func (log grpcLogger) Errorf(format string, args ...interface{}) {
output := fmt.Sprintf(format, args...)
@ -104,7 +104,7 @@ func (log grpcLogger) Errorf(format string, args ...interface{}) {
log.Logger.AuditErr(output)
}
func (log grpcLogger) Errorln(args ...interface{}) {
log.Logger.AuditErr(fmt.Sprintln(args...))
log.Logger.AuditErr(fmt.Sprint(args...))
}
func (log grpcLogger) Warning(args ...interface{}) {
@ -131,7 +131,7 @@ type promLogger struct {
}
func (log promLogger) Println(args ...interface{}) {
log.AuditErr(fmt.Sprintln(args...))
log.AuditErr(fmt.Sprint(args...))
}
// captureStdlibLog captures the logs generated by log.Print*

View File

@ -504,7 +504,7 @@ func (va *ValidationAuthorityImpl) processHTTPValidation(
records := []core.ValidationRecord{baseRecord}
numRedirects := 0
processRedirect := func(req *http.Request, via []*http.Request) error {
va.log.Debugf("processing a HTTP redirect from the server to %q\n", req.URL.String())
va.log.Debugf("processing a HTTP redirect from the server to %q", req.URL.String())
// Only process up to maxRedirect redirects
if numRedirects > maxRedirect {
return berrors.ConnectionFailureError("Too many redirects")
@ -550,7 +550,7 @@ func (va *ValidationAuthorityImpl) processHTTPValidation(
if err != nil {
return err
}
va.log.Debugf("following redirect to host %q url %q\n", req.Host, req.URL.String())
va.log.Debugf("following redirect to host %q url %q", req.Host, req.URL.String())
// Replace the transport's DialContext with the new preresolvedDialer for
// the redirect.
transport.DialContext = redirDialer.DialContext