Skip to content

Crash when a third-party firewall refused to hand over a favicon.ico file #858

Description

@sm1000

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Create a new credential or go to edit an existing one
  2. Add an URL with restricted favicon.ico (for example https://www.autodesk.com/)
  3. In the label section select the icon and from the "Pick an icon" window select "Get icon from page".
  4. The Nextcloud log file will present an error

Expected behaviour

The expectation is PassMan to ignore the icon request if a third-party firewall refuse to hand over a favicon.ico file.

Solution (valid for PHP 8.0+)

Open the file ../passman/lib/Controller/IconController.php

Go to line 58 and find

if ($icon->icoExists) {
  $icon_json['type'] = $icon->icoType;
  $icon_json['content'] = base64_encode($icon->icoData);
  return new JSONResponse($icon_json);
}

Replace it with

if (isset($icon->icoExists) && $icon->icoExists) {
  $icon_json['type'] = isset($icon->icoType) ? $icon->icoType : 'png';
  $icon_json['content'] = isset($icon->icoData) ? base64_encode($icon->icoData) : '';
  return new JSONResponse($icon_json);
}

Go to line 93 and find

if ($icon->icoExists) {
  $data = $icon->icoData;
  $type = $icon->icoType;
}

Replace it with

if (isset($icon->icoExists) && $icon->icoExists) {
  if (isset($icon->icoData)) {
    $data = $icon->icoData;
  }
  if (isset($icon->icoType)) {
    $type = $icon->icoType;
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions