Skip to content

Don't log params of imagecreatefromstring - #24543

Merged
MorrisJobke merged 1 commit into
masterfrom
bugfix/noid/dont-log-image-as-string
Dec 4, 2020
Merged

Don't log params of imagecreatefromstring#24543
MorrisJobke merged 1 commit into
masterfrom
bugfix/noid/dont-log-image-as-string

Conversation

@PVince81

Copy link
Copy Markdown
Member

To prevent flooding the log with actual image data.

Found these in my logs of NC 20.0.2:

{
"reqId": "Tr2WqCKLqkjqLVmQaQfq",
"level": 3,
"time": "2020-12-02T17:48:54+00:00",
"remoteAddr": "77.190.205.171",
"user": "vincent",
"app": "PHP",
"method": "GET",
"url": "/index.php/apps/files/api/v1/thumbnail/256/256/favpics/dsc03277.jpg",
"message": {
"Exception": "Error",
"Message": "imagecreatefromstring(): Data is not in a recognized format at /var/www/html/nextcloud/lib/private/legacy/OC_Image.php#624",
"Code": 0,
"Trace": [
{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [
2,
"imagecreatefromstring(): Data is not in a recognized format",
"/var/www/html/nextcloud/lib/private/legacy/OC_Image.php",
624,
{
"imagePath": "/mnt/data/nextcloud/vincent/files/favpics/dsc03277.jpg",
"iType": false
}
]
},
{
"file": "/var/www/html/nextcloud/lib/private/legacy/OC_Image.php",
"line": 624,
"function": "imagecreatefromstring",
"args": [
"UYDAL4mwZf941QdkVy0dq6LK4............."
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Preview/Image.php",
"line": 52,
"function": "loadFromFile",
"class": "OC_Image",
"type": "->",
"args": [
"/mnt/data/nextcloud/vincent/files/favpics/dsc03277.jpg"
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Preview/GeneratorHelper.php",
"line": 63,
"function": "getThumbnail",
"class": "OC\\Preview\\Image",
"type": "->",
"args": [
{
"__class__": "OC\\Files\\Node\\File"
},
4096,
4096
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
"line": 244,
"function": "getThumbnail",
"class": "OC\\Preview\\GeneratorHelper",
"type": "->",
"args": [
{
"__class__": "OC\\Preview\\JPEG"
},
{
"__class__": "OC\\Files\\Node\\File"
},
4096,
4096
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
"line": 140,
"function": "getMaxPreview",
"class": "OC\\Preview\\Generator",
"type": "->",
"args": [
{
"__class__": "OC\\Files\\SimpleFS\\SimpleFolder"
},
{
"__class__": "OC\\Files\\Node\\File"
},
"image/jpeg",
""
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
"line": 109,
"function": "generatePreviews",
"class": "OC\\Preview\\Generator",
"type": "->",
"args": [
{
"__class__": "OC\\Files\\Node\\File"
},
[
{
"width": 256,
"height": 256,
"crop": true,
"mode": "fill"
}
],
"image/jpeg"
]
},
{
"file": "/var/www/html/nextcloud/lib/private/PreviewManager.php",
"line": 190,
"function": "getPreview",
"class": "OC\\Preview\\Generator",
"type": "->",
"args": [
{
"__class__": "OC\\Files\\Node\\File"
},
256,
256,
true,
"fill",
null
]
},
{
"file": "/var/www/html/nextcloud/apps/files/lib/Controller/ApiController.php",
"line": 128,
"function": "getPreview",
"class": "OC\\PreviewManager",
"type": "->",
"args": [
{
"__class__": "OC\\Files\\Node\\File"
},
256,
256,
true
]
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 169,
"function": "getThumbnail",
"class": "OCA\\Files\\Controller\\ApiController",
"type": "->",
"args": [
256,
256,
{
"__class__": "OC\\Files\\Node\\File"
}
]
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 100,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
{
"__class__": "OCA\\Files\\Controller\\ApiController"
},
"getThumbnail"
]
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
"line": 152,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
{
"__class__": "OCA\\Files\\Controller\\ApiController"
},
"getThumbnail"
]
},
{
"file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
"line": 308,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": ": : ",
"args": [
"APIController",
"getThumbnail",
{
"__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
},
{
"action": null,
"x": "256",
"y": "256",
"file": "favpics/dsc03277.jpg",
"_route": "files.API.getThumbnail"
}
]
},
{
"file": "/var/www/html/nextcloud/lib/base.php",
"line": 1009,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/apps/files/api/v1/thumbnail/256/256/favpics/dsc03277.jpg"
]
},
{
"file": "/var/www/html/nextcloud/index.php",
"line": 37,
"function": "handleRequest",
"class": "OC",
"type": ": : ",
"args": []
}
],
"File": "/var/www/html/nextcloud/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0(Android)Nextcloud-android/3.14.1",
"version": "20.0.1.1"
}

@PVince81PVince81 added the 3. to review Waiting for reviews label Dec 4, 2020
@PVince81PVince81 added this to the Nextcloud 21 milestone Dec 4, 2020
@PVince81PVince81 self-assigned this Dec 4, 2020
@PVince81

Copy link
Copy Markdown
MemberAuthor

/backport to stable20

Comment threadlib/private/Log/ExceptionSerializer.php Outdated
To prevent flooding the log with actual image data.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81
PVince81force-pushed the bugfix/noid/dont-log-image-as-string branch from 1e840c1 to 9b3361cCompareDecember 4, 2020 08:31
@PVince81

Copy link
Copy Markdown
MemberAuthor

rebased

@MorrisJobkeMorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 4, 2020
@faily-bot

faily-botBot commented Dec 4, 2020

Copy link
Copy Markdown

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 183: failure

checkers

Show full log
The autoloaders are not up to date
Please run: bash build/autoloaderchecker.sh
And commit the result

mysql5.6-php7.3

Show full log
There were 2 warnings:
1) Test\Files\ViewTest::testRenameFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static
2) Test\Files\ViewTest::testCopyFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static
--
There was 1 failure:
1) Test\Share20\DefaultShareProviderTest::testDeleteGroupShareWithUserGroupShares
Failed asserting that an array is empty.
/drone/src/tests/lib/Share20/DefaultShareProviderTest.php:581

@MorrisJobke
MorrisJobke merged commit 3c62d2b into masterDec 4, 2020
@MorrisJobke
MorrisJobke deleted the bugfix/noid/dont-log-image-as-string branch December 4, 2020 09:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@PVince81@MorrisJobke@ChristophWurst