Repository navigation
Conversation
4210d5a to
1ba904d
Compare
|
The edit_cred pause_2017 test is failing. I can't really tell why. I'll look into it more sometime soon, but maybe somebody (charsbar… 😉) can tell. I did edit |
6fb897a to
abc40d4
Compare
|
This may be ready for review… |
197460c to
6f7b302
Compare
|
Hi @rjbs, what do you think about this pull request ATM? Could it be applied as it is? Would it be possible for you to resolve the four conflicts listed above? Actually only one of the four conflicts needs resolution, the three conflicts in the pause_1999 directory have resolved by removing that whole directory. |
|
cf. #537 which you might also want to address in this PR. |
ADMINS was an array reference. CONTACT_ADDRESS is a single address.
We just use ['modules@perl.org'] as ADMINS, and do things like
interpolate it into strings, meaning that if we had two addresses, we
would get:
Just email user@example.com other@example.mil
…which is weird. Also, having to deal with joining the ADMINS arrayref
is just a pain. Instead, make it one string!
ADMIN is the address that many emails are sent from. Now that the code will use this setting to make address objects, leaving it undef will not do! We get warnings. CONTACT_ADDRESS is the setting where we usually put "modules@perl.org", where we tell people to send the admins mail. We will want to check this in PAUSE daemon tests.
* admin_email_list - a List containing the emails in the ADMIN config * email_list - given Email::Address::XS objects, make a List * fromaddr_email_list - a List containing the email in the UPLOAD config * is_valid_email - test whether a string is a single valid email address
There is a fair bit of rewriting here, hopefully making the code clearer. The most important part, though, is adding the ->email_header_object method, which will give us an Add object suitable for passing into header constructors.
This is a test run for things to come. In most places, we only use the user email address, not their name. But in some places, most especially in paused, we use their name. There were two problems there: 1. we were using the ASCII name, which we really don't need to do 2. we were not escaping any quotes (or anything else) in the name field, which could cause problems if someone puts a double quote in their fullname It wasn't trivial to test and fix those locations because we don't (yet!) have any tests for paused. This introduces the use of fullname to mldistwatch, using the new form: get the PAUSE::MailAddress for the user, then use its ->email_header_object method to create a Email::MIME::Header::AddressList. We'll switch all the mailing to use this, soon.
I could not yet remove Email::Address, because we use its $addr_spec, which is easy, but not trivial, to replace.
UPLOAD will become NOREPLY_ADDRESS soon.
I don't know this code well, so this may be a bit of a wreck.
First, `$mgr->prepare_sendto` is updated.
1. prefer fullname to asciiname, because it is more polite
2. use real email header generation, not just concat
3. if we had "Bob <x@y>" and "Alice <x@y>" we now only send one email,
not one per unique phrase; I think this is fine
Where the prepare_sendto code was basically duplicated, I have switched
things to use prepare_sendto.
Internal report emails now go to the internal reporting address, not the
public contact address.
In some places, the code was quite tough for me to read, so I just left
`$email` and the like used. This should work fine. It would be nice to
add phases later.
**I didn't understand this**: `$pause->{send_to}`. That was being set
to a string, but I don't know really why or how it was used, although I
saw some hints. The new code would've put ARRAY(0x1234) in that, so I
changed the text. I will seek advice.
This is the address a user is told to write to when their upload URI can't be recognized, so it should be the public contact address. Co-Authored-By: Claude <noreply@anthropic.com>
INTERNAL_REPORT_ADDRESS is where the software sends reports for the admins to read. It is not where we should tell users to write, and it should not appear on the public whois page or in the welcome email. CONTACT_ADDRESS exists for exactly that, so use it everywhere a human other than an admin will see the address. Co-Authored-By: Claude <noreply@anthropic.com>
The report address lives in INTERNAL_REPORT_ADDRESS now, but the error message still said ADMIN. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
All the header objects are built by PAUSE::Email and PAUSE::MailAddress, so dist.pm does not need these classes itself. Co-Authored-By: Claude <noreply@anthropic.com>
PAUSE::MailAddress called Encode and PAUSE::Email without loading either, and several pause_2017 files and paused called into PAUSE::Email and Email::Address::XS the same way. These all worked because something else had loaded the module first, which is not a property worth depending on. Co-Authored-By: Claude <noreply@anthropic.com>
parse_bare_address always returns an object, so the "did we get one" check was never false. Worse, the object overloads stringification, and evaluating it in boolean context stringifies it, which warns "Argument contains empty address" for exactly the inputs we are here to reject. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Now that recipients can be Email::MIME::Header::AddressList objects, interpolating them into the "sending to" and hdebug log lines printed the object's address. PAUSE::Email->header_value_as_string hands back either the plain string or the list's as_string form. Co-Authored-By: Claude <noreply@anthropic.com>
Like the other modules fixed up recently, this only worked because something else loaded Encode first. Co-Authored-By: Claude <noreply@anthropic.com>
|
@charsbar This touches some of the web code, I think totally safely, but maybe give a look? |
|
docker-compose/PrivatePAUSE.pm needs some fix. I think it's better to add some migration code in PAUSE.pm, or at least add a note on the migration for those who have privatelib/PrivatePAUSE.pm. |
| # I don't know why this is like this. I'm just reworking earlier code. | ||
| # -- rjbs, 2024-05-03 | ||
| my $is_not_emaily = sub { | ||
| my ($inside) = $_[0] =~ /^\s*(.+)\s*$/; |
There was a problem hiding this comment.
Needs to be something like /^\s*(.+?)\s*$/; ?
Splitting the regex to s/^\s*//; and s/\s*$//; seems safer.
| MOD_DATA_SOURCE_NAME => "dbi:mysql:mod", | ||
| NO_SUCCESS_BREAK => 900, | ||
| NOREPLY_ADDRESS => 'upload@pause.perl.org', # used as a sender address, ideally only used by the receiver for filtering incoming email | ||
| P5P => 'release-announce@perl.org', |
There was a problem hiding this comment.
P5P is not used anymore?
| To => $PAUSE::Config->{ADMIN}, | ||
| From => "cron daemon cron-daily.pl <upload\@pause.perl.org>", | ||
| To => PAUSE::Email->report_email_header_object, | ||
| From => PAUSE::Email->noreply_email_header_object, |
There was a problem hiding this comment.
From's name is changed from "cron daemon cron-daily.pl" to "Perl Authors Upload Server". Not sure if admins use this to filter emails, but it might be better to keep the original name.
| To => $PAUSE::Config->{ADMIN}, | ||
| From => "cron daemon cron-p6daily.pl <upload\@pause.perl.org>", | ||
| To => PAUSE::Email->report_email_header_object, | ||
| From => PAUSE::Email->noreply_email_header_object, |
| use Dumpvalue (); | ||
| use DynaLoader (); | ||
| use Email::MIME; | ||
| use Encode (); |
There was a problem hiding this comment.
Is this really needed? Or rather, should this really belong to this PR?
| ->new(ERROR => | ||
| "Unidentified error happened, please write to the PAUSE admin | ||
| at $PAUSE::Config->{ADMIN} and help them identify what's going on. Thanks!") | ||
| at $PAUSE::Config->{CONTACT_ADDRESS} and help them identify what's going on. Thanks!") |
|
|
||
| (This mail has been generated automatically by the Perl Authors Upload | ||
| Server on behalf of the admin <%== $PAUSE::Config->{ADMIN} %>) | ||
| Server on behalf of the admin <%== $PAUSE::Config->{CONTACT_ADDRESS} %>) |
There was a problem hiding this comment.
Is this intentional? This is an email to give a one time password to the requested user, at https://github.com/andk/pause/blob/master/lib/pause_2017/PAUSE/Web/Plugin/UserRegistration.pm#L90-L96 .
| Thanks & Regards, | ||
| -- | ||
| <%== $PAUSE::Config->{ADMIN} %> | ||
| <%== $PAUSE::Config->{CONTACT_ADDRESS} %> |
| </ul> | ||
|
|
||
| <p>With this form you can tell the indexer to index selected files again. As it is done by a cron job, it may take up to an hour until the indexer actually executes the command. If this doesn't repair the index, please <a href="mailto:<%= $PAUSE::Config->{UPLOAD} %>">email me</a>.</p> | ||
| <p>With this form you can tell the indexer to index selected files again. As it is done by a cron job, it may take up to an hour until the indexer actually executes the command. If this doesn't repair the index, please <a href="mailto:<%= $PAUSE::Config->{CONTACT_ADDRESS} %>">email me</a>.</p> |
There was a problem hiding this comment.
Might be better to use INTERNAL_REPORT_ADDRESS so that one of the admins can reindex for the user (or investigate the issue)?
| Mojo::ByteStream->new(qq{\)Please | ||
| try again or report errors to <a href="mailto:}), | ||
| $PAUSE::Config->{ADMIN}, | ||
| $PAUSE::Config->{CONTACT_ADDRESS}, |
There was a problem hiding this comment.
INTERNAL_REPORT_ADDRESS because this is an internal error report?
We saw cases where a user with the "real name" of
Bob"Smithcould cause problems in how we'd send them mail. This branch will fix that.Previously, the code often naively formed To or From headers with code like this:
This worked most of the time. Given an
$asciinamewith"in it, though, it would break. Probably one that ended in\would break, and probably other case. Also, it's much nicer to use people's full names, rather than ASCII!We send our emails using Email::MIME. Email::MIME allows certain kinds of objects to be provided for certain kinds of headers. Notably, an Email::MIME::Header::AddressList object can be passed for To, From, Cc, Reply-To, and some others. This branch makes it much easier to get or create AddressList objects, and then uses them in most places where emails are created.