File tree 3 files changed +10
-8
lines changed
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package task_logger
2
2
3
3
import (
4
4
"os/exec"
5
- "strings"
6
5
"time"
7
6
)
8
7
@@ -53,9 +52,11 @@ func (s TaskStatus) Format() (res string) {
53
52
res += "⏹️"
54
53
case TaskWaitingConfirmation :
55
54
res += "⚠️"
55
+ default :
56
+ res += "❓"
56
57
}
57
- res += strings . ToUpper ( string ( s ))
58
-
58
+ // to avoid email content injection issue
59
+ //res += strings.ToUpper(string(s))
59
60
return
60
61
}
61
62
Original file line number Diff line number Diff line change 4
4
"bytes"
5
5
"embed"
6
6
"fmt"
7
- "html"
8
7
"net/http"
9
8
"strconv"
10
9
"text/template"
@@ -48,15 +47,15 @@ func (t *TaskRunner) sendMailAlert() {
48
47
author , version := t .alertInfos ()
49
48
50
49
alert := Alert {
51
- Name : html . EscapeString ( t .Template .Name ) ,
50
+ Name : t .Template .Name ,
52
51
Author : author ,
53
52
Color : t .alertColor ("email" ),
54
53
Task : alertTask {
55
54
ID : strconv .Itoa (t .Task .ID ),
56
55
URL : t .taskLink (),
57
- Result : html . EscapeString ( t .Task .Status .Format () ),
56
+ Result : t .Task .Status .Format (),
58
57
Version : version ,
59
- Desc : html . EscapeString ( t .Task .Message ) ,
58
+ Desc : t .Task .Message ,
60
59
},
61
60
}
62
61
@@ -100,7 +99,7 @@ func (t *TaskRunner) sendMailAlert() {
100
99
util .Config .EmailPassword ,
101
100
util .Config .EmailSender ,
102
101
user .Email ,
103
- fmt .Sprintf ("Task '%s' failed" , html . EscapeString ( t .Template .Name ) ),
102
+ fmt .Sprintf ("Task '%s' failed" , t .Template .Name ),
104
103
body .String (),
105
104
); err != nil {
106
105
util .LogError (err )
Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ func TestValidateConfig(t *testing.T) {
388
388
var testDbDialect = DbDriverBolt
389
389
var testCookieHash = "0Sn+edH3doJ4EO4Rl49Y0KrxjUkXuVtR5zKHGGWerxQ="
390
390
var testMaxParallelTasks = 0
391
+ var testEmailTlsMinVersion = "1.2"
391
392
392
393
Config .Port = testPort
393
394
Config .Dialect = testDbDialect
@@ -396,6 +397,7 @@ func TestValidateConfig(t *testing.T) {
396
397
Config .GitClientId = GoGitClientId
397
398
Config .CookieEncryption = testCookieHash
398
399
Config .AccessKeyEncryption = testCookieHash
400
+ Config .EmailTlsMinVersion = testEmailTlsMinVersion
399
401
validateConfig ()
400
402
401
403
Config .Port = "INVALID"
You can’t perform that action at this time.
0 commit comments