aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fixtures
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-02 17:27:07 +0200
committerDanilo M. <danix@danix.xyz>2026-08-02 17:27:07 +0200
commit35d3e4ff127b0213fa4d34f630c4a019e533a4df (patch)
tree7cf50ed64ad5886ff909ab8ab2a26d99b2d90947 /tests/fixtures
parentb61ce428d81871fbbc6261f274f20785db9d1c38 (diff)
downloadqtmaildir-35d3e4ff127b0213fa4d34f630c4a019e533a4df.tar.gz
qtmaildir-35d3e4ff127b0213fa4d34f630c4a019e533a4df.zip
feat: add MimeParser with GMime and safe attachment naming
Diffstat (limited to 'tests/fixtures')
-rw-r--r--tests/fixtures/alternative.eml16
-rw-r--r--tests/fixtures/attachment.eml18
-rw-r--r--tests/fixtures/encoded_subject.eml7
-rw-r--r--tests/fixtures/hostile_filename.eml17
-rw-r--r--tests/fixtures/inline_image.eml19
-rw-r--r--tests/fixtures/plain.eml12
-rw-r--r--tests/fixtures/truncated.eml11
7 files changed, 100 insertions, 0 deletions
diff --git a/tests/fixtures/alternative.eml b/tests/fixtures/alternative.eml
new file mode 100644
index 0000000..1c35d79
--- /dev/null
+++ b/tests/fixtures/alternative.eml
@@ -0,0 +1,16 @@
+From: Alice <alice@example.org>
+Subject: Both parts
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <alt-1@example.org>
+MIME-Version: 1.0
+Content-Type: multipart/alternative; boundary="BOUND"
+
+--BOUND
+Content-Type: text/plain; charset=utf-8
+
+plain version
+--BOUND
+Content-Type: text/html; charset=utf-8
+
+<html><body><p>html version</p></body></html>
+--BOUND--
diff --git a/tests/fixtures/attachment.eml b/tests/fixtures/attachment.eml
new file mode 100644
index 0000000..a0410e4
--- /dev/null
+++ b/tests/fixtures/attachment.eml
@@ -0,0 +1,18 @@
+From: Alice <alice@example.org>
+Subject: With attachment
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <att-1@example.org>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="MIX"
+
+--MIX
+Content-Type: text/plain; charset=utf-8
+
+see attached
+--MIX
+Content-Type: text/plain; charset=utf-8; name="notes.txt"
+Content-Disposition: attachment; filename="notes.txt"
+Content-Transfer-Encoding: quoted-printable
+
+caf=C3=A9 notes
+--MIX--
diff --git a/tests/fixtures/encoded_subject.eml b/tests/fixtures/encoded_subject.eml
new file mode 100644
index 0000000..7dcb6f8
--- /dev/null
+++ b/tests/fixtures/encoded_subject.eml
@@ -0,0 +1,7 @@
+From: =?utf-8?B?w4RsaWNl?= <alice@example.org>
+Subject: =?utf-8?Q?Caf=C3=A9_meeting?=
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <enc-1@example.org>
+Content-Type: text/plain; charset=utf-8
+
+body
diff --git a/tests/fixtures/hostile_filename.eml b/tests/fixtures/hostile_filename.eml
new file mode 100644
index 0000000..4dc79b6
--- /dev/null
+++ b/tests/fixtures/hostile_filename.eml
@@ -0,0 +1,17 @@
+From: Attacker <bad@example.org>
+Subject: Hostile attachment name
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <evil-1@example.org>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="EVIL"
+
+--EVIL
+Content-Type: text/plain; charset=utf-8
+
+body
+--EVIL
+Content-Type: text/plain; name="../../../../tmp/pwned.txt"
+Content-Disposition: attachment; filename="../../../../tmp/pwned.txt"
+
+owned
+--EVIL--
diff --git a/tests/fixtures/inline_image.eml b/tests/fixtures/inline_image.eml
new file mode 100644
index 0000000..a9dd24b
--- /dev/null
+++ b/tests/fixtures/inline_image.eml
@@ -0,0 +1,19 @@
+From: Alice <alice@example.org>
+Subject: Inline image
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <cid-1@example.org>
+MIME-Version: 1.0
+Content-Type: multipart/related; boundary="REL"
+
+--REL
+Content-Type: text/html; charset=utf-8
+
+<html><body><img src="cid:logo@example.org"></body></html>
+--REL
+Content-Type: image/png
+Content-Transfer-Encoding: base64
+Content-ID: <logo@example.org>
+
+iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9
+awAAAABJRU5ErkJggg==
+--REL--
diff --git a/tests/fixtures/plain.eml b/tests/fixtures/plain.eml
new file mode 100644
index 0000000..81f06b4
--- /dev/null
+++ b/tests/fixtures/plain.eml
@@ -0,0 +1,12 @@
+From: Alice <alice@example.org>
+To: Bob <bob@example.net>
+Subject: Plain hello
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <plain-1@example.org>
+Content-Type: text/plain; charset=utf-8
+
+Hello Bob.
+
+> quoted line
+Regards,
+Alice
diff --git a/tests/fixtures/truncated.eml b/tests/fixtures/truncated.eml
new file mode 100644
index 0000000..912a522
--- /dev/null
+++ b/tests/fixtures/truncated.eml
@@ -0,0 +1,11 @@
+From: Alice <alice@example.org>
+Subject: Truncated
+Date: Sat, 01 Aug 2026 10:00:00 +0000
+Message-ID: <trunc-1@example.org>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="CUT"
+
+--CUT
+Content-Type: text/plain; charset=utf-8
+
+this part never closes