Commit graph

17937 commits

Author SHA1 Message Date
Marc Alexander
b6473a515b [feature/passwords] Increase manager test coverage to cover all methods
All methods in the manager are now fully covered.

PHPBB3-11610
2013-09-14 13:55:00 +02:00
Marc Alexander
a4b0a8ceb9 [feature/passwords] Do not use specific errors but just return false
The authentication system should handle the possible errors for now.
Additional error returns can be added later on if they are needed.

PHPBB3-11610
2013-09-14 13:54:53 +02:00
Marc Alexander
dbd6d33e9f [feature/passwords] NULL should be null according to coding guidelines
PHPBB3-11610
2013-09-14 13:54:48 +02:00
Marc Alexander
8f863d1d49 [feature/passwords] Do not check if type_map is empty
If the type map is empty the service container is incomplete or broken.
There is no need to check this as other components would probably be broken
at the same time.

PHPBB3-11610
2013-09-14 13:54:39 +02:00
Marc Alexander
fcb7130823 [feature/passwords] Use randomly generated password for tests
The password will start with 'foobar' and then continue with random
characters that will be appended every iteration.

PHPBB3-11610
2013-09-14 13:54:33 +02:00
Marc Alexander
ddc207fae8 [feature/passwords] Fix tests on PHP versions < 5.3.7
PHPBB3-11610
2013-09-14 13:54:27 +02:00
Marc Alexander
cfbd858bd7 [feature/passwords] Properly treat duplicates in combined hashes
PHPBB3-11610
2013-09-14 13:54:21 +02:00
Marc Alexander
556048177f [feature/passwords] Make method get_hashing_public_algorithm public
Combined hashing requires it for checking the supplied password hash for
its hashing algorithm.

PHPBB3-11610
2013-09-14 13:54:13 +02:00
Marc Alexander
6f33ca85a2 [feature/passwords] Add tests for combined hashing of passwords
PHPBB3-11610
2013-09-14 13:54:06 +02:00
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
e7b3daeb29 [feature/passwords] Add tests for manager check_hash() method
Tests cover all supported hashing algorithms.

PHPBB3-11610
2013-09-14 13:52:57 +02:00
Marc Alexander
13d25e6a32 [feature/passwords] Fix tests for PHP version < 5.3.7
PHPBB3-11610
2013-09-14 13:52:52 +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
33725f6e2f [feature/passwords] Include driver helper in manager_test
PHPBB3-11610
2013-09-14 13:52:33 +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
c9fafcefd3 [feature/passwords] Add basic passwords manager test file
PHPBB3-11610
2013-09-14 13:52:15 +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
d66cae7cbc [feature/passwords] Add service collection file crypto.yml
This will contain definitions of the services and the service collection
that will be passed to the passwords manager.

PHPBB3-11610
2013-09-14 13:50:42 +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
Joas Schilling
b7b862d721 Merge remote-tracking branch 'rechosen/ticket/11792' into develop
* rechosen/ticket/11792:
  [ticket/11792] Add functional test for var lang_set_ext of core.user_setup
  [ticket/11792] Add performance remark to core.user_setup event PHPDoc
  [ticket/11792] Add variable 'lang_set_ext' to event core.user_setup
2013-08-22 12:57:49 +02:00
rechosen
e113b46810 [ticket/11792] Add functional test for var lang_set_ext of core.user_setup
To ensure that the new lang_set_ext variable available with the
core.user_setup event works properly, a functional test was added. It
overwrites the value of the 'SKIP' language key, which is assumed to remain
in use for some time to come.

PHPBB3-11792
2013-08-22 11:06:04 +02:00
Andreas Fischer
fa2be427b6 Merge remote-tracking branch 'mvinny/ticket/11804' into develop
* mvinny/ticket/11804:
  [ticket/11804] Remove </li> from overall_header which was not open
2013-08-20 14:31:15 +02:00
Marcus Vinny
83092e0269 [ticket/11804] Remove </li> from overall_header which was not open
PHPBB3-11804
2013-08-20 04:25:06 -03:00
Andreas Fischer
edb0f61124 Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/11802] replace $browser with $user->browser

Conflicts:
	phpBB/download/file.php
2013-08-20 00:50:58 +02:00
Andreas Fischer
7893e992ff Merge branch 'prep-release-3.0.12' into develop-olympus
* prep-release-3.0.12:
  [ticket/11802] replace $browser with $user->browser
2013-08-20 00:47:21 +02:00
Andreas Fischer
ba9d303d52 Merge remote-tracking branch 'dhruvgoel92/ticket/11802' into prep-release-3.0.12
* dhruvgoel92/ticket/11802:
  [ticket/11802] replace $browser with $user->browser
2013-08-20 00:46:33 +02:00
Dhruv
aa3d2ef7a9 [ticket/11802] replace $browser with $user->browser
PHPBB3-11802
2013-08-20 04:14:20 +05:30
Andreas Fischer
c6f56f5149 Merge branch 'develop-olympus' into develop
* develop-olympus:
  [ticket/11801] removed some whitespace and added missing semi colon's in css

Conflicts:
	phpBB/styles/prosilver/theme/colours.css
2013-08-19 20:48:17 +02:00
Andreas Fischer
8c69db6ab2 Merge remote-tracking branch 'Prosk8er/ticket/11801' into develop-olympus
* Prosk8er/ticket/11801:
  [ticket/11801] removed some whitespace and added missing semi colon's in css
2013-08-19 20:45:34 +02:00
Dhruv
f7b967dc5a Merge remote-tracking branch 'Elsensee/ticket/11760' into develop
# By Oliver Schramm
# Via Oliver Schramm
* Elsensee/ticket/11760:
  [ticket/11760] Use phpbb_version_compare() wrapper
2013-08-19 23:28:53 +05:30
Prosk8er
f61db86b8d [ticket/11801] removed some whitespace and added missing semi colon's in css
PHPBB3-11801
2013-08-19 13:31:30 -04:00
rechosen
953ca1785f [ticket/11792] Add performance remark to core.user_setup event PHPDoc
To prevent extension authors from loading all their translations globally, a
remark on this was added to the PHPDoc documentation of the core.user_setup
event.

PHPBB3-11792
2013-08-19 11:06:36 +02:00
rechosen
88e5ba4e57 [ticket/11792] Add variable 'lang_set_ext' to event core.user_setup
To allow extensions to add global language strings just like mods can, add the
'lang_set_ext' variable to the core.user_setup event. It requires an ext_name
to be specified as well as a lang_set, and loads the specified lang_set in the
context of the extension.

PHPBB3-11792
2013-08-19 11:06:36 +02:00