Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ScanRar Emits Exception on Password-Protected Archives #441

Closed
ryanohoro opened this issue Mar 6, 2024 · 1 comment
Closed

[BUG] ScanRar Emits Exception on Password-Protected Archives #441

ryanohoro opened this issue Mar 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ryanohoro
Copy link
Collaborator

Describe the bug

{
  "elapsed": 0.003019,
  "exception": "Traceback (most recent call last):\n\n  File \"/strelka/strelka.py\", line 769, in scan_wrapper\n    self.scan(data, file, options, expire_at)\n\n  File \"/strelka/scanners/scan_rar.py\", line 79, in scan\n    data = rar_obj.open(\n\nTypeError: RarFile.open() got an unexpected keyword argument 'psw'\n",
  "flags": [
    "password_protected",
    "uncaught_exception"
  ],
  "host_os": "RAR_OS_WIN32",
  "total": {
    "extracted": 0,
    "files": 1
  }
}

Environment details

  • Operating System: Ubuntu 22.04
  • Architecture: x86-64

Steps to reproduce
Steps to reproduce the behavior:

  1. Upload a password-protected RAR archive created by WinRAR
  2. Observe ScanRar output contains an "uncaught exception"

Expected behavior

ScanRar should note that the archive is password protected and gracefully catch the exception

Release

  • Release: 0.24.01.18
@ryanohoro
Copy link
Collaborator Author

Root of this problem was that the password parameter name Strelka was using for python rarfile did not match the parameter name in the module.

data = rar_obj.open(
name,
mode="r",
psw=pw.decode("utf-8"),
)

https://python-unrar.readthedocs.io/en/v0.3/rarfile.html#rarfile.RarFile.open

This was a result of a breaking change introduced in rarfile 4 (2020-07-31)

rarfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant