[MIR] libemail-mime-perl (libmail-dmarc-perl dependency)

Bug #2030880 reported by Miriam España Acebal
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libemail-mime-perl (Ubuntu)
In Progress
Undecided
Unassigned

Bug Description

[Availability]
The package libemail-mime-perl is already in Ubuntu universe.
The package libemail-mime-perl build for the architectures it is designed to work on.
It currently builds and works for architectures: amd64 (all)
Link to package https://launchpad.net/ubuntu/+source/libemail-mime-perl

[Rationale]
The package libemail-mime-perl is required in Ubuntu main for libmail-dmarc-perl.
The package libemail-mime-perl will not generally be useful for a large part of
our user base, but is important/helpful still because libmail-dmarc-perl requires it as a runtime dependency
( libmail-dmarc-perl is in the MIR process here: https://bugs.launchpad.net/ubuntu/+source/libmail-dmarc-perl/+bug/2023971 )

The package libemail-mime-perl is required in Ubuntu main no later than through the same scheduled requested
for the libmail-dmarc-perl promotion, since libmail-dmarc-perl depends on it.

[Security]
No CVEs/security issues in this software in the past.
No `suid` or `sgid` binaries.
No executables in `/sbin` and `/usr/sbin`.
Package does not install services, timers or recurring jobs.
Package does not open privileged ports (ports < 1024).
Package does not expose any external endpoints.
Package does not contain extensions to security-sensitive software (filters, scanners, plugins, UI skins, ...), except
that it is in esence a MIME parser module.

[Quality assurance - function/usage]
The package works well right after install

[Quality assurance - maintenance]
The package is maintained well in Debian/Ubuntu/Upstream and does
not have too many, long-term & critical, open bugs:
   - Ubuntu (0) https://bugs.launchpad.net/ubuntu/+source/libemail-mime-perl/+bug
   - Debian (3) https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=libemail-mime-perl
   - Upstream's bug tracker (11) https://github.com/rjbs/Email-MIME/issues
     + Upstream's repo last activity:
       - commit: in main, Jan 9 2023
       - updated issue: Jan 12 2023
       - fixed/closed issue: Jan 12 2023
The package has important open bugs, listing them:
   - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960062 libemail-mime-perl: DoS on excessive or deeply nested parts
        This is also discussed upstream at https://github.com/rjbs/Email-MIME/issues/66
        and it seems to be "resolved" as per the changelog:

        1.947 2020-05-09 14:30:06-04:00 America/New_York (TRIAL RELEASE)
        - add $Email::MIME::MAX_DEPTH and refuse to parse deeper than that many
          parts; current default: 10

        but the commits relative to it for the tag 1.947 doesn't reference issue #66.
The package does not deal with exotic hardware we cannot support

[Quality assurance - testing]
The package runs a test suite on build time, if it fails
it makes the build fail: https://launchpadlibrarian.net/646110276/buildlog_ubuntu-lunar-amd64.libemail-mime-perl_1.953-1_BUILDING.txt.gz :

    make[1]: Leaving directory '/<<PKGBUILDDIR>>'
       dh_auto_test
     make -j4 test TEST_VERBOSE=1
    make[1]: Entering directory '/<<PKGBUILDDIR>>'
    PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t

The package runs an autopkgtest (via autodep8 using 'Testsuite: autopkgtest-pkg-perl' in d/control file ),
that runs essentialy the above build-time test suite.It is currently passing on
this list of architectures (amd64, arm64, armhf, ppc64el, riscv64, s390x), except on i386: https://autopkgtest.ubuntu.com/packages/l/libemail-mime-perl

The package does have failing autopkgtests tests right now, but since
they always failed they are handled as "ignored failure", this is
because the package the test depends on pkg-perl-tools package that is not
build for i386 since focal.

[Quality assurance - packaging]
debian/watch is present and works.

debian/control defines a correct Maintainer field : Debian Perl Group <email address hidden>

This package does not yield massive lintian Warnings, Errors
  - recent build log of the package https://launchpadlibrarian.net/646110276/buildlog_ubuntu-lunar-amd64.libemail-mime-perl_1.953-1_BUILDING.txt.gz
  - full output from `lintian --pedantic` :
    # source
    ❯ lintian -EvIL +pedantic --show-overrides
E: libemail-mime-perl changes: bad-distribution-in-changes-file mantic
W: libemail-mime-perl: changelog-distribution-does-not-match-changes-file (unstable != mantic)
W: libemail-mime-perl changes: distribution-and-changes-mismatch mantic unstable
    #binary
      ❯ lintian -EvIL +pedantic --show-overrides ../libemail-mime-perl_1.953-1.dsc
        W: libemail-mime-perl source: newer-standards-version 4.6.2 (current is 4.6.0.1)
        X: libemail-mime-perl source: debian-watch-does-not-check-gpg-signature [debian/watch]
  - Lintian overrides are not present

This package does not rely on obsolete or about to be demoted packages.
This package has no python2 or GTK2 dependencies.

The package will not be installed by default.

Packaging and build is easy, link to debian/rules: https://git.launchpad.net/ubuntu/+source/libemail-mime-perl/tree/debian/rules

[UI standards]
Application is not end-user facing (does not need translation).

[Dependencies]
There are further dependencies that are not yet in main. Checking recursive dependencies. MIR bugs will be opened for them:

   - libemail-messageid-perl: universe. No further depends or recommends dependencies that are not yet in main.
     + MIR bug: https://bugs.launchpad.net/ubuntu/+source/libemail-messageid-perl/+bug/2030956
   - libemail-mime-contenttype-perl: universe. Depends on universe package libtext-unidecode-perl.
     + MIR bug: https://bugs.launchpad.net/ubuntu/+source/libemail-mime-contenttype-perl/+bug/2030962
     -> libtext-unidecode-perl: No further depends or recommends dependencies that are not yet in main.
     + MIR bug: https://bugs.launchpad.net/ubuntu/+source/libtext-unidecode-perl/+bug/2031109
   - libemail-mime-encodings-perl: universe. No further depends or recommends dependencies that are not yet in main.
     + MIR bug: https://bugs.launchpad.net/ubuntu/+source/libemail-mime-encodings-perl/+bug/2031487
   - libemail-simple-perl: universe. No further depends or recommends dependencies that are not yet in main.
     + MIR bug https://bugs.launchpad.net/ubuntu/+source/libemail-simple-perl/+bug/2031491

[Standards compliance]
This package correctly follows FHS and Debian Policy (4.6.2)

[Maintenance/Owner]
Owning Team will be Ubuntu Server Team.
Team is not yet, but will subscribe to the package before promotion.
This does not use static builds.
This does not use vendored code.
This package is not rust based.

The package successfully built during the most recent test rebuild : https://launchpad.net/ubuntu/+archive/test-rebuild-20230515-lunar-v3/+build/26135438/+files/buildlog_ubuntu-lunar-amd64.libemail-mime-perl_1.953-1_BUILDING.txt.gz

[Background information]
The Package description explains the package well.
Upstream Name is Email-MIME .
Link to upstream project https://metacpan.org/dist/Email-MIME

This has been in the archive since at least 2006. It's never had a bug filed against it in Launchpad.

Tags: sec-2671
description: updated
description: updated
description: updated
description: updated
description: updated
Changed in libemail-mime-perl (Ubuntu):
assignee: nobody → Lukas Märdian (slyon)
Revision history for this message
Lukas Märdian (slyon) wrote :
Download full text (4.8 KiB)

Review for Source Package: libemail-mime-perl

[Summary]
A Perl module for parsing MIME messages.

MIR team ACK under the constraint to resolve the below listed
required TODOs and as much as possible having a look at the
recommended TODOs.

This does need a security review, so I'll assign ubuntu-security

List of specific binary packages to be promoted to main: libemail-mime-perl
Specific binary packages built, but NOT to be promoted to main: None

Notes:
#0 This is a MIME parser, which could also deal with de-/encryption in a secure email context, I'm therefore requesting security review.

Required TODOs:
#1 other Dependencies to MIR due to this
 * bug #2030956, libemail-messageid-perl binary and source package is in universe
 * bug #2030962 (done), libemail-mime-contenttype-perl binary and source package is in universe
 * bug #2031487 (done), libemail-mime-encodings-perl binary and source package is in universe
 * bug #2031491 (pending), libemail-simple-perl binary and source package is in universe
#2 Potential duplicates in "main": libmime-lite-perl & libmime-tools-perl
=> Could you please differentiate those from this package, or consider if they could be used instead?
#3 Thanks for your analysis of this bug report, can you please clarify the verdict (is it fixed)? Please try to reproduce this or check back with the maintainer(s).
=> https://bugs.debian.org/960062 "DoS on excessive or deeply nested parts"
=> https://github.com/rjbs/Email-MIME/issues/66

Recommended TODOs:
#4 The package should get a team bug subscriber before being promoted

[Duplication]
Here are some potential duplicates, two of them in "main" already. Could you please differentiate those from this package, or consider if they could be used instead?

$ rmadison -c main -s mantic {libmime-lite-perl,libmime-tools-perl,libmime-explode-perl}
 libmime-lite-perl | 3.033-1 | mantic | source, all
 libmime-tools-perl | 5.510-3 | mantic | source, all

[Dependencies]
OK:
- no -dev/-debug/-doc packages that need exclusion
- No dependencies in main that are only superficially tested requiring
  more tests now.

Problems:
- other Dependencies to MIR due to this
 * bug #2030956, libemail-messageid-perl binary and source package is in universe
 * bug #2030962 (done), libemail-mime-contenttype-perl binary and source package is in universe
 * bug #2031487 (done), libemail-mime-encodings-perl binary and source package is in universe
 * bug #2031491 (pending), libemail-simple-perl binary and source package is in universe

[Embedded sources and static linking]
OK:
- no embedded source present
- no static linking
- does not have unexpected Built-Using entries
- not a go package, no extra constraints to consider in that regard
- not a rust package, no extra constraints to consider in that regard

Problems: None

[Security]
OK:
- history of CVEs does not look concerning
- does not run a daemon as root
- does not use webkit1,2
- does not use lib*v8 directly
- does not expose any external endpoint (port/socket/... or similar)
- does not process arbitrary web content
- does not use centralized online accounts
- does not integrate arbitrary javascript into the desktop
- does not deal with syste...

Read more...

Changed in libemail-mime-perl (Ubuntu):
status: New → Incomplete
assignee: Lukas Märdian (slyon) → Miriam España Acebal (mirespace)
tags: added: sec-2671
Revision history for this message
Miriam España Acebal (mirespace) wrote (last edit ):

For #3, I also added a comment to the Debian bug [1] about the DoS issue, without answer, after I saw Lukas went to upstream for the same reason (thanks!).

So, because the no-answer to the above, I decided to go for #2 refactoring libmail-dmarc-perl to use libmime-tools-perl. I did it here:

ppa:mirespace/libmail-dmarc-perl-suggested
https://launchpad.net/~mirespace/+archive/ubuntu/libmail-dmarc-perl-suggested

for checking the differences (because I'm building tests and other refactors in that package) this is the commit:

https://git.launchpad.net/~mirespace/ubuntu/+source/libmail-dmarc-perl/commit/?id=a212e3544f6c05983feb931161337b817bfc7663

I think it's ok, the tests passed, but I'll appreciate an extra pair of eyes that could review that change.

Also, MIME::Parser and MIME::Entity uses the code of MAIL::Internet underneath. To make the less disruption possible, I didn't replace the use of libmail-simple-perl by MAIL::Internet (but It can be studied). I had to explicitly add the libmail-simple-perl dependency indeed.

If #2 is accepted, this MIR can be cancelled/on-hold.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960062

Changed in libemail-mime-perl (Ubuntu):
status: Incomplete → New
Changed in libemail-mime-perl (Ubuntu):
assignee: Miriam España Acebal (mirespace) → nobody
Lukas Märdian (slyon)
Changed in libemail-mime-perl (Ubuntu):
assignee: nobody → Lukas Märdian (slyon)
Revision history for this message
Lukas Märdian (slyon) wrote :

I'm not an expert on Perl code, but your patch in d/p/use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch LGTM!

Unfortunately, we don't have an autopkgtest baseline (libmail-dmarc-perl didn't have any autopkgtests before). But I like seeing new ones being added.

We do have a baseline of build-time tests in dh_auto_test, though, which looks very promissing, as everything passes, as before:
```
All tests successful.
Files=20, Tests=652, 5 wallclock secs ( 0.08 usr 0.01 sys + 4.06 cusr 0.42 csys = 4.57 CPU)
Result: PASS
```

Some general remarks on your "noble-splitting-dependencies" branch:
* debian/control has some whitespace/indentation issues on the new dependencies (tabs vs spaces?)
* Take care not to leak personal data (email address) in d/t/data/ -- This will be public information and spam bots might parse it (ironically for the spam filter tests ;-))
* Have you considered proposing your changes/patch to upstream libmail-dmarc-perl? Considering that there's little maintainer or upstream activity on the bug report in #3 they might be interested in switching away from those dependencies, too. We should not block on this, but maybe it could be forwarded in parallel, to get some additional input on the perl patch.

