Commit Graph

140 Commits (jtr/fix-public-exceptions-http-codes)

Author SHA1 Message Date
Kent Delante eb58d2bb5a fix(syslog): open syslog channel on write
This fixes a bug where only one tag gets used when multiple tags have
been configured (e.g. different tags for 'syslog_tag' and 'syslog_tag_audit')

Signed-off-by: Kent Delante <kent.delante@proton.me>
2025-07-02 09:14:33 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Salvatore Martire 5fef6f1c90 fix: make rotate logs a TimedJob and run every hour
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
2025-06-24 09:55:23 +07:00
Christoph Wurst e736823fc7
fix(log): map all warnings to warn log level, notice to info
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2025-05-27 08:01:19 +07:00
Côme Chilliet 2b4bfcc212 fix(log): Only log client request id if present, and at the end
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-05-14 00:35:21 +07:00
Côme Chilliet 4c25654574 feat(log): Log the request id sent with the request
This should help matching client logs with server logs, hopefully.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-05-14 00:35:21 +07:00
Arthur Schiwon fe52a03ff8
fix(Log): revert swich to ?? operator
false is expected, not null. The changed caused "user" in the log files
to be false instead of "--", which is breaking behaviour.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2025-04-17 14:26:38 +07:00
Joas Schilling 8952a4cb77
fix(logger): Fix closure detection when filtering sensitive parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-11-08 12:59:14 +07:00
Ferdinand Thiessen f3aa004b1c
refactor(encryption): Migrate away from Hooks to typed events
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Louis <louis@chmn.me>
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-10-15 18:33:06 +07:00
Joas Schilling a90921e239
fix(logger): Remove more parameters of other methods
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-10-07 21:04:49 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Ferdinand Thiessen 5cce140701
chore: Remove deprecated `ILogger` logging functions
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-09-19 00:37:06 +07:00
Christoph Wurst c57e684e7b
fix: Handle null checks with the ?? operator
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 21:50:11 +07:00
Christoph Wurst 614f9ec0a2
refactor: Use the elvis operator
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 21:01:34 +07:00
Ferdinand Thiessen 81df2d2c12
feat(PsrLoggerAdapter): Allow to use `Psr\Log\LogLevel` for `log` method
There is the `Psr\Log\LogLevel` class defining loglevel constants,
to be fully compatible we should at least support those logging levels.
Moreover this is the last part that was still required from `ILogger` interface,
as we did not have alternatives for the loglevel constants.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-09-14 17:35:11 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Marcel Klehr 4a3b9b826e refactor: identifier is now customId/custom_id
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2024-05-14 11:38:41 +07:00
Ferdinand Thiessen f06bf0413d
fix(PsrLoggerAdapter): Adjust code to comply with v2 of Psr\Log (allow \Stringable as message)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-04-16 11:51:04 +07:00
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 +07: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 +07: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 +07: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 +07:00
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 +07: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 +07:00
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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Carl Schwan b888c61463
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
2022-08-23 16:55:42 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Gary Kim b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
2021-06-30 15:28:02 +07: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 +07:00