fix GHSA-6g9p-wv47-4fxq
This commit is contained in:
parent
5a366cd62b
commit
8f89e12e6c
@ -13,7 +13,7 @@ func request(project *LogProject, method, uri string, headers map[string]string,
|
||||
|
||||
// The caller should provide 'x-sls-bodyrawsize' header
|
||||
if _, ok := headers["x-sls-bodyrawsize"]; !ok {
|
||||
err = fmt.Errorf("Can't find 'x-sls-bodyrawsize' header")
|
||||
err = fmt.Errorf("can't find 'x-sls-bodyrawsize' header")
|
||||
return
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func request(project *LogProject, method, uri string, headers map[string]string,
|
||||
headers["Content-MD5"] = bodyMD5
|
||||
|
||||
if _, ok := headers["Content-Type"]; !ok {
|
||||
err = fmt.Errorf("Can't find 'Content-Type' header")
|
||||
err = fmt.Errorf("can't find 'Content-Type' header")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,13 +32,16 @@ type SMTPWriter struct {
|
||||
FromAddress string `json:"fromAddress"`
|
||||
RecipientAddresses []string `json:"sendTos"`
|
||||
Level int `json:"level"`
|
||||
// InsecureSkipVerify default value: true
|
||||
InsecureSkipVerify bool `json:"insecureSkipVerify"`
|
||||
|
||||
formatter LogFormatter
|
||||
Formatter string `json:"formatter"`
|
||||
}
|
||||
|
||||
// NewSMTPWriter creates the smtp writer.
|
||||
func newSMTPWriter() Logger {
|
||||
res := &SMTPWriter{Level: LevelTrace}
|
||||
res := &SMTPWriter{Level: LevelTrace, InsecureSkipVerify: true}
|
||||
res.formatter = res
|
||||
return res
|
||||
}
|
||||
@ -53,7 +56,8 @@ func newSMTPWriter() Logger {
|
||||
// "subject":"email title",
|
||||
// "fromAddress":"from@example.com",
|
||||
// "sendTos":["email1","email2"],
|
||||
// "level":LevelError
|
||||
// "level":LevelError,
|
||||
// "insecureSkipVerify": false
|
||||
// }
|
||||
func (s *SMTPWriter) Init(config string) error {
|
||||
res := json.Unmarshal([]byte(config), s)
|
||||
@ -91,7 +95,7 @@ func (s *SMTPWriter) sendMail(hostAddressWithPort string, auth smtp.Auth, fromAd
|
||||
|
||||
host, _, _ := net.SplitHostPort(hostAddressWithPort)
|
||||
tlsConn := &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
InsecureSkipVerify: s.InsecureSkipVerify,
|
||||
ServerName: host,
|
||||
}
|
||||
if err = client.StartTLS(tlsConn); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user