I'll be marking this MIR bug report as WONTFIX, since we're moving towards #2 (MIME::Parser and MIME::Entity). It can be re-opened should this approach change.

Changed in libemail-mime-perl (Ubuntu):
assignee: Lukas Märdian (slyon) → nobody
status: New → Won't Fix
Revision history for this message
Miriam España Acebal (mirespace) wrote (last edit ):

Hi Lukas! Thank you for the review of the patch and the remarks.

I open an issue on upstream forwarding the patch for the refactor: https://github.com/msimerson/mail-dmarc/issues/216 .

I didn't realize I left 2 eml files for the tests on /d/t/data ... thankyou! I erased them . All the rest on data/nice and data/spam are taken from spamassassin tests itself, so I think we are good with them (at least, as good as spamassassin).

I'll correct the indentation, sorry for this.

Thanks again for helping me to polish the package's changes.

Revision history for this message
Mark Esler (eslerm) wrote :

Per MIR Team's #3 requirement, the described issue was patched on May 20th 2020 (although the GH bug remains open). There are three commits: a fix, a test, and documentation. These landed in upstream version 1.947.

Please see https://github.com/rjbs/Email-MIME/issues/66#issuecomment-2019041975

Revision history for this message
Miha Purg (mihap) wrote :
Download full text (5.8 KiB)

I reviewed libemail-mime-perl 1.953-1 as checked into noble. This shouldn't be
considered a full audit but rather a quick gauge of maintainability.

libemail-mime-perl is a Perl module (Email::MIME), an extension of the
Email::Simple module, to handle MIME encoded messages. It takes a message
as a string, splits it up into its constituent parts, and allows one to access
to various parts of the message. Headers are decoded from MIME encoding.

The main use of the module is libmail-dmarc-perl (a dependency for Spamassassin),
specifically, its *reporting* functionality, as implemented in the command-line
tools `dmarc_receive` and `dmarc_send`.
Although the module is loaded automatically when using any libmail-dmarc-perl,
Spamassassin itself does not use the MIME functionality.

- CVE History
  - No reported CVEs
  - Open security issues:
    - https://github.com/rjbs/Email-MIME/issues/66
      (largely fixed - there are potentially still unresolved issues, see below)

- Build-Depends
  - This library is an extension of the `Email::Simple` library (same maintainer),
    which already received a conditional ACK:
    - https://github.com/rjbs/Email-Simple
    - https://bugs.launchpad.net/ubuntu/+source/libemail-simple-perl/+bug/2031491
  - For processing of data it largely depends on the `Email::MIME::ContentType`,
    `Email::MessageID` and `Email::MIME::Encodings` libraries (mostly same maintainer)
    which are also undergoing an MIR review but were not assigned a security review:
    - https://github.com/rjbs/Email-MIME-ContentType
    - https://github.com/rjbs/Email-MIME-Encodings
    - https://github.com/rjbs/Email-MessageID
    - https://bugs.launchpad.net/ubuntu/+source/libemail-mime-contenttype-perl/+bug/2030962
    - https://bugs.launchpad.net/ubuntu/+source/libemail-mime-encodings-perl/+bug/2031487
    - https://bugs.launchpad.net/ubuntu/+source/libemail-messageid-perl/+bug/2030956
    - https://metacpan.org/pod/Text::Unidecode
    - https://bugs.launchpad.net/ubuntu/+source/libtext-unidecode-perl/+bug/2031109
  - The processing of data in libemail-mime-perl to a large extent relies on external
    dependecies above, which are not in scope of this review. Despite this the parsing and
    validation of MIME attributes was briefly reviewed in libemail-mime-contenttype-perl.
- pre/post inst/rm scripts
  - none
- init scripts
  - none
- systemd units
  - none
- dbus services
  - none
- setuid binaries
  - none
- binaries in PATH
  - none
- sudo fragments
  - none
- polkit files
  - none
- udev rules
  - none
- unit tests / autopkgtests
  - All unit tests pass locally
- cron jobs
  - none
- Build logs
  - none

- Processes spawned
  - none
- Memory management
  - none
- File IO
  - none
- Logging
  - none
- Environment variable usage
  - none
- Use of privileged functions
  - none
- Use of cryptography / random number sources etc
  - none
- Use of temp files
  - none
- Use of networking
  - The library is used as an extension to Email::Simple to create and parse email
    MIME parts, thus its main function is the processing of potentially unsafe
    data from untrusted external sources - email,
  - The main use of the library is `libmail-d...

Read more...

Revision history for this message
Mark Esler (eslerm) wrote :
Changed in libemail-mime-perl (Ubuntu):
status: Won't Fix → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.