Commit Graph

348 Commits

Author SHA1 Message Date
Michal Čihař
71e0c4bb67 Fix early fatal errors
We can not rely on whole stack being ready.

Fixes #12810

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-12-14 16:07:55 +01:00
jrchamp
e52bbde39b PMA_getRealSize - Performance and Readability
The "upstream" Moodle code was updated in MDL-39524; rather than looping through the options, preg_match allows us to directly select the correct multiplication factor with a single function call. Note that the default behavior (integer coercion) handles both bare integers and numbers of bytes (factor 1).

Signed-off-by: Jonathan Champ <jrchamp@ncsu.edu>
2016-12-09 15:13:20 -05:00
Michal Čihař
c1cc04c298 Merge branch 'QA_4_6' 2016-12-08 13:17:56 +01:00
Michal Čihař
9693522a86 Revert "Use unserialize without objects if available"
This reverts commit d61dbc1d6f.

Honestly I don't think this work as documented:

PHP Warning:  unserialize() expects parameter 2 to be array, boolean given
2016-12-08 13:17:03 +01:00
Michal Čihař
0079d9a940 Merge branch 'QA_4_6' 2016-12-08 12:04:26 +01:00
Michal Čihař
d61dbc1d6f Use unserialize without objects if available
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-12-08 12:04:05 +01:00
Michal Čihař
308c9d7951 Simplify Response object handling
- always use use and short name
- avoid calling getInstance() several times in one script

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-12-07 18:17:59 +01:00
Michal Čihař
b56f101039 Remove is_ajax_request global
We already have the same information on Response object, so let's use it
from there.

