Commit Graph

121 Commits

Author SHA1 Message Date
Git'Fellow
d753d04760
Move away from deprecated utf_encode() on PHP 8.2+
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2024-02-17 21:37:34 +01:00
Côme Chilliet
c0ce272e9c chore: Migrate away from OC::$server->getLogger
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-02-13 17:32:30 +01:00
Josh Richards
7a212b1f38 Fix log rotation notification level (warning->info)
Fixes #42537 

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
2023-12-31 20:26:39 -05:00
Faraz Samapoor
9fa9975bc9 Refactors lib/private/Log.
Mainly using PHP8's constructor property promotion.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2023-06-28 09:29:45 +03:30
Robin Appelman
d9fa7b1e28
emit an event when a message is logged
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-06-13 18:45:48 +02:00
Faraz Samapoor
e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +03:30
Côme Chilliet
426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 12:50:08 +02:00
Max
95a674e238
fix: treat text app session parameters as sensitive values
* `PublicSessionController create` receives a share token.
* The others receive the parameters for a text session:
  `document_id`, `session_id`, `session_token`.
  Even though these are relatively short lived
  they could be used to retrieve content from the document when leaked.

Signed-off-by: Max <max@nextcloud.com>
2023-03-01 13:03:47 +01:00
Côme Chilliet
f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +01:00
Julius Härtl
7daa20d309
fix(ExceptionSerializer): encode arguments before filtering the trace
This will avoid running into a Nesting level too deep error as the
encodeArg calls will limit potential recursive calls on the arguments to
a nesting level of 5

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-01-16 09:47:31 +01:00
Christoph Wurst
58a0740794
fix(logging): Fix array to string conversion in errorlog writer
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-12-19 09:31:55 +01:00
Christoph Wurst
94cebfea7c
chore(logging): Fix branding of errorlog log messages
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-12-05 19:28:05 +01:00
Christoph Wurst
4c8ec6dc89
Log all deprecations with debug level
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-11-02 09:49:37 +01:00
Christoph Wurst
052dcdebe8
Refactor the ErrorHandler into a dynamic class
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-11-02 09:49:37 +01:00
Carl Schwan
b888c61463
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
2022-08-23 16:55:42 +02:00
Carl Schwan
48d9c4d2b0
Port existing server code to new interface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-08-08 17:03:19 +02:00
Arthur Schiwon
2a6f46e689
allow apps to specify methods carrying sensitive parameters
… in order to remove them from logging.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-07-28 23:30:17 +02:00
blizzz
cf5452e633
Merge pull request #32242 from nextcloud/fix-logging-data-array
Fix logging data context to file
2022-06-21 18:49:08 +02:00
Arthur Schiwon
8b2b5946e6
make placeholder a const for reuse
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-06-16 18:38:29 +02:00
Arthur Schiwon
891c10d09d
fix overwriting original vars when logging
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-06-16 18:36:58 +02:00
Thomas Citharel
1e7d924c61
Fix logging data context to file
It was only logged when an exception was provided or when using
logData (which is not being much used).

We make sure the interpolated parameters are not logged.

Only tested with file write logger, but shouldn't work differently.

Crash reporters always had the context.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-05-02 19:29:35 +02:00
Joas Schilling
4c41abd816
Allow to get custom loggers for syslog, errorlog and systemdlog too
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-19 16:15:14 +01:00
Côme Chilliet
3a1b3745eb
Fix DateTime constructor calls with null
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:28:58 +01:00
Julius Härtl
b235a854d3
Always list the class of an object first
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-08-05 17:36:15 +02:00
Julius Härtl
950de74d1d
Set a maximum level of encoding nested arguments of exception traces
This will make sure that nested objects or arrays do not cause exceeding
the maximum nesting level of functions when parsing arguments of an
exception trace

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-08-05 17:35:52 +02:00
Lukas Reschke
b3ddc09895 Sanitize more functions from the encryption app
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-07-21 11:18:35 +02:00
Daniel Kesselberg
74fa8f3f84
Mask password for Redis and RedisCluster on connection failure
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-07-19 19:52:25 +02:00
Chih-Hsuan Yen
16c4991db6
Correctly skip suppressed errors in PHP 8.0
Applies the suggested transformation mentioned in
https://www.php.net/manual/en/migration80.incompatible.php,

> The @ operator will no longer silence fatal errors (E_ERROR,
> E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR,
> E_PARSE). Error handlers that expect error_reporting to be 0 when
> @ is used, should be adjusted to use a mask check instead

The new code still works on PHP 7, as error_reporting() already
returns 0 when diagnostics are suppressed.

This fixes https://github.com/nextcloud/server/issues/25807 in PHP 8.0.
For PHP 7.x, https://github.com/nextcloud/server/pull/22243 suppresses
the E_NOTICE message from the second session_start() call with the error
suppression operator @, and thus those E_NOTICE messages are still
logged in PHP 8.0.

See also https://github.com/nextcloud/server/issues/25806

Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
2021-07-13 13:23:03 +08:00
Gary Kim
b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
2021-06-30 15:28:02 -04:00
Pytal
9ed379da22
Merge pull request #27635 from nextcloud/fix/datetime-constants
Fix usage of DateTime constants
2021-06-23 09:56:28 -07:00
Christoph Wurst
770881d5d6
Move DateTime::ATOM to DateTimeInterface::ATOM
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-06-23 15:28:07 +02:00
blizzz
ee7a484284
Merge pull request #26346 from J0WI/clean-auth-regex
Cleaner removePassword regex
2021-06-23 11:20:19 +02:00
Julius Härtl
e536b7bbcc
Move exception logging to separate field
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-06-10 07:35:51 +02:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Joas Schilling
21ed3419f3
Log deprecation only as debug
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-26 16:19:03 +02:00
Joas Schilling
8d9e5e0b91
Respect the error level when logging
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-26 14:18:18 +02:00
J0WI
5f468c0248 Cleaner removePassword regex
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2021-03-27 18:42:58 +01:00
Christoph Wurst
d45692ee96
Migrate custom loggers to PSR
This will help phase out the deprecated ILogger interface.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-11 16:16:34 +01:00
Joas Schilling
847aa08ebd
Don't log keys on checkSignature
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-18 16:09:06 +01:00
Morris Jobke
59ae722087
Fix warning in PHP 8 about optional parameter before mandatory one
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-01-07 12:43:56 +01:00
Roeland Jago Douma
179de95f81
Avoid huge exception argument logging
In some cases it might happen that you have an argument that deep down
somewhere has an array with a lot of entries (think thousands). Now
before we would just happily print them all. Which would fill the log.

Now it will just print the first 5. And add a line that there are N
more.

If you are on debug level we will still print them all.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-12-29 10:50:53 +01:00
Christoph Wurst
d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
Vincent Petry
9b3361ce87
Don't log params of imagecreatefromstring
To prevent flooding the log with actual image data.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2020-12-04 09:30:20 +01:00
Christoph Wurst
d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +02:00
Julius Härtl
b0699d4126
Generate exception to log on php errors
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-09-29 08:54:53 +02:00
Christoph Wurst
2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +02:00
Christoph Wurst
ab303dddcd
Make the PSR-3 adapter exception-aware
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-14 09:38:51 +02:00
Morris Jobke
065ef14cb0
Move OC_Mount_Config to proper classname and remove OC::$CLASSPATH usage in files_external
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-10 00:02:59 +02:00
J0WI
6ca1599ea4 Fix chmod on file descriptor
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2020-07-03 20:53:58 +02:00
Joas Schilling
a7f26cfe28
Don't log Keys
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-19 13:44:27 +02:00