Commit graph

7935 commits

Author SHA1 Message Date
Marc Alexander
dc76146cef [feature/passwords] Add combined hashing method to helper
This will allow to hash a previously hashed password with another hashing
method, i.e. as upgrade path from phpBB 3.0 to 3.1.

PHPBB3-11610
2013-09-14 13:53:58 +02:00
Marc Alexander
c67f7dba60 [feature/passwords] Add function for obtaining only the hash to helper
This is also needed for combined hashing of passwords.

PHPBB3-11610
2013-09-14 13:53:52 +02:00
Marc Alexander
16e5d0dc35 [feature/passwords] Fix minor code limitations in helper
These limitations caused it to only allow a specific input to combined
hashes.

PHPBB3-11610
2013-09-14 13:53:44 +02:00
Marc Alexander
ab068799b1 [feature/passwords] Pass phpbb_container to passwords helper
PHPBB3-11610
2013-09-14 13:53:31 +02:00
Marc Alexander
e4a5aacf2a [feature/passwords] Use correct prefix for salt in salted_md5
PHPBB3-11610
2013-09-14 13:53:26 +02:00
Marc Alexander
857b90057b [feature/passwords] Add method for obtaining the hash settings only
This is needed for combined hashing of passwords.

PHPBB3-11610
2013-09-14 13:53:19 +02:00
Marc Alexander
dae4327cfc [feature/passwords] Add schema changes for new hash types
PHPBB3-11610
2013-09-14 13:53:14 +02:00
Marc Alexander
4b81b93d10 [feature/passwords] Make sure hash has the required length
Also added tests to make sure that crypto drivers are enforcing the hash
length.

PHPBB3-11610
2013-09-14 13:53:08 +02:00
Marc Alexander
7ddf004489 [feature/passwords] Make method get_hashing_algorithm() protected
There is currently no use for it being public.

PHPBB3-11610
2013-09-14 13:53:03 +02:00
Marc Alexander
3f70699aa3 [feature/passwords] Use common salt generation function for all types
We will be using the same method inside the driver helper class for all hash
types. This is the same function that has been used for the salted md5 hash
of phpBB 3.0.

PHPBB3-11610
2013-09-14 13:52:43 +02:00
Marc Alexander
5574b2a8e9 [feature/passwords] Add driver helper class file
PHPBB3-11610
2013-09-14 13:52:38 +02:00
Marc Alexander
61e98fbd63 [feature/passwords] Add driver helper class for additional functions
Functions for the helper class might be used in other drivers as well and
therefore shouldn't be limited to just one driver.

PHPBB3-11610
2013-09-14 13:52:25 +02:00
Marc Alexander
f8bcf99c7f [feature/passwords] Do not support 8-bit characters with $2a$ bcrypt
8-bit unicode characters might reduce the security of the password hash
when using the $2a$ bcrypt prefix. Those types of characters are usually
not used in passwords but we should prevent this possible issue anyway.

PHPBB3-11610
2013-09-14 13:52:09 +02:00
Marc Alexander
8795fe9c77 [feature/passwords] Add convert flag for converting to default
PHPBB3-11610
2013-09-14 13:52:04 +02:00
Marc Alexander
d3d317a2de [feature/passwords] Correctly supply hash salt and settings to bcrypt
PHPBB3-11610
2013-09-14 13:51:44 +02:00
Marc Alexander
c9afda5a65 [feature/passwords] Use correct prefix for bcrypt type
PHPBB3-11610
2013-09-14 13:51:39 +02:00
Marc Alexander
7a526284d3 [feature/passwords] Default to bcrypt with $2y$ prefix if possible
PHPBB3-11610
2013-09-14 13:51:31 +02:00
Marc Alexander
78a8369173 [feature/passwords] Add basic bcrypt drivers for $2a$ & $2y$ prefix
The $2a$ prefix is the basic implementation with the $2y$ prefix extending
that class. However, the default hashes for phpBB should be generated with
$2y$ unless the PHP version is older than 5.3.7.

