diff options
Diffstat (limited to 'Bugzilla/Install/Localconfig.pm')
-rw-r--r-- | Bugzilla/Install/Localconfig.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm index 956d3c72e..3ce12207e 100644 --- a/Bugzilla/Install/Localconfig.pm +++ b/Bugzilla/Install/Localconfig.pm @@ -109,7 +109,9 @@ use constant LOCALCONFIG_VARS => ( }, { name => 'site_wide_secret', - default => sub { generate_random_password(256) }, + # 64 characters is roughly the equivalent of a 384-bit key, which + # is larger than anybody would ever be able to brute-force. + default => sub { generate_random_password(64) }, }, ); @@ -210,7 +212,14 @@ sub update_localconfig { my @new_vars; foreach my $var (LOCALCONFIG_VARS) { my $name = $var->{name}; - if (!defined $localconfig->{$name}) { + my $value = $localconfig->{$name}; + # Regenerate site_wide_secret if it was made by our old, weak + # generate_random_password. Previously we used to generate + # a 256-character string for site_wide_secret. + $value = undef if ($name eq 'site_wide_secret' and defined $value + and length($value) == 256); + + if (!defined $value) { push(@new_vars, $name); $var->{default} = &{$var->{default}} if ref($var->{default}) eq 'CODE'; if (exists $answer->{$name}) { |