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

Escaped characters in email address #3465

Closed
kingqueen3065 opened this issue Aug 24, 2016 · 34 comments
Closed

Escaped characters in email address #3465

kingqueen3065 opened this issue Aug 24, 2016 · 34 comments
Labels
bug Breaks expected functionality f:framework reduce-admin Reduce issues coming to us in the first place user-experience x:uk

Comments

@kingqueen3065
Copy link
Collaborator

kingqueen3065 commented Aug 24, 2016

This https://www.whatdotheyknow.com/request/foster_care_allowances_935#incoming-858469 suggests that Alaveteli escaped email address Firstname.O'[email protected] to Firstname.O\'[email protected]

though it may have been the receiving MTA that did this, also the email did eventually get through

@garethrees
Copy link
Member

Looks like the followup was sent to the "bad" address https://www.whatdotheyknow.com/request/foster_care_allowances_935#outgoing-573269

@lizconlan
Copy link

Hmm, we are storing this properly and we generate a valid header in the form:

<From: Test User <fake@localhost>>, <To: O'Rly Books <O'[email protected]>>

From examining the logs, the Exim MTA appears to have hedged its bets and sent to both forms of the address (e.g. O'Rly.Books and O\\'Rly.Books) which is a little weird but explains why we got two "Message accepted for delivery" log messages, and two autoresponses - an out of office and a bounceback.

Truncated, obfuscated initial mail log line:

from <[REDACTED]@whatdotheyknow.com> for O\\'[email protected] O'[email protected]

@lizconlan
Copy link

Not having much luck finding any references to this behaviour online, maybe it's acceptable? Could it be a stray rewriting rule?

@garethrees
Copy link
Member

Might be something that @sagepe or someone in #sysadmin knows about – have you asked there?

@crowbot
Copy link
Member

crowbot commented Dec 20, 2016

This is also occurring with an ampersand in the local part of an authority email. @sagepe has investigated and thinks that Alaveteli is submitting the escaped email address as an argument on the command line (exim extracts the unescaped one from the body of the email and sends to both). Looks like the culprit is a combination of the mail gem, which puts the unescaped address on the command line, and action_mailer, which is supplying the -t argument, causing exim to parse the command line for recipients.

Looks like the Rails action_mailer behaviour changes in release 4.2, so this may be resolved by #2968.

@crowbot
Copy link
Member

crowbot commented Dec 20, 2016

The change in 4.2 would also allow us to remove extract_addresses_remove_arguments=false from our exim config instructions.

@crowbot
Copy link
Member

crowbot commented Dec 20, 2016

I think (see mikel/mail#70) we might also be able to fix this by switching the delivery_method to exim from sendmail now, as the exim delivery method in mail does not put the destination address on the command line

@crowbot
Copy link
Member

crowbot commented Dec 20, 2016

I think the reason the -t flag is there in the first place is in order to set the envelope-sender.

@MattK1234
Copy link
Collaborator

Another instance of this issue at request 721462 on WDTK.

foi&dparequest@[DOMAIN]

PR raised at mysociety/whatdotheyknow-theme#771 to prevent replies being sent to this email address. Will write to the user now to request they send their reply again.

@RichardTaylor
Copy link

@RichardTaylor
Copy link

Further example of a public body using an & in an email address and this breaking functionality at:

https://www.whatdotheyknow.com/request/planned_works_3#incoming-1758519

@crowbot
Copy link
Member

crowbot commented Aug 17, 2021

@RichardTaylor
Copy link

@sallytay
Copy link

sallytay commented Apr 4, 2022

Another example of this here: The occurrence of an apostrophe apparently breaking the ability to send a reply on the thread.

https://www.whatdotheyknow.com/request/staff_broken_down_by_declared_et#incoming-2005661

@RichardTaylor
Copy link

https://www.whatdotheyknow.com/request/contracted_printing_devices_and_1028#incoming-2062858

This is an example of this issue occurring in slightly different context, attempting to use an apostrophe in a request_address

It appears using an apostrophe in the request address resulted in Alaveteli unexpectedly sending mail to an address containing \' rather than just '.

@FOIMonkey
Copy link
Collaborator

@HelenWDTK
Copy link
Contributor

+1 We've had another example of this because the reply address contained an ampersand.

@HelenWDTK
Copy link
Contributor

+1 Another one with an ampersand

@WilliamWDTK
Copy link
Collaborator

I'm not sure if this is completely related, but we have an issue with failed complete automatic redaction of an email address due to the presence of an apostrophe, where only the part after the apostrophe was automatically removed.

https://www.whatdotheyknow.com/request/pay_scales_and_job_titles_in_use#incoming-2260741

@HelenWDTK
Copy link
Contributor

+1 Cropped up again today with an O' surname

@HelenWDTK
Copy link
Contributor

+1 an & this time.

@gbp
Copy link
Member

gbp commented Apr 24, 2024

Attempted to replicate this issue using a gmail "+ address" with an &. I was able to receive mail into WDTK and send a followup from WDTK successfully.

@HelenWDTK
Copy link
Contributor

Had another occurrence of this today with an &

@garethrees
Copy link
Member

This is desirable, but unlikely to be worked on in the next 12 months so closing for now.

@garethrees garethrees closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Breaks expected functionality f:framework reduce-admin Reduce issues coming to us in the first place user-experience x:uk
Projects
None yet
Development

No branches or pull requests