-
Notifications
You must be signed in to change notification settings - Fork 39
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
Improved startup time #250
Changes from 4 commits
1f8c006
fe1f2fb
10ee287
075a2b4
51e272b
0fd7f62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,7 @@ def get_update_command(self): | |
*self._get_standard_options(), | ||
"-cmd", | ||
] | ||
if self.my_conf("miscOptions.updateAddons", default=True): | ||
if self.my_conf("miscOptions.updateAddons"): | ||
command.append("-addonupdate") | ||
|
||
addons = self.my_conf("miscOptions.additionalAddons", default=[]) | ||
|
@@ -191,6 +191,9 @@ def _setup_zap_cli(self): | |
""" | ||
self.zap_cli.extend(self._get_standard_options()) | ||
|
||
# Addon update has already been done, if enabled. Prevent a new check for update | ||
self.zap_cli.append("-silent") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering if this option will place nice with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It indeed does not play nice with |
||
|
||
# Create a session, to store them as evidence | ||
self.zap_cli.extend(["-newsession", f"{self.container_work_dir}/session_data/session"]) | ||
|
||
|
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'm not entirely sure if I understand correctly, so please bear with me. If
updateAddons
is not "truthy",get_update_command
method will return an empty list. In the_handle_plugins
function ofzap_podman
module, it seems that this would result in the command being["sh", "-c"]
plus thezap_cli
command. In this case, would it be better to skip thehandle_plugin
execution altogether similar to how it's handled inzap_none
?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.
yes, in zap_podman, the situation is a little dirty because, afaik, podman can run only a single command, and since we need to run the update separately from the scan, the code needs to cheat a little with a "sh -c '; '".
When there's no need to handle plugins, it's would probably be preferable to avoid this
sh -c
all together, especially if updateAddons is off by default.I will improve on that, such that and skip the
handle_plugin
when possibleThere 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, I tried to improve this a bit, but:
_handle_plugins()
can't actually do the same as its zap_none counterpart, because it can't actually run a podman command.I updated in this way:
_handle_plugins()
now simply returns the command to handle the plugins as a list (i.e.: empty list if there's nothing to do)run()
) will then either run the regular ZAP command if there are not plugin to be handled (now default), or bundle both the plugin command and the scan command in a singlesh
wrapper.Let me know if that's a better solution, or if we should approach it differently.
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.
This approach looks like a good improvement.
Just to understand better, why are both commands run in a single
podman
execution? Could they run separately in differentpodman
executions while sharing storage? I’m not suggesting a change, just curious about how it worksThere 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 should be doable, yes