aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2015-05-14 11:37:47 -0400
committerJoey Hess <joeyh@joeyh.name>2015-05-14 11:58:21 -0400
commitab1bba9daba5500e1b154579518369974cc6041a (patch)
treee4684113a149c92ba09fd7217c6a85d6f040d6d6 /IkiWiki.pm
parent2a64eea0f51a431abe9c0a7c73a61f3177977790 (diff)
downloadikiwiki-ab1bba9daba5500e1b154579518369974cc6041a.tar
ikiwiki-ab1bba9daba5500e1b154579518369974cc6041a.tar.gz
cloak user PII when making commits etc, and let cloaked PII be used in banned_users
This was needed due to emailauth, but I've also wrapped all IP address exposure in cloak(), although the function doesn't yet cloak IP addresses. (One IP address I didn't cloak is the one that appears on the password reset email template. That is expected to be the user's own IP address, so ok to show it to them.) Thanks to smcv for the pointer to http://xmlns.com/foaf/spec/#term_mbox_sha1sum
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index dfdd0fe91..bb36b0885 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1430,6 +1430,7 @@ sub userpage ($) {
return length $config{userdir} ? "$config{userdir}/$user" : $user;
}
+# Username to display for openid accounts.
sub openiduser ($) {
my $user=shift;
@@ -1464,6 +1465,7 @@ sub openiduser ($) {
return;
}
+# Username to display for emailauth accounts.
sub emailuser ($) {
my $user=shift;
if (defined $user && $user =~ m/(.+)@/) {
@@ -1475,6 +1477,22 @@ sub emailuser ($) {
return;
}
+# Some user information should not be exposed in commit metadata, etc.
+# This generates a cloaked form of such information.
+sub cloak ($) {
+ my $user=shift;
+ # cloak email address using http://xmlns.com/foaf/spec/#term_mbox_sha1sum
+ if ($user=~m/(.+)@/) {
+ my $nick=$1;
+ eval q{use Digest::SHA};
+ return $user if $@;
+ return $nick.'@'.Digest::SHA::sha1_hex("mailto:$user");
+ }
+ else {
+ return $user;
+ }
+}
+
sub htmlize ($$$$) {
my $page=shift;
my $destpage=shift;