Describe the bug
Several difficult to debug issues can arise if there is an exception thrown within the large data loading try/except block in the data_svc. These issues are almost silent because the exception is logged at the debug level, which is not enabled by default.
To Reproduce
Steps to reproduce the behavior:
- Create an invalid adversary within a plugin.
- Start the server with
--fresh.
- Stockpile adversaries will not work because the default adversary objective was not created during initialization.
Recommended Fix
I recommend we reduce the scope of the try/except block to only cover the plugin loading (L290-296) and use another try/except to cover the async tasks (L298). We could also increase the log level of the associated except block, but that would be more of a subjective call.
|
try: |
|
async_tasks = [] |
|
if not plugins: |
|
plugins = [p for p in await self.locate('plugins') if p.data_dir and p.enabled] |
|
if not [plugin for plugin in plugins if plugin.data_dir == 'data']: |
|
plugins.append(Plugin(data_dir='data')) |
|
for plug in plugins: |
|
await self._load_payloads(plug) |
|
await self._load_abilities(plug, async_tasks) |
|
await self._load_objectives(plug) |
|
await self._load_adversaries(plug) |
|
await self._load_planners(plug) |
|
await self._load_sources(plug) |
|
await self._load_packers(plug) |
|
for task in async_tasks: |
|
await task |
|
await self._load_extensions() |
|
await self._load_data_encoders(plugins) |
|
await self.create_or_update_everything_adversary() |
|
await self._verify_data_sets() |
|
except Exception as e: |
|
self.log.debug(repr(e), exc_info=True) |
Desktop (please complete the following information):
- OS: Kali
- Browser: Firefox
- Version: 5.3
Describe the bug
Several difficult to debug issues can arise if there is an exception thrown within the large data loading try/except block in the
data_svc. These issues are almost silent because the exception is logged at the debug level, which is not enabled by default.To Reproduce
Steps to reproduce the behavior:
--fresh.Recommended Fix
I recommend we reduce the scope of the try/except block to only cover the plugin loading (L290-296) and use another try/except to cover the async tasks (L298). We could also increase the log level of the associated except block, but that would be more of a subjective call.
caldera/app/service/data_svc.py
Lines 283 to 304 in 3b796f3
Desktop (please complete the following information):