• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-pkgz / email / 32195200143
93%

Build:
DEFAULT BRANCH: master
Ran 18 Aug 2026 10:59PM UTC
Jobs 1
Files 3
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 Aug 2026 10:59PM UTC coverage: 94.15% (+2.5%) from 91.617%
32195200143

push

github

web-flow
Reject header injection and report smtp delivery failures (#27)

* Reject CR and LF in email header values

Previously, From, To, Subject, UnsubscribeLink and InReplyTo were copied
into the generated message as is, so a value with CR or LF terminated its
header and let the caller's input add arbitrary headers and a body of its
own. With a user-supplied recipient address that means an attacker chooses
the subject and the HTML body of a message sent from the configured sender.

After this change, buildMessage validates every user-provided header value
and Send builds the message before it connects, so a rejected message never
reaches the server.

* Report smtp delivery failures and close attachment files on error paths

Previously, the error from closing the message writer was only logged, and
net/smtp reports the final response to the DATA command exactly there, so
a message rejected by the server for policy, quota or size was reported to
the caller as sent. After this change, the error is returned and Quit is
skipped for a message the server did not accept.

Per-file work in writeFiles moved into its own function, so an attachment
is closed when reading, part creation, seeking or encoding fails, not only
on the success path.

* Keep closing a client set with the SMTP option on early returns

Validating the recipients and building the message before the connection
moved those returns above the deferred cleanup, so a client injected with
the SMTP option was left open when there were no recipients or the message
could not be built, against the documented "always closes client" contract.

The cleanup is installed first now, and the client is still made only after
the message is built, so a bad message still opens no connection.

73 of 77 new or added lines in 1 file covered. (94.81%)

2 existing lines in 1 file now uncovered.

338 of 359 relevant lines covered (94.15%)

17.21 hits per line

Uncovered Changes

Lines Coverage ∆ File
4
92.78
3.31% email.go

Coverage Regressions

Lines Coverage ∆ File
2
92.78
3.31% email.go
Jobs
ID Job ID Ran Files Coverage
1 32195200143.1 18 Aug 2026 10:59PM UTC 3
94.15
GitHub Action Run
Source Files on build 32195200143
  • Tree
  • List 3
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 3a109305 on github
  • Prev Build on refs/tags/v0.7.0 (#32083844808)
  • Next Build on master (#32195276346)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc