diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-24 10:09:54 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-24 10:09:54 +0100 |
commit | 8e6c6833afaf8b4cb820bffb4fa2adf44c0ca24d (patch) | |
tree | 38041b307d8ef87faedf7d6aadef8dcbeb33dceb | |
parent | 27edc4907f17cbfd16cdd18241d6a936990006f5 (diff) |
Use bcrypt.
21 files changed, 64 insertions, 51 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl index 1261f2378..152d319b1 100755 --- a/db/rerun_dbic_loader.pl +++ b/db/rerun_dbic_loader.pl @@ -30,7 +30,7 @@ make_schema_at( overwrite_modifications => 1, # don't worry that the md5 is wrong # add in some extra components - components => [ 'FilterColumn', 'InflateColumn::DateTime' ], + components => [ 'FilterColumn', 'InflateColumn::DateTime', 'EncodedColumn' ], }, FixMyStreet->dbic_connect_info(), diff --git a/perl-external/files.txt b/perl-external/files.txt index fb5786aa8..f594e80af 100644 --- a/perl-external/files.txt +++ b/perl-external/files.txt @@ -161,6 +161,7 @@ /authors/id/M/MA/MAKAMAKA/JSON-PP-2.27105.tar.gz /authors/id/M/MA/MANU/Net-IP-1.25.tar.gz /authors/id/M/MA/MARKOV/MIME-Types-1.31.tar.gz +/authors/id/M/MA/MAUKE/Dir-Self-0.10.tar.gz /authors/id/M/MH/MHX/Devel-PPPort-3.19.tar.gz /authors/id/M/MI/MIROD/HTML-TreeBuilder-XPath-0.12.tar.gz /authors/id/M/MI/MIROD/XML-XPathEngine-0.12.tar.gz @@ -250,5 +251,9 @@ /authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz /authors/id/U/UL/ULPFR/Text-German-0.06.tar.gz /authors/id/V/VP/VPIT/Variable-Magic-0.46.tar.gz +/authors/id/W/WR/WREIS/DBIx-Class-EncodedColumn-0.00011.tar.gz /authors/id/X/XE/XERN/Lingua-PT-Stemmer-0.01.tar.gz /authors/id/Y/YV/YVES/ExtUtils-Install-1.54.tar.gz +/authors/id/Z/ZE/ZEFRAM/Class-Mix-0.004.tar.gz +/authors/id/Z/ZE/ZEFRAM/Crypt-Eksblowfish-0.009.tar.gz +/authors/id/Z/ZE/ZEFRAM/Params-Classify-0.013.tar.gz diff --git a/perl-external/minicpan/modules/02packages.details.txt.gz b/perl-external/minicpan/modules/02packages.details.txt.gz Binary files differindex dfe6e38ba..d78040bab 100644 --- a/perl-external/minicpan/modules/02packages.details.txt.gz +++ b/perl-external/minicpan/modules/02packages.details.txt.gz diff --git a/perl-external/modules.txt b/perl-external/modules.txt index 7b640c215..4568fc706 100644 --- a/perl-external/modules.txt +++ b/perl-external/modules.txt @@ -18,7 +18,9 @@ Catalyst::View::TT Class::Accessor Class::Unload Config::General +Crypt::Eksblowfish::Bcrypt DBIx::Class +DBIx::Class::EncodedColumn DBIx::Class::FilterColumn DBIx::Class::Schema::Loader DBIx::Class::Storage::DBI diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index b5838a169..47b290eff 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -61,8 +61,7 @@ __PACKAGE__->config( credential => { # Catalyst::Authentication::Credential::Password class => 'Password', password_field => 'password', - password_type => 'hashed', - password_hash_type => 'SHA-1', + password_type => 'self_check', }, store => { # Catalyst::Authentication::Store::DBIx::Class class => 'DBIx::Class', diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm index 9ff415bf4..5767a0a82 100644 --- a/perllib/FixMyStreet/App/Controller/Auth.pm +++ b/perllib/FixMyStreet/App/Controller/Auth.pm @@ -7,7 +7,6 @@ BEGIN { extends 'Catalyst::Controller'; } use Email::Valid; use Net::Domain::TLD; use mySociety::AuthToken; -use Digest::SHA1 qw(sha1_hex); =head1 NAME @@ -219,7 +218,7 @@ sub change_password : Local { } # we should have a usable password - save it to the user - $c->user->obj->update( { password => sha1_hex($new) } ); + $c->user->obj->update( { password => $new } ); $c->stash->{password_changed} = 1; } diff --git a/perllib/FixMyStreet/DB/Result/Abuse.pm b/perllib/FixMyStreet/DB/Result/Abuse.pm index df3ebe24a..b1cf9c1ed 100644 --- a/perllib/FixMyStreet/DB/Result/Abuse.pm +++ b/perllib/FixMyStreet/DB/Result/Abuse.pm @@ -8,14 +8,14 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("abuse"); __PACKAGE__->add_columns("email", { data_type => "text", is_nullable => 0 }); __PACKAGE__->set_primary_key("email"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Bc0deuJiQlKyMGzLTUAIxg +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IuTLiJSDZGLF/WX8q3iKIQ # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/AdminLog.pm b/perllib/FixMyStreet/DB/Result/AdminLog.pm index e57773e63..da97950a0 100644 --- a/perllib/FixMyStreet/DB/Result/AdminLog.pm +++ b/perllib/FixMyStreet/DB/Result/AdminLog.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("admin_log"); __PACKAGE__->add_columns( "id", @@ -36,8 +36,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-06 18:52:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VKN3o9SHoDhG2/H5NInf2w +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7427CuN3/6IL2GxiQDoWUA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm index 3a2dc9a9f..eddd98f37 100644 --- a/perllib/FixMyStreet/DB/Result/Alert.pm +++ b/perllib/FixMyStreet/DB/Result/Alert.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert"); __PACKAGE__->add_columns( "id", @@ -64,8 +64,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NlyhWyg0NrH5/kZYYO36qg +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d2TrE9UIZdXu3eXYJH0Zmw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertSent.pm b/perllib/FixMyStreet/DB/Result/AlertSent.pm index 85a9000d5..a901c2fde 100644 --- a/perllib/FixMyStreet/DB/Result/AlertSent.pm +++ b/perllib/FixMyStreet/DB/Result/AlertSent.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_sent"); __PACKAGE__->add_columns( "alert_id", @@ -30,8 +30,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x1nMIiNFSTKxdPxZmko18Q +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fTiWIoriQUvHpWc9PpFLvA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertType.pm b/perllib/FixMyStreet/DB/Result/AlertType.pm index 7a3cd1e36..d23a2983d 100644 --- a/perllib/FixMyStreet/DB/Result/AlertType.pm +++ b/perllib/FixMyStreet/DB/Result/AlertType.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_type"); __PACKAGE__->add_columns( "ref", @@ -47,8 +47,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KNZ7eWU/VgF8xzsjCHKVjw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+PKqo7IZ4MlM9ur4V2P9tA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 68175dead..18bcedc1b 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("comment"); __PACKAGE__->add_columns( "id", @@ -68,8 +68,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:71bSUgPf3uW607g2EGl/Vw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TYFusbxkOkAewaiZYZVJUA use DateTime::TimeZone; use Image::Size; diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 2b18e0250..001fb4ac6 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts"); __PACKAGE__->add_columns( "id", @@ -39,7 +39,7 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("contacts_area_id_category_idx", ["area_id", "category"]); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8u8S4QtIf0n7QUxVuP/Siw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BXGd4uk1ybC5RTKlInTr0w 1; diff --git a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm index 4fa74a9a2..811a06b44 100644 --- a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm +++ b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts_history"); __PACKAGE__->add_columns( "contacts_history_id", @@ -40,8 +40,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("contacts_history_id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-02 18:27:49 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:D9Uu5Lp8BackyZdLXJDIvw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9APvBwAOebG5g4MGxJuVKQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 366024c7c..c5851b256 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("problem"); __PACKAGE__->add_columns( "id", @@ -100,8 +100,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U3aYCRwE4etekKaHdhEkIw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3sw/1dqxlTvcWEI/eJTm4w # Add fake relationship to stored procedure table __PACKAGE__->has_many( diff --git a/perllib/FixMyStreet/DB/Result/Questionnaire.pm b/perllib/FixMyStreet/DB/Result/Questionnaire.pm index 5a507645f..cc4ec300b 100644 --- a/perllib/FixMyStreet/DB/Result/Questionnaire.pm +++ b/perllib/FixMyStreet/DB/Result/Questionnaire.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("questionnaire"); __PACKAGE__->add_columns( "id", @@ -40,8 +40,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BAWTYKAQ84VeOI6D2gtQOQ +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QNFqqCg6J4SFlg4zwm7TWw use DateTime::TimeZone; diff --git a/perllib/FixMyStreet/DB/Result/Secret.pm b/perllib/FixMyStreet/DB/Result/Secret.pm index 399f0be18..8a1fa671d 100644 --- a/perllib/FixMyStreet/DB/Result/Secret.pm +++ b/perllib/FixMyStreet/DB/Result/Secret.pm @@ -8,13 +8,13 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("secret"); __PACKAGE__->add_columns("secret", { data_type => "text", is_nullable => 0 }); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 12:02:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Htl6+DHfHy9l+bjBxAbH6Q +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MfqW1K0aFtwpa/1c/UwHjg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Session.pm b/perllib/FixMyStreet/DB/Result/Session.pm index a10e6fa0d..9d5d509dc 100644 --- a/perllib/FixMyStreet/DB/Result/Session.pm +++ b/perllib/FixMyStreet/DB/Result/Session.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("sessions"); __PACKAGE__->add_columns( "id", @@ -21,8 +21,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tYWQtbja2nkA/2A+kaPl1g +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TagSQOXnDttkwfJ7oDH8Yw # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/Token.pm b/perllib/FixMyStreet/DB/Result/Token.pm index d838e9fc2..3a900858d 100644 --- a/perllib/FixMyStreet/DB/Result/Token.pm +++ b/perllib/FixMyStreet/DB/Result/Token.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("token"); __PACKAGE__->add_columns( "scope", @@ -27,8 +27,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("scope", "token"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ET4L1y6yWmEUDKPKa7wJiw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:frl+na3HrIzGw9D1t891nA # Trying not to use this # use mySociety::DBHandle qw(dbh); diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index e4dd5da5b..95e9908c3 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("users"); __PACKAGE__->add_columns( "id", @@ -49,8 +49,17 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vo92xIsCQTLF6lBugzhHcA +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T2JK+KyfoE2hkCLgreq1XQ + +__PACKAGE__->add_columns( + "password" => { + encode_column => 1, + encode_class => 'Crypt::Eksblowfish::Bcrypt', + encode_args => { cost => 8 }, + encode_check_method => 'check_password', + }, +); use mySociety::EmailUtil; diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 3dd4e84e9..9913f5cde 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -14,7 +14,6 @@ use Test::More; use Web::Scraper; use Carp; use Email::Send::Test; -use Digest::SHA1 'sha1_hex'; use JSON; =head1 NAME @@ -89,8 +88,8 @@ sub log_in_ok { my $user = $mech->create_user_ok($email); # store the old password and then change it - my $old_password_sha1 = $user->password; - $user->update( { password => sha1_hex('secret') } ); + my $old_password = $user->password; + $user->update( { password => 'secret' } ); # log in $mech->get_ok('/auth'); @@ -100,7 +99,7 @@ sub log_in_ok { $mech->logged_in_ok; # restore the password (if there was one) - $user->update( { password => $old_password_sha1 } ) if $old_password_sha1; + $user->update( { password => $old_password } ) if $old_password; return $user; } |