Skip to content

Commit

Permalink
fix: Stripping X-Gophish
Browse files Browse the repository at this point in the history
  • Loading branch information
Touexe committed Feb 20, 2024
1 parent edafbd0 commit bc56edb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion models/email_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (s *EmailRequest) Generate(msg *gomail.Message) error {
// Add the transparency headers
msg.SetHeader("X-Mailer", config.ServerName)
if conf.ContactAddress != "" {
msg.SetHeader("X-Gophish-Contact", conf.ContactAddress)
msg.SetHeader("X-Contact", conf.ContactAddress)
}

// Parse the customHeader templates
Expand Down
2 changes: 1 addition & 1 deletion models/email_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (s *ModelsSuite) TestEmailRequestGenerate(ch *check.C) {
s.config.ContactAddress = "[email protected]"
expectedHeaders := map[string]string{
"X-Mailer": config.ServerName,
"X-Gophish-Contact": s.config.ContactAddress,
"X-Contact": s.config.ContactAddress,
}

msg := gomail.NewMessage()
Expand Down
2 changes: 1 addition & 1 deletion models/maillog.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (m *MailLog) Generate(msg *gomail.Message) error {
// Add the transparency headers
msg.SetHeader("X-Mailer", config.ServerName)
if conf.ContactAddress != "" {
msg.SetHeader("X-Gophish-Contact", conf.ContactAddress)
msg.SetHeader("X-Contact", conf.ContactAddress)
}

// Add Message-Id header as described in RFC 2822.
Expand Down
6 changes: 3 additions & 3 deletions models/maillog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (s *ModelsSuite) TestMailLogGenerateTransparencyHeaders(ch *check.C) {
s.config.ContactAddress = "[email protected]"
expectedHeaders := map[string]string{
"X-Mailer": config.ServerName,
"X-Gophish-Contact": s.config.ContactAddress,
"X-Contact": s.config.ContactAddress,
}
campaign := s.createCampaign(ch)
got := s.emailFromFirstMailLog(campaign, ch)
Expand All @@ -279,15 +279,15 @@ func (s *ModelsSuite) TestMailLogGenerateTransparencyHeaders(ch *check.C) {
func (s *ModelsSuite) TestMailLogGenerateOverrideTransparencyHeaders(ch *check.C) {
expectedHeaders := map[string]string{
"X-Mailer": "",
"X-Gophish-Contact": "",
"X-Contact": "",
}
smtp := SMTP{
Name: "Test SMTP",
Host: "1.1.1.1:25",
FromAddress: "[email protected]",
UserId: 1,
Headers: []Header{
Header{Key: "X-Gophish-Contact", Value: ""},
Header{Key: "X-Contact", Value: ""},
Header{Key: "X-Mailer", Value: ""},
},
}
Expand Down

0 comments on commit bc56edb

Please sign in to comment.