Issue #11731

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-12-07 17:54:34 +01:00
Madhura Jayaratne
93e9ef04f7 Fix #12783 Remove unused PMA_addJSCode function
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
2016-12-05 20:35:13 +11:00
Michal Čihař
ef1f3b5cf7 Merge branch 'QA_4_6' 2016-11-28 12:07:19 +01:00
Michal Čihař
ad55a6eba8 Avoid listing demo.phpmyadmin.net twice
Fixes #12744

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-11-28 11:39:21 +01:00
Michal Čihař
cad75c95c4 Merge branch 'QA_4_6-security' into master-security 2016-11-08 15:58:47 +01:00
Deven Bansod
8119464150 Handle multiple :p while sanitizing MySQL hosts
Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
2016-11-08 10:11:09 +05:30
Michal Čihař
2ed64c3c6a Merge branch 'master' into master-security 2016-10-24 13:55:39 +02:00
Michal Čihař
75a5fde46d Use secure.php.net for PHP documentation links
This avoids unnecessary redirect on the way (I still think this website
setup is weird, but that's all I can do about it).

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-10-18 11:13:24 +02:00
Michal Čihař
e6abff8a7f Be consistent in filename sanitization
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-10-10 17:20:13 +02:00
Michal Čihař
ad39140c86 Merge branch 'QA_4_6-security' into master-security 2016-10-04 13:18:16 +02:00
Michal Čihař
17b34be04f Correctly parse string length when checking serialized data
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-10-04 13:17:59 +02:00
Michal Čihař
19c24a8c6c Merge branch 'master' into master-security 2016-09-16 10:30:28 +02:00
Michal Čihař
3546bed47e Avoid using mb_strlen for checking whether string is empty
Using strlen produces same results here, just way faster.

Fixes #12397

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-09-16 10:29:21 +02:00
Michal Čihař
5ee95b3615 Merge branch 'QA_4_6-security' into master-security 2016-09-02 15:04:55 +02:00
Michal Čihař
dac36c3cd8 Stricter URL validation
- do not use empty() as empty('0') is true
- do not lowercase the strings, use them as they are
- lowercase all domains in our codebase
- do not allow to specify port

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-09-02 15:00:43 +02:00
Michal Čihař
50f48aa629 Merge branch 'master' into master-security 2016-09-02 14:41:13 +02:00
Sudheesh Singanamalla
2833c6b324 Fixes #12509 Removes unused function PMA_addJSVar
Signed-off-by: Sudheesh Singanamalla <sudheesh1995@outlook.com>
2016-09-01 12:28:16 +05:30
Michal Čihař
16da93378b Merge branch 'master' into master-security 2016-08-18 17:09:54 +02:00
Michal Čihař
d62494cd8c Merge branch 'QA_4_6' into QA_4_6-security 2016-08-18 17:09:37 +02:00
Michal Čihař
9c5528b4cb Merge branch 'QA_4_6' 2016-08-18 17:09:24 +02:00
Michal Čihař
c44f5ab080 Always use UTC time in HTTP headers
Using timezones in this context can cause problem when DST changes
apply.

Also this can be information leak of server timezone.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-08-18 17:07:00 +02:00
Michal Čihař
b2ea7205fb Merge branch 'QA_4_6-security' into master-security 2016-08-18 09:12:49 +02:00
Michal Čihař
9dbe520e90 Strip null bytes from MySQL username
In old PHP versions this could lead to allow/deny rules bypass.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-08-18 09:11:45 +02:00
Michal Čihař
23e01d306a Merge branch 'QA_4_6' 2016-08-17 15:38:22 +02:00
Michal Čihař
01b9db6b1c Rename getCookiePath() to getRootPath()
It is not used only for cookies, so generic name makes more sense.

Issue #12374

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-08-17 15:35:15 +02:00
Michal Čihař
311be7515c Use https when available
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-08-17 13:17:41 +02:00
Michal Čihař
aebbb31aad Merge branch 'master' into master-security 2016-07-29 14:08:23 +02:00
Michal Čihař
f5015c2ea3 Merge branch 'QA_4_6-security' into master-security 2016-07-26 16:31:21 +02:00
Michal Čihař
99492bf42a Merge branch 'QA_4_6' into QA_4_6-security 2016-07-26 16:29:07 +02:00
Michal Čihař
22c4ede46d Merge branch 'QA_4_6' 2016-07-26 16:26:57 +02:00
Michal Čihař
6c95b73f90 Do not append session IDs to all URLs in redirect
There is no need to do that as we rely on session cookies anyway. Also
appending sesson ID to external URLs is not a good idea.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-26 16:20:04 +02:00
Michal Čihař
2adf1ca83e Merge branch 'QA_4_6-security' into master-security 2016-07-22 11:35:14 +02:00
Michal Čihař
3ba8a026fc Use hash_hmac for MAC rather than plain SHA1
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-18 16:56:52 +02:00
Michal Čihař
67d6eeac42 Improve URL filtering in url.php
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-18 16:39:25 +02:00
Michal Čihař
dfa389aa5a Merge branch 'QA_4_6-security' into master-security 2016-07-12 16:29:26 +02:00
Michal Čihař
ba072e42dc Validate serialized data before unserializing
We need only strings, integers or arrays, so there is no need to
unserialize strings containing any complex types.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-12 16:29:11 +02:00
Michal Čihař
5299b36983 Merge branch 'QA_4_6-security' into master-security 2016-07-12 15:15:15 +02:00
Michal Čihař
767195e197 Sanitize MySQL host name before connecting
It can contain p: prefix which we don't want to honor.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-12 15:14:57 +02:00
Michal Čihař
152386627a Merge branch 'QA_4_6-security' into master-security 2016-07-11 09:34:05 +02:00
Michal Čihař
660e3a177f Remove debugging code
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-11 09:33:13 +02:00
Michal Čihař
23c011df36 Move PMA_getIp to core
Signed-off-by: Michal Čihař <michal@cihar.com>
2016-07-11 08:36:55 +02:00
Michal Čihař
791bdafcdd Merge branch 'QA_4_6-security' into master-security 2016-06-17 16:24:39 +02:00
Michal Čihař
27caf5b46b Improve detection of script name
In case PHP_SELF was not set by server, we used REQUEST_URI, which might
embed PATH_INFO as well. However we really need to know the path without
it, so let's strip it as well.

Signed-off-by: Michal Čihař <michal@cihar.com>
2016-06-16 09:35:56 +02:00