obsidianforensics / unfurl

Extract and Visualize Data from URLs using Unfurl
http://unfurl.link
Apache License 2.0
589 stars 60 forks source link

unfurl crashes with new Flask 2.2.0 version #156

Closed jkppr closed 1 year ago

jkppr commented 1 year ago

Problem

When trying to deploy unfurl following the instruction in the readme file the application crashes with the following error:

# python unfurl_cli.py
Traceback (most recent call last):
  File "/home/user/unfurl/unfurl_cli.py", line 20, in <module>
    from unfurl import core
  File "/home/user/unfurl/unfurl/core.py", line 26, in <module>
    from flask_restx import Api, Namespace, Resource
  File "/home/user/venv-unfurl/lib/python3.10/site-packages/flask_restx/__init__.py", line 5, in <module>
    from .api import Api  # noqa
  File "/home/user/venv-unfurl/lib/python3.10/site-packages/flask_restx/api.py", line 50, in <module>
    from .swagger import Swagger
  File "/home/user/venv-unfurl/lib/python3.10/site-packages/flask_restx/swagger.py", line 18, in <module>
    from werkzeug.routing import parse_rule
ImportError: cannot import name 'parse_rule' from 'werkzeug.routing' (/home/user/venv-unfurl/lib/python3.10/site-packages/werkzeug/routing/__init__.py)

Possible reason: It looks like the Flask package was recently updated to version 2.2.0 which seems to change how the Werkzeug package is used. And that breaks unfurl :(

How to reproduce

  1. Clone unfurl
  2. Install the current requirements via pip -r requirements.txt in a fresh venv
  3. Try to run python unfurl_cli.py

Possible solution

According to my tests this can be fixed short-term by pinning the flask and Werkzeug package version in the requirements.txt file.

flask==2.1.3
flask-restx
flask_cors
maclookup
networkx
protobuf == 3.*
publicsuffix2
pycountry
pymispwarninglists >= 1.3
Requests
setuptools
torf
ulid-py
Werkzeug==2.1.2

I'll send a PR to fix this.