Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-121650: Encode newlines in headers, and verify headers are sound #122233

Merged
merged 12 commits into from
Jul 30, 2024

Commits on Jul 24, 2024

  1. Verify that email headers are well-formed

    This should fail for custom fold() implementations that aren't careful
    about newlines.
    encukou committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    921cbfd View commit details
    Browse the repository at this point in the history
  2. Encode header parts that contain newlines

    Per RFC 2047:
    
    > [...] these encoding schemes allow the
    > encoding of arbitrary octet values, mail readers that implement this
    > decoding should also ensure that display of the decoded data on the
    > recipient's terminal will not cause unwanted side-effects
    
    It seems that the "quoted-word" scheme is a valid way to include
    a newline character in a header value, just like we already allow
    undecodable bytes or control characters.
    They do need to be properly quoted when serialized to text, though.
    
    ---
    
    Credit for an earlier attempt:
    
    Co-Authored-By: Bas Bloemsaat <[email protected]>
    encukou and basbloemsaat committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    bd7f922 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2024

  1. Add tests and documentation

    encukou committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    59c06c3 View commit details
    Browse the repository at this point in the history
  2. Add a blurb

    encukou committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    8e7d6f1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ef65562 View commit details
    Browse the repository at this point in the history
  4. Don't mark up True

    I'm not touching other instances in this file, since this PR might
    be backported to very old versions.
    encukou committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    64dcb44 View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2024

  1. Document HeaderWriteError

    encukou committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    af41733 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. Apply suggestions from code review

    Co-authored-by: Serhiy Storchaka <[email protected]>
    encukou and serhiy-storchaka authored Jul 30, 2024
    Configuration menu
    Copy the full SHA
    596a25b View commit details
    Browse the repository at this point in the history
  2. Add missing colon

    encukou committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    d7f5fc6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a768a81 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    eb43fe4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f793b96 View commit details
    Browse the repository at this point in the history