django-mfa2 icon indicating copy to clipboard operation
django-mfa2 copied to clipboard

Issue with FIDO2 dependency

Open swainn opened this issue 4 years ago • 6 comments

I've run into this issue with the django-mfa2 package today (see error below). Looks like the FIDO2 package released some breaking changes. I'd advise to either update django-mfa2 with these changes or pin the FIDO2 dependency.

Traceback (most recent call last):
  File "/Users/runner/work/tethys/tethys/tethys_portal/manage.py", line 20, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 75, in handle
    self.check(databases=[database])
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/management/base.py", line 419, in check
    all_issues = checks.run_checks(
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/urls/resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/runner/work/tethys/tethys/tethys_portal/urls.py", line 20, in <module>
    from tethys_portal.views import accounts as tethys_portal_accounts, \
  File "/Users/runner/work/tethys/tethys/tethys_portal/views/accounts.py", line 15, in <module>
    from mfa.helpers import has_mfa
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/mfa/helpers.py", line 3, in <module>
    from . import TrustedDevice, U2F, FIDO2, totp
  File "/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/mfa/FIDO2.py", line 1, in <module>
    from fido2.client import ClientData
ImportError: cannot import name 'ClientData' from 'fido2.client' (/Users/runner/miniconda/envs/tethys/lib/python3.10/site-packages/fido2/client.py)

swainn avatar Jun 10 '22 20:06 swainn

@ezrajrice FYI

swainn avatar Jun 10 '22 20:06 swainn

Hello @swainn

Which version of fido2 are you using? The library is pinned 0.9.3 and I'll try to integrate FIDO2 v1.0 with v2.5 (which we are currently working on)

mkalioby avatar Jun 11 '22 10:06 mkalioby

Somehow version 1.0 is getting installed in our environment. I think it needs to be pinned in the Conda package. I can take care of that until 2.5 is released.

swainn avatar Jun 13 '22 17:06 swainn

@mkalioby that was the issue. The dependency wasn't constrained on the Conda Forge package. That's where I had installed it from. I just merged a fix for that on the conda-forge feedstock. An updated package with the fido2 dependency should be available soon.

swainn avatar Jun 13 '22 17:06 swainn

@swainn, I have released django-mfa2 v2.5 as beta on pip, is there a similar way on Conda.

mkalioby avatar Jun 16 '22 17:06 mkalioby

Great news @mkalioby ! There is a mechanism for releasing pre-release builds on conda-forge. See: https://conda-forge.org/docs/maintainer/knowledge_base.html#pre-release-builds

swainn avatar Jun 17 '22 15:06 swainn