PHPBB3-11610
2013-09-14 13:51:24 +02:00
Marc Alexander
31d2a8ef05 [feature/passwords] Add salted md5 (phpBB3 default) and phpass drivers
The phpass driver extends the standard salted md5 driver of phpBB3. It will
only support the $P$ prefix that phpass uses.

PHPBB3-11610
2013-09-14 13:51:16 +02:00
Marc Alexander
4b6646d1be [feature/passwords] Add crypto driver base class and interface
PHPBB3-11610
2013-09-14 13:51:10 +02:00
Marc Alexander
fbdbf41dc8 [feature/passwords] Add helper functions, i.e. for combined hashes
Combined hashes can be used for i.e. converting already existing
password hashes to bcrypt. While this will not provide the same security
a pure bcrypt hash provides, it will still be significantly more secure
than a standard salted md5.
A combined hash will look as follows:
$H\2y${salted_for_H_prefix}${salt_+_settings_for_2y_prefix}${hash}
The prefixes are seperated by a backslash. Individual settings (which
can include either just the salt or a salt and possible additional settings)
are seperated by dollar signs. As backslashes and dollar signs are not
allowed in hashes or salts, they will be used for seperating the settings
from the salt.

Here is an example of a password hash:
$H\2a$9zv1uIaq1$10\1ff4640409fb96a449c1fO$/oN1O0cdUmFSMZT3UZKrgAyalhnt1LC

The 'H' prefix stands for the salted md5 implementation of phpBB 3.0.
Its settings will be parsed as 9zv1uIaq1 resulting in a hash for the check
as follows:
$H$9zv1uIaq1{hash}
Since the password is used for hashing, the {hash} can be left blank and
will basically be filled by the hashing algorithm. The {hash} will then be
used as password for the next hashing algorithm. In this case that would be
the bcrypt algorithm. The settings are set to 10\1ff4640409fb96a449c1fO which
will be transformed to 10$1ff4640409fb96a449c1fO resulting in a hash like
this for the bcrypt hashing function:
$2a$10$1ff4640409fb96a449c1fO{hash}
The {hash} will again be basically filled by the hashing algorithm.
Afterwards, the {hash} will be extracted from the returned hash and put at
the end of the already known hash settings:
$H\2a$9zv1uIaq1$10\1ff4640409fb96a449c1fO$

If the password is correct, the combined hash will of course be the same
as the stored one.

PHPBB3-11610
2013-09-14 13:50:56 +02:00
Marc Alexander
3a0dd248d0 [feature/passwords] Add basic implementation of passwords manager
The passwords manager is capable of checking and hashing passwords.
It will support different hashing algorithms.

PHPBB3-11610
2013-09-14 13:50:07 +02:00
Andreas Fischer
55d911a2fd Merge remote-tracking branch 'cyberalien/ticket/11754' into develop
* cyberalien/ticket/11754:
  [ticket/11754] Remove styleswitcher leftovers
2013-08-18 01:55:56 +02:00
Andreas Fischer
1ac1b9b7ee Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/11775] Fix doc blocks syntax
  [ticket/11775] Remove spaces at line ends
  [ticket/11775] Split test into multiple steps
  [ticket/11775] Add functional test for moving the last post
  [ticket/11775] Backport moving of the posting functions to 3.0
  [ticket/11775] Fix error when moving the last post to another topic

Conflicts:
	tests/test_framework/phpbb_functional_test_case.php
2013-08-15 01:40:08 +02:00
Andreas Fischer
d089f9693a Merge branch 'prep-release-3.0.12' into develop-olympus
* prep-release-3.0.12:
  [ticket/11775] Fix doc blocks syntax
  [ticket/11775] Remove spaces at line ends
  [ticket/11775] Split test into multiple steps
  [ticket/11775] Add functional test for moving the last post
  [ticket/11775] Backport moving of the posting functions to 3.0
  [ticket/11775] Fix error when moving the last post to another topic
