Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log params of imagecreatefromstring #24543

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

PVince81
Copy link
Member

@PVince81 PVince81 commented Dec 4, 2020

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"
}

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

PVince81 commented Dec 4, 2020

/backport to stable20

To prevent flooding the log with actual image data.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81 PVince81 force-pushed the bugfix/noid/dont-log-image-as-string branch from 1e840c1 to 9b3361c Compare December 4, 2020 08:31
@PVince81
Copy link
Member Author

PVince81 commented Dec 4, 2020

rebased

@MorrisJobke MorrisJobke 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
Copy link

faily-bot bot commented Dec 4, 2020

🤖 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 master Dec 4, 2020
@MorrisJobke MorrisJobke deleted the bugfix/noid/dont-log-image-as-string branch December 4, 2020 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready 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