Crash when a third-party firewall refused to hand over a favicon.ico file
Open
Beginner friendly
Nobody has claimed this yet.
bug
- Dominant language
- JavaScript
- Stars
- 823
- Forks
- 117
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 8
Description
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
- Create a new credential or go to edit an existing one
- Add an URL with restricted favicon.ico (for example https://www.autodesk.com/)
- In the label section select the icon and from the "Pick an icon" window select "Get icon from page".
- 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;
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in passman/lib/Controller/IconController.php, especially the icon response handling around lines 58 and 93. Reproduce the restricted favicon.ico case from the listed steps and inspect how missing icon fields are handled. Done means the request no longer crashes when the firewall refuses the favicon, while normal icon responses still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100