2013-08-15 01:37:56 +02:00
Oliver Schramm
74559eb0d5 [ticket/11774] Fix constant to avoid PHP errors
PHPBB3-11774
2013-08-08 15:50:20 +02:00
Joas Schilling
91eccc708b [ticket/11775] Fix error when moving the last post to another topic
PHPBB3-11775
2013-08-08 13:42:51 +02:00
Dhruv
f35d732f40 Merge remote-tracking branch 'nickvergessen/ticket/11574' into develop
# By Joas Schilling (16) and Igor Wiedler (6)
# Via Joas Schilling (5) and Igor Wiedler (2)
* nickvergessen/ticket/11574: (22 commits)
  [ticket/11574] Remove install/udpate/new/ fallback from database_update.php
  [ticket/11574] Do not display incompatible package note after successful update
  [ticket/11574] Remove old "continue step"-message
  [ticket/11574] Change order of files and database update
  [ticket/11574] Fix more issues in the updater
  [ticket/11574] Add trailing slash for consistency
  [ticket/11574] Fix table prefix in database updater
  [ticket/11574] Fix various path issues in the updater
  [ticket/11574] Make install language filename less crazy
  [ticket/11574] Use alternate DI config file for updater
  [ticket/11574] Include normalizer so it loads form the correct directory
  [ticket/11574] Only fall back to install/update versions, when IN_INSTALL ;)
  [ticket/11574] Use log object instead of old function
  [ticket/11574] Include vendor into update packages
  [ticket/11574] Create phpbb_log object before using it.
  [ticket/11574] Add correct language parameter to return links
  [ticket/11574] Use request object rather then request_var function
  [ticket/11574] Load new language files whenever possible
  [ticket/11574] Require new files in install/index.php and add a class loader
  [ticket/11574] Require new files in database_update.php and add a class loader
  ...
2013-08-08 13:56:39 +05:30
Joas Schilling
3f86d50338 Merge remote-tracking branch 'brunoais/ticket11639' into develop
* brunoais/ticket11639:
  [ticket/11639] Changing how censorship is handled.
  [ticket/11639] Removed a non-needed unset
  [ticket/11639] Whitespace fixing
  [ticket/11639] Whitespace fixing
  [ticket/11639] Added an useful comment.
  [ticket/11639] generate_text_for_display on functions_posting.php
2013-08-04 01:56:39 +02:00
brunoais
28a0a9e0b1 [ticket/11639] Changing how censorship is handled.
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11639
2013-08-03 21:46:06 +01:00
Joas Schilling
02435f92ba Merge remote-tracking branch 'brunoais/ticket/11642' into develop
* brunoais/ticket/11642:
  [ticket/11642] Use $parse_flags
  [ticket/11642] Fixed typo in the variable name.
  [ticket/11642] generate_text_for_display on mcp/mcp_post.php
2013-08-03 17:52:31 +02:00
Joas Schilling
a4fc7840b1 Merge remote-tracking branch 'brunoais/ticket/11643' into develop
* brunoais/ticket/11643:
  [ticket/11643] Use $parse_flags
  [ticket/11643] Fixed typo in the variable name.
  [ticket/11643] generate_text_for_display on mcp/mcp_queue.php
2013-08-03 17:47:02 +02:00
Joas Schilling
96cef7f549 Merge remote-tracking branch 'brunoais/ticket/11641' into develop
* brunoais/ticket/11641:
  [ticket/11641] Use $parse_flags
  [ticket/11641] generate_text_for_display on mcp/mcp_pm_reports.php
2013-08-03 17:37:54 +02:00
Joas Schilling
78623bf2ff Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/11762] Added call to test class's parent::setUp().
  [ticket/11762] Fixed test's filename
  [ticket/11762] Use the === operator to distinguish "0" from ""
2013-08-03 15:37:01 +02:00
s9e
8a02db317e [ticket/11762] Use the === operator to distinguish "0" from ""
PHPBB3-11762
2013-08-03 12:20:52 +02:00
Andreas Fischer
ea8f584de9 [prep-release-3.0.12] Bumping version number for 3.0.12-RC2. 2013-08-01 17:26:34 +02:00
Joas Schilling
9f60a38539 Merge remote-tracking branch 'brunoais/ticket/11653' into develop
* brunoais/ticket/11653:
  [ticket/11653] Use $parse_flags
  [ticket/11653] generate_text_for_display on mcp/mcp_topic.php
2013-08-01 16:50:50 +02:00
Joas Schilling
498f6ccbfc Merge remote-tracking branch 'brunoais/ticket/11655' into develop
* brunoais/ticket/11655:
  [ticket/11653] Use $parse_flags
  [ticket/11653] Missing ";"
  [ticket/11655] Use $parse_flags
  [ticket/11655] wrong var names for the uid and for the bitfield
  [ticket/11655] generate_text_for_display on ucp_pm_viewmessage.php
2013-08-01 11:39:17 +02:00
Bruno Ais
2f25197279 [ticket/11641] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11641
2013-08-01 10:16:33 +01:00
Bruno Ais
3ae33910fc [ticket/11653] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11653
2013-08-01 10:14:34 +01:00
Bruno Ais
a302a09ffb [ticket/11642] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11642
2013-08-01 10:12:58 +01:00
Bruno Ais
ea6938d3e5 [ticket/11643] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11643
2013-08-01 10:11:08 +01:00
Bruno Ais
c806375828 [ticket/11653] Missing ";"
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11653
2013-08-01 10:09:11 +01:00
Bruno Ais
776773522b [ticket/11653] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11653
2013-08-01 10:07:58 +01:00
Bruno Ais
c2aff70cf5 [ticket/11655] Use $parse_flags
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11655
2013-08-01 10:03:04 +01:00
Joas Schilling
ca07be9c57 Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/10037] Fix table in subsilver2
  [ticket/10037] Apply attached patch with a few changes
2013-07-31 23:40:35 +02:00
Vjacheslav Trushkin
c335edc038 [ticket/11754] Remove styleswitcher leftovers
PHPBB3-11754
2013-07-30 12:21:34 +03:00
Joas Schilling
91392c7288 Merge remote-tracking branch 'phpbb/develop' into ticket/11574
* phpbb/develop: (130 commits)
  [ticket/11638] Changed the layout to match the other similar commits
  [ticket/11640] removed the space that I wonder what it was doing there.
  [ticket/11749] Move event after all template data has been defined
  [ticket/10917] Variable used only once so delete it
  [ticket/10917] Revert use of phpbb wrapper
  [ticket/11749] Template events for topic_list_row_pre/append
  [ticket/11749] PHP Events for viewforum.php
  [ticket/11749] PHP Events for search.php
  [ticket/11740] Update FAQ to include Ideas Centre
  [ticket/11062] If user's language is english there is no further work needed
  [ticket/11062] Load new strings from user's language file if provided
  [ticket/10917] Using phpbb wrapper
  [ticket/10917] Fixed notice that files are out of date when updating to an unreleased version
  [ticket/11741] Fix empty brackets and remove bullet
  [ticket/11638] Removed the unneeded reset.
  [ticket/11638] Use the $parse_flags like the other commits
  [ticket/11638] Reverted to use the $parse tags way as the other ones
  [ticket/11638] Updated: bitwise $parse_flags use optionset()
  [ticket/11656] Made the check for the bitfield just like other PR's
  [ticket/11667] Use @inheritdoc
  ...
2013-07-30 01:06:11 +02:00
Joas Schilling
db78c11702 Merge pull request #1625 from brunoais/ticket/11640
[ticket/11640] removed the space that I wonder what it was doing there.
2013-07-29 09:09:46 -07:00
Bruno Ais
b8fef3b33a [ticket/11640] removed the space that I wonder what it was doing there.
sub-task of ticket PHPBB3-11635:
find and fix all bypasses of generate_text_for_*

PHPBB3-11640
2013-07-29 16:55:58 +01:00