-
Notifications
You must be signed in to change notification settings - Fork 807
Ransomware: bugfix for directories #1292
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
Conversation
…es to not be expanded
Codecov Report
@@ Coverage Diff @@
## develop #1292 +/- ##
===========================================
+ Coverage 30.68% 30.72% +0.04%
===========================================
Files 449 450 +1
Lines 13470 13475 +5
===========================================
+ Hits 4133 4140 +7
+ Misses 9337 9335 -2
Continue to review full report at Codecov.
|
@@ -55,7 +56,7 @@ def _find_files(self) -> List[Path]: | |||
return [] | |||
|
|||
return select_production_safe_target_files( | |||
Path(self._target_dir), self._valid_file_extensions_for_encryption | |||
Path(os.path.expandvars(self._target_dir)), self._valid_file_extensions_for_encryption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use expand_path()
from monkey_island/cc/server_utils/file_utils.py
It also expands "~" to "$HOME". We should probably add a validator to the Linux target directory input to allow paths that begin with "~".
from common.common_consts.telem_categories import TelemCategoryEnum | ||
from infection_monkey.telemetry.base_telem import BaseTelem | ||
from infection_monkey.telemetry.batchable_telem_mixin import BatchableTelemMixin | ||
from infection_monkey.telemetry.i_batchable_telem import IBatchableTelem | ||
|
||
|
||
class FileEncryptionTelem(BatchableTelemMixin, IBatchableTelem, BaseTelem): | ||
def __init__(self, filepath: Path, success: bool, error: str): | ||
def __init__(self, filepath: str, success: bool, error: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? All of the added calls to os.path.expandvars()
are wrapped in Path()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs unit tests 🙂 You can use "patched_home_env()" and take a look at test_island_config_options.py for examples.
In general, if we fix a bug, we should write a test to make sure the bug doesn't creep back in later.
f2019c1
to
53faf5a
Compare
What does this PR do?
Fixes a bug where windows environmental variables don't get expanded in encryption and readme features.
Traceback example of the bug:
PR Checklist
Testing Checklist