mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Compare commits
13 commits
976adc5be9
...
f9859799b2
Author | SHA1 | Date | |
---|---|---|---|
f9859799b2 | |||
|
d87e2205d6 | ||
25ee875300 | |||
4aeeca5a82 | |||
0dc449f582 | |||
11258613d5 | |||
a4918210f1 | |||
dae7d80759 | |||
91a3fc5261 | |||
821ee0a9e1 | |||
280f85abd1 | |||
932ac2be48 | |||
c78388a2cb |
7 changed files with 78 additions and 1 deletions
21
.github/workflows/govulncheck.yml
vendored
Normal file
21
.github/workflows/govulncheck.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
name: Govulncheck Security Scan
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
- name: Run govulncheck
|
||||||
|
uses: golang/govulncheck-action@3a32958c2706f7048305d5a2e53633d7e37e97d0 # v1.0.2
|
3
.github/workflows/reuse.yml
vendored
3
.github/workflows/reuse.yml
vendored
|
@ -6,6 +6,9 @@ name: REUSE Compliance Check
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
4
.github/workflows/sonarqube.yml
vendored
4
.github/workflows/sonarqube.yml
vendored
|
@ -3,6 +3,10 @@
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
name: SonarQube
|
name: SonarQube
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -55,3 +55,5 @@ com_crashlytics_export_strings.xml
|
||||||
crashlytics.properties
|
crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
fabric.properties
|
fabric.properties
|
||||||
|
|
||||||
|
testdata
|
|
@ -12,6 +12,7 @@ SPDX-License-Identifier: CC0-1.0
|
||||||
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)
|
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)
|
||||||
[![#go-mail on Discord](https://img.shields.io/badge/Discord-%23go%E2%80%93mail-blue.svg)](https://discord.gg/ysQXkaccXk)
|
[![#go-mail on Discord](https://img.shields.io/badge/Discord-%23go%E2%80%93mail-blue.svg)](https://discord.gg/ysQXkaccXk)
|
||||||
[![REUSE status](https://api.reuse.software/badge/github.com/wneessen/go-mail)](https://api.reuse.software/info/github.com/wneessen/go-mail)
|
[![REUSE status](https://api.reuse.software/badge/github.com/wneessen/go-mail)](https://api.reuse.software/info/github.com/wneessen/go-mail)
|
||||||
|
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8701/badge)](https://www.bestpractices.dev/projects/8701)
|
||||||
<a href="https://ko-fi.com/D1D24V9IX"><img src="https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/5cbed8a4ae2b88347c06c923_BuyMeACoffee_blue.png" height="20" alt="buy ma a coffee"></a>
|
<a href="https://ko-fi.com/D1D24V9IX"><img src="https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/5cbed8a4ae2b88347c06c923_BuyMeACoffee_blue.png" height="20" alt="buy ma a coffee"></a>
|
||||||
|
|
||||||
<p align="center"><img src="./assets/gopher2.svg" width="250" alt="go-mail logo"/></p>
|
<p align="center"><img src="./assets/gopher2.svg" width="250" alt="go-mail logo"/></p>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package mail
|
package mail
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -461,3 +462,20 @@ func (e errorWriter) Write([]byte) (int, error) {
|
||||||
func (e errorWriter) Close() error {
|
func (e errorWriter) Close() error {
|
||||||
return fmt.Errorf("supposed to always fail")
|
return fmt.Errorf("supposed to always fail")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FuzzBase64LineBreaker_Write(f *testing.F) {
|
||||||
|
f.Add([]byte("abc"))
|
||||||
|
f.Add([]byte("def"))
|
||||||
|
f.Add([]uint8{0o0, 0o1, 0o2, 30, 255})
|
||||||
|
buf := bytes.Buffer{}
|
||||||
|
bw := bufio.NewWriter(&buf)
|
||||||
|
f.Fuzz(func(t *testing.T, data []byte) {
|
||||||
|
b := &Base64LineBreaker{out: bw}
|
||||||
|
if _, err := b.Write(data); err != nil {
|
||||||
|
t.Errorf("failed to write to B64LineBreaker: %s", err)
|
||||||
|
}
|
||||||
|
if err := b.Close(); err != nil {
|
||||||
|
t.Errorf("failed to close B64LineBreaker: %s", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
28
msg_test.go
28
msg_test.go
|
@ -3219,3 +3219,31 @@ func TestNewMsgWithNoDefaultUserAgent(t *testing.T) {
|
||||||
t.Errorf("WithNoDefaultUserAgent() failed. Expected: %t, got: %t", true, false)
|
t.Errorf("WithNoDefaultUserAgent() failed. Expected: %t, got: %t", true, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fuzzing tests
|
||||||
|
func FuzzMsg_Subject(f *testing.F) {
|
||||||
|
f.Add("Testsubject")
|
||||||
|
f.Add("")
|
||||||
|
f.Add("This is a longer test subject.")
|
||||||
|
f.Add("Let's add some umlauts: üäöß")
|
||||||
|
f.Add("Or even emojis: ☝️💪👍")
|
||||||
|
f.Fuzz(func(t *testing.T, data string) {
|
||||||
|
m := NewMsg()
|
||||||
|
m.Subject(data)
|
||||||
|
m.Reset()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func FuzzMsg_From(f *testing.F) {
|
||||||
|
f.Add("Toni Tester <toni@tester.com>")
|
||||||
|
f.Add("<tester@example.com>")
|
||||||
|
f.Add("mail@server.com")
|
||||||
|
f.Fuzz(func(t *testing.T, data string) {
|
||||||
|
m := NewMsg()
|
||||||
|
if err := m.From(data); err != nil &&
|
||||||
|
!strings.Contains(err.Error(), "failed to parse mail address") {
|
||||||
|
t.Errorf("failed set set FROM address: %s", err)
|
||||||
|
}
|
||||||
|
m.Reset()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue