From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] reply: follow obfuscation rules for HTML in sh args
Date: Mon, 29 Jan 2018 13:09:21 +0000 [thread overview]
Message-ID: <20180129130921.11133-1-e@80x24.org> (raw)
Namely, we do not want to obfuscate the mail address of the
site itself.
---
lib/PublicInbox/Hval.pm | 5 +++--
lib/PublicInbox/Reply.pm | 10 ++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index 0e19902..d65ab32 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -91,8 +91,9 @@ sub prurl {
# ․ · and ͺ were also candidates:
# https://public-inbox.org/meta/20170615015250.GA6484@starla/
# However, • was chosen to make copy+paste errors more obvious
-sub obfuscate_addrs ($$) {
+sub obfuscate_addrs ($$;$) {
my $ibx = $_[0];
+ my $repl = $_[2] || '•';
my $re = $ibx->{-no_obfuscate_re}; # regex of domains
my $addrs = $ibx->{-no_obfuscate}; # { adddress => 1 }
$_[1] =~ s/(([\w\.\+=\-]+)\@([\w\-]+\.[\w\.\-]+))/
@@ -100,7 +101,7 @@ sub obfuscate_addrs ($$) {
if ($addrs->{$addr} || ((defined $re && $domain =~ $re))) {
$addr;
} else {
- $domain =~ s!([^\.]+)\.!$1•!;
+ $domain =~ s!([^\.]+)\.!$1$repl!;
$user . '@' . $domain
}
/sge;
diff --git a/lib/PublicInbox/Reply.pm b/lib/PublicInbox/Reply.pm
index 07288aa..eee4117 100644
--- a/lib/PublicInbox/Reply.pm
+++ b/lib/PublicInbox/Reply.pm
@@ -4,7 +4,7 @@ package PublicInbox::Reply;
use strict;
use warnings;
use URI::Escape qw/uri_escape_utf8/;
-use PublicInbox::Hval qw/ascii_html/;
+use PublicInbox::Hval qw/ascii_html obfuscate_addrs/;
use PublicInbox::Address;
use PublicInbox::MID qw/mid_clean mid_escape/;
@@ -70,8 +70,9 @@ sub mailto_arg_link {
delete $cc->{$to};
if ($obfs) {
my $arg_to = $to;
- $arg_to =~ s/\./\$(echo .)/;
+ obfuscate_addrs($ibx, $arg_to, '$(echo .)');
push @arg, "--to=$arg_to";
+ # no $subj for $href below
} else {
push @arg, "--to=$to";
$to = uri_escape_utf8($to);
@@ -82,8 +83,9 @@ sub mailto_arg_link {
if (@cc) {
if ($obfs) {
push(@arg, map {
- s/\./\$(echo .)/;
- "--cc=$_";
+ my $addr = $_;
+ obfuscate_addrs($ibx, $addr, '$(echo .)');
+ "--cc=$addr";
} @cc);
} else {
$cc = '&Cc=' . uri_escape_utf8(join(',', @cc));
--
EW
reply other threads:[~2018-01-29 13:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180129130921.11133-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).