nix-community / vulnix

Vulnerability (CVE) scanner for Nix/NixOS.
BSD 3-Clause "New" or "Revised" License
464 stars 35 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte #97

Open ztmr opened 5 months ago

ztmr commented 5 months ago
$ nix run nixpkgs#vulnix -- -S
Traceback (most recent call last):
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/bin/.vulnix-wrapped", line 9, in <module>
sys.exit(main())
^^^^^^
File "/nix/store/fslvacr1jmwrlhmf5dnc4avgfg4zvz92-python3.11-click-8.1.7/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/fslvacr1jmwrlhmf5dnc4avgfg4zvz92-python3.11-click-8.1.7/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/nix/store/fslvacr1jmwrlhmf5dnc4avgfg4zvz92-python3.11-click-8.1.7/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/fslvacr1jmwrlhmf5dnc4avgfg4zvz92-python3.11-click-8.1.7/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/lib/python3.11/site-packages/vulnix/main.py", line 157, in main
populate_store(store, gc_roots, profile,  paths)
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/lib/python3.11/site-packages/vulnix/main.py", line 60, in populate_store
store.add_path(path)
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/lib/python3.11/site-packages/vulnix/nix.py", line 134, in add_path
self.update(candidate)
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/lib/python3.11/site-packages/vulnix/nix.py", line 142, in update
drv_obj = load(drv_path)
^^^^^^^^^^^^^^
File "/nix/store/pa56ndfzj1a0i9gaflch2dibxpbxmsra-vulnix-1.10.1-unstable-2024-04-02/lib/python3.11/site-packages/vulnix/derivation.py", line 32, in load
d_obj = eval(f.read(), {'__builtins__': {}, 'Derive': Derive}, {})
^^^^^^^^
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbf in position 3292: invalid start byte
$ 
$ 
$ nix run nixpkgs#vulnix -- --version
vulnix 1.10.2.dev0
$ 
$ 
$ locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8
$

Tried setting Python-specific Unicode variables, using C.UTF-8 locale, etc. nothing helps. Tried with stable NixOS, unstable and master as well.

If I run Vulnix with -R, it is not failing, but obviously not doing what I wanted -- a full scan including deps...