Subject: | Disclosure of local paths |
With the latest versions of SVN::Web that use SVN::Client, local
repository paths are displayed on the repository list. This is both
useless to a user and disclosure of private data.
I have written a patch to SVN::Web::List and the list template that
allows you to either hide local repository URLs, all URLs, or show a
different URL publicly than is used internally.
Subject: | url_aliasing.patch |
Index: lib/SVN/Web/List.pm
===================================================================
--- lib/SVN/Web/List.pm (revision 1300)
+++ lib/SVN/Web/List.pm (working copy)
@@ -23,6 +23,7 @@
class: SVN::Web::List
opts:
redirect_to_browse_when_one_repo: 0 # or 1
+ public_repos_uri: hide_local
...
=head1 DESCRIPTION
@@ -44,6 +45,15 @@
Defaults to 0.
+=item public_repos_uri
+
+Can be 'hide_local', which will hide the URL for any file:// repositories,
+'hide_all', which will hide all repositories, or a hash. The hash should be
+keyed by the repository name, and the values should be either a URL display, or
+a false value to hide the URL.
+
+The default is to show all repository URLs.
+
=back
=head1 TEMPLATE VARIABLES
@@ -84,6 +94,27 @@
return;
}
+ my $public_repos = $self->{opts}{public_repos_uri};
+ if (lc $public_repos eq 'hide_all') {
+ for my $rep (values %repos) {
+ undef $rep;
+ }
+ }
+ elsif (lc $public_repos eq 'hide_local') {
+ for my $rep (values %repos) {
+ if ($rep =~ m{file://}) {
+ undef $rep;
+ }
+ }
+ }
+ elsif (ref $public_repos eq 'HASH') {
+ for my $repname (keys %repos) {
+ if (exists $public_repos->{$repname}) {
+ $repos{$repname} = $public_repos->{$repname};
+ }
+ }
+ }
+
return {
template => 'list',
data => {
Index: lib/SVN/Web/Template/trac/list
===================================================================
--- lib/SVN/Web/Template/trac/list (revision 1300)
+++ lib/SVN/Web/Template/trac/list (working copy)
@@ -6,7 +6,7 @@
<ul>
[% FOREACH r = repos %]
- <li><a href="[% c.script %]/[% r.key %]">[% r.key %]</a> <span class="reponame">→ [% r.value %]</span></li>
+ <li><a href="[% c.script %]/[% r.key %]">[% r.key %]</a>[% IF r.value %] <span class="reponame">→ [% r.value %]</span>[% END %]</li>
[% END %]
</ul>
[% ELSE %]