-
Notifications
You must be signed in to change notification settings - Fork 786
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
ZeroTrust performance fixes #645
Conversation
…s rather than real exploitation
… performance info
# Conflicts: # envs/monkey_zoo/blackbox/test_blackbox.py # monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js
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.
Some questions and minor comments.
I'd also like to see the test status and/or the profile info posted in the PR discussion for future reference
assert (len(existing_findings) < 2), "More than one finding exists for {}:{}".format(test, status) | ||
|
||
if len(existing_findings) == 0: | ||
Finding.save_finding(test, status, events) | ||
else: | ||
# Now we know for sure this is the only one | ||
orig_finding = existing_findings[0] | ||
orig_finding.add_events(events) | ||
orig_finding.update(push_all__events=events) |
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.
Please add a comment explaining what this is doing, why this is better, and link to the documentation
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 do we need to reimplement mongoengine methods? It's error prone and adds lines of code that are not necessary. https://github.com/guardicore/pyinstaller/blob/develop/bootloader/src/old_machine_common_functions.c
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.
Not sure what the link should be telling me, but I agree - just adding a link to the method's documentation will help
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.
Ohh, you were talking about commenting the method in the code? Ok, I'll improve
self.assertListEqual([], ZeroTrustService._ZeroTrustService__get_events_without_overlap(5, [1, 2, 3])) | ||
self.assertListEqual([3], ZeroTrustService._ZeroTrustService__get_events_without_overlap(6, [1, 2, 3])) | ||
self.assertListEqual([1, 2, 3, 4, 5], ZeroTrustService._ZeroTrustService__get_events_without_overlap(10, [1, 2, 3, 4, 5])) |
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.
If we're using something it's better to not name-mangle it... this test will break when we rename the class
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.
So you suggest to rename __get_events_without_overlap
?
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.
I suggest making it not protected with __
but rather just mark it as "private" with a single _
.
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.
So we are talking about the same thing :) I wanted to be consistent at least on the module scope. Why are methods mangled there anyway?
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.
I agree we should be consistent - you can rename all of them to not be mangled, I think that would be better
PROFILER_LOG_DIR = "./profiler_logs/" | ||
|
||
|
||
def profile(sort_args=['cumulative'], print_args=[100]): |
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.
Some usage documentation and examples would be useful
Also, not all unit tests are passing - please fix them :) |
monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SkippedEventsTimeline.js
Show resolved
Hide resolved
.gitignore
Outdated
# Profiling logs | ||
/monkey/profiler_logs/ | ||
|
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.
Won't that depend on the working directory from which you execute stuff which might change, let's say when you're running UTs?
Probs safer to ignore all directories called profiler_logs
# Profiling logs | |
/monkey/profiler_logs/ | |
# Profiling logs | |
profiler_logs/ |
UT's fail because of similar issue mongomock/mongomock#625 |
5301402
to
44cb87a
Compare
What is this?
@profile()
decorator that outputs profiling info of method decorated.Checklist
Proof that it works
If applicable, add screenshots or log transcripts of the feature working