feat(tests): make Expected Detection editable when creating a test from template
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Leads can now edit Expected Detection in the create-from-template form, same as Suggested Attack Procedure — the edit seeds the new test's detect_procedure via a detect_procedure_override, without touching the template itself. The template only updates later through the existing procedure-suggestion approval flow, once a round is actually submitted — same mechanism as the red side, no new bypass.
This commit is contained in:
@@ -402,6 +402,7 @@ def create_test_from_template(
|
||||
platform_override=payload.platform,
|
||||
procedure_text_override=payload.procedure_text,
|
||||
tool_used_override=payload.tool_used,
|
||||
detect_procedure_override=payload.detect_procedure,
|
||||
)
|
||||
# Call log_action()
|
||||
log_action(
|
||||
|
||||
@@ -130,3 +130,4 @@ class TestTemplateInstantiate(BaseModel):
|
||||
platform: str | None = None
|
||||
procedure_text: str | None = None
|
||||
tool_used: str | None = None
|
||||
detect_procedure: str | None = None
|
||||
|
||||
@@ -304,6 +304,7 @@ def create_test_from_template(
|
||||
platform_override: str | None = None,
|
||||
procedure_text_override: str | None = None,
|
||||
tool_used_override: str | None = None,
|
||||
detect_procedure_override: str | None = None,
|
||||
) -> Test:
|
||||
"""Instantiate a Test from a TestTemplate.
|
||||
|
||||
@@ -364,7 +365,7 @@ def create_test_from_template(
|
||||
platform=platform_override if platform_override is not None else template.platform,
|
||||
procedure_text=procedure_text_override if procedure_text_override is not None else template.attack_procedure,
|
||||
tool_used=tool_used_override if tool_used_override is not None else template.tool_suggested,
|
||||
detect_procedure=template.expected_detection,
|
||||
detect_procedure=detect_procedure_override if detect_procedure_override is not None else template.expected_detection,
|
||||
remediation_steps=template.suggested_remediation,
|
||||
# Keyword argument: created_by
|
||||
created_by=creator_id,
|
||||
|
||||
Reference in New Issue
Block a user