FA-76786 / Email MIME structure / Open access
Inject a mailing-list footer without breaking the message: only mixed is extended · case 01
Signed or encrypted containers get an extra part inserted, invalidating their structure.
ROOT CAUSE
The only mixed is extended decision evaluates `if t.startswith('multipart/') and t != 'multipart/alternative':` where the contract requires `if t == 'multipart/mixed':`.
VERIFIED REPAIR
Use `if t == 'multipart/mixed':` for the only mixed is extended decision and keep every other rule of the model unchanged.
Unsuccessful approach: Excluding signed messages still modifies encrypted containers. The attempted `if t.startswith('multipart/') and t not in ('multipart/alternative', 'multipart/signed'):` still disagrees with a fixture.
Case contract
A top-level text/plain body in 7bit, 8bit or quoted-printable (default 7bit, case-insensitive) gets the footer appended in place ("text+footer"). A multipart/mixed gets a text/plain footer part appended after its children. Everything else (alternative, signed, encrypted, html, base64 text) is wrapped: mixed(<type>,text/plain). Output is a compact structure string.
Why this case matters
List managers that edit signed or encoded bodies in place break signatures and corrupt content.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(node):
t = node['type'].lower()
cte = (node.get('cte') or '7bit').lower()
if t == 'text/plain' and cte in ('7bit', '8bit', 'quoted-printable'):
return 'text+footer'
if t.startswith('multipart/') and t != 'multipart/alternative':
return 'mixed(' + ','.join(c['type'].lower() for c in node['parts']) + ',text/plain)'
return 'mixed(' + t + ',text/plain)'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,text/plain)')], 2: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,text/plain)')], 3: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,text/plain)')], 4: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,text/plain)')], 5: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,image/png,text/plain)')]}
for _label, _args, _expected in _CASES[N]:
check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| base64 text body | mixed(text/plain,text/plain) | mixed(text/plain,text/plain) | Passed |
| quoted-printable text body | text+footer | text+footer | Passed |
| signed message | mixed(text/plain,application/pgp-signature,text/plain) | mixed(multipart/signed,text/plain) | Failed |
| encrypted message | mixed(application/pgp-encrypted,application/octet-stream,text/plain) | mixed(multipart/encrypted,text/plain) | Failed |
| html body | mixed(text/html,text/plain) | mixed(text/html,text/plain) | Passed |
| enriched body | mixed(text/enriched,text/plain) | mixed(text/enriched,text/plain) | Passed |
| mixed message | mixed(text/plain,image/png,text/plain) | mixed(text/plain,image/png,text/plain) | Passed |
SHA-256 / 683a063c2329d00001899766d8e43daee7344a204e9593a07e64e98bd52e6373
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(node):
t = node['type'].lower()
cte = (node.get('cte') or '7bit').lower()
if t == 'text/plain' and cte in ('7bit', '8bit', 'quoted-printable'):
return 'text+footer'
if t.startswith('multipart/') and t not in ('multipart/alternative', 'multipart/signed'):
return 'mixed(' + ','.join(c['type'].lower() for c in node['parts']) + ',text/plain)'
return 'mixed(' + t + ',text/plain)'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,text/plain)')], 2: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,text/plain)')], 3: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,text/plain)')], 4: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,text/plain)')], 5: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,image/png,text/plain)')]}
for _label, _args, _expected in _CASES[N]:
check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| base64 text body | mixed(text/plain,text/plain) | mixed(text/plain,text/plain) | Passed |
| quoted-printable text body | text+footer | text+footer | Passed |
| signed message | mixed(multipart/signed,text/plain) | mixed(multipart/signed,text/plain) | Passed |
| encrypted message | mixed(application/pgp-encrypted,application/octet-stream,text/plain) | mixed(multipart/encrypted,text/plain) | Failed |
| html body | mixed(text/html,text/plain) | mixed(text/html,text/plain) | Passed |
| enriched body | mixed(text/enriched,text/plain) | mixed(text/enriched,text/plain) | Passed |
| mixed message | mixed(text/plain,image/png,text/plain) | mixed(text/plain,image/png,text/plain) | Passed |
SHA-256 / c0482ca7289e840a8a5205af0b66aa0aad0ac286a2581698411908f205d770dc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(node):
t = node['type'].lower()
cte = (node.get('cte') or '7bit').lower()
if t == 'text/plain' and cte in ('7bit', '8bit', 'quoted-printable'):
return 'text+footer'
if t == 'multipart/mixed':
return 'mixed(' + ','.join(c['type'].lower() for c in node['parts']) + ',text/plain)'
return 'mixed(' + t + ',text/plain)'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,text/plain)')], 2: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,text/plain)')], 3: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,text/plain)')], 4: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,text/plain)')], 5: [('base64 text body', ({'type': 'text/plain', 'cte': 'BASE64'},), 'mixed(text/plain,text/plain)'), ('quoted-printable text body', ({'type': 'text/plain', 'cte': 'quoted-printable'},), 'text+footer'), ('signed message', ({'type': 'multipart/signed', 'parts': [{'type': 'text/plain'}, {'type': 'application/pgp-signature'}]},), 'mixed(multipart/signed,text/plain)'), ('encrypted message', ({'type': 'multipart/encrypted', 'parts': [{'type': 'application/pgp-encrypted'}, {'type': 'application/octet-stream'}]},), 'mixed(multipart/encrypted,text/plain)'), ('html body', ({'type': 'text/html'},), 'mixed(text/html,text/plain)'), ('enriched body', ({'type': 'text/enriched', 'cte': '7bit'},), 'mixed(text/enriched,text/plain)'), ('mixed message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}, {'type': 'image/png'}]},), 'mixed(text/plain,image/png,image/png,image/png,image/png,image/png,text/plain)')]}
for _label, _args, _expected in _CASES[N]:
check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| base64 text body | mixed(text/plain,text/plain) | mixed(text/plain,text/plain) | Passed |
| quoted-printable text body | text+footer | text+footer | Passed |
| signed message | mixed(multipart/signed,text/plain) | mixed(multipart/signed,text/plain) | Passed |
| encrypted message | mixed(multipart/encrypted,text/plain) | mixed(multipart/encrypted,text/plain) | Passed |
| html body | mixed(text/html,text/plain) | mixed(text/html,text/plain) | Passed |
| enriched body | mixed(text/enriched,text/plain) | mixed(text/enriched,text/plain) | Passed |
| mixed message | mixed(text/plain,image/png,text/plain) | mixed(text/plain,image/png,text/plain) | Passed |
SHA-256 / aa0cf18ed62290d1a299e4e3f7be4f347f873cdf7f2a15ecedfe487c48f1cd52
Verification & scope
Stipulated offline model over pre-parsed MIME dictionaries; not a conforming MIME parser, generator or mail client. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:19.395388+00:00.
Case digest / 4e4a6fd6c13651c1f1f428c42c60d62ffd2b5990013b8cdac24b9086b5935ff5