mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 03:48:09 +00:00
expose supervisor tasks that are fully self-contained fuzzing tasks in the service (#474)
Exposes the functionality added in #454 to the service & CLI. Fixes #439
This commit is contained in:
@ -92,6 +92,25 @@ def check_containers(definition: TaskDefinition, config: TaskConfig) -> None:
|
||||
)
|
||||
|
||||
|
||||
def check_target_exe(config: TaskConfig, definition: TaskDefinition) -> None:
|
||||
if config.task.target_exe is None:
|
||||
if TaskFeature.target_exe in definition.features:
|
||||
raise TaskConfigError("missing target_exe")
|
||||
|
||||
if TaskFeature.target_exe_optional in definition.features:
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
container = [x for x in config.containers if x.type == ContainerType.setup][0]
|
||||
if not blob_exists(container.name, config.task.target_exe, StorageType.corpus):
|
||||
err = "target_exe `%s` does not exist in the setup container `%s`" % (
|
||||
config.task.target_exe,
|
||||
container.name,
|
||||
)
|
||||
LOGGER.warning(err)
|
||||
|
||||
|
||||
def check_config(config: TaskConfig) -> None:
|
||||
if config.task.type not in TASK_DEFINITIONS:
|
||||
raise TaskConfigError("unsupported task type: %s" % config.task.type.name)
|
||||
@ -132,14 +151,7 @@ def check_config(config: TaskConfig) -> None:
|
||||
else:
|
||||
raise TaskConfigError("either the vm or pool must be specified")
|
||||
|
||||
if TaskFeature.target_exe in definition.features:
|
||||
container = [x for x in config.containers if x.type == ContainerType.setup][0]
|
||||
if not blob_exists(container.name, config.task.target_exe, StorageType.corpus):
|
||||
err = "target_exe `%s` does not exist in the setup container `%s`" % (
|
||||
config.task.target_exe,
|
||||
container.name,
|
||||
)
|
||||
LOGGER.warning(err)
|
||||
check_target_exe(config, definition)
|
||||
|
||||
if TaskFeature.generator_exe in definition.features:
|
||||
container = [x for x in config.containers if x.type == ContainerType.tools][0]
|
||||
@ -253,6 +265,12 @@ def build_task_config(
|
||||
if TaskFeature.target_exe in definition.features:
|
||||
config.target_exe = "setup/%s" % task_config.task.target_exe
|
||||
|
||||
if (
|
||||
TaskFeature.target_exe_optional in definition.features
|
||||
and task_config.task.target_exe
|
||||
):
|
||||
config.target_exe = "setup/%s" % task_config.task.target_exe
|
||||
|
||||
if TaskFeature.target_env in definition.features:
|
||||
config.target_env = task_config.task.target_env or EMPTY_DICT
|
||||
|
||||
|
@ -232,7 +232,7 @@ TASK_DEFINITIONS = {
|
||||
),
|
||||
ContainerDefinition(
|
||||
type=ContainerType.tools,
|
||||
compare=Compare.Equal,
|
||||
compare=Compare.AtMost,
|
||||
value=1,
|
||||
permissions=[ContainerPermission.Read, ContainerPermission.List],
|
||||
),
|
||||
@ -252,6 +252,36 @@ TASK_DEFINITIONS = {
|
||||
ContainerPermission.List,
|
||||
],
|
||||
),
|
||||
ContainerDefinition(
|
||||
type=ContainerType.unique_reports,
|
||||
compare=Compare.AtMost,
|
||||
value=1,
|
||||
permissions=[
|
||||
ContainerPermission.Write,
|
||||
ContainerPermission.Read,
|
||||
ContainerPermission.List,
|
||||
],
|
||||
),
|
||||
ContainerDefinition(
|
||||
type=ContainerType.reports,
|
||||
compare=Compare.AtMost,
|
||||
value=1,
|
||||
permissions=[
|
||||
ContainerPermission.Write,
|
||||
ContainerPermission.Read,
|
||||
ContainerPermission.List,
|
||||
],
|
||||
),
|
||||
ContainerDefinition(
|
||||
type=ContainerType.no_repro,
|
||||
compare=Compare.AtMost,
|
||||
value=1,
|
||||
permissions=[
|
||||
ContainerPermission.Write,
|
||||
ContainerPermission.Read,
|
||||
ContainerPermission.List,
|
||||
],
|
||||
),
|
||||
],
|
||||
monitor_queue=None,
|
||||
),
|
||||
|
Reference in New Issue
Block a user