Skip to content

Commit 75fc6dc

Browse files
Naum Rabichclaude
andcommitted
[feat/VM-7321] Lifecycle management updates to pyTenable APA schemas
- Add `accepted` to technique StatusEnum (Pydantic) and Marshmallow validation (VM-7321) - Add PathStatusEnum and `path_status` field to VectorRow (Pydantic) (VM-7287) - Add `path_status` field to VectorSchema (Marshmallow) with validation (VM-7287) - Add path_status filter example to top_attack_paths_search docs (VM-7288) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f5c9067 commit 75fc6dc

5 files changed

Lines changed: 32 additions & 2 deletions

File tree

tenable/apa/findings/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class FindingSchema(Schema):
4646
vectorCount = fields.Int(allow_none=True)
4747
state = fields.Str(validate=v.OneOf(["open", "archive"]))
4848
status = fields.Str(validate=v.OneOf(["in_progress", "done",
49-
"to_do", "in_review"]))
49+
"to_do", "in_review",
50+
"accepted"]))
5051
created = fields.Int(allow_none=True)
5152
is_active = fields.Bool(allow_none=True)
5253
has_history = fields.Bool(allow_none=True)

tenable/apa/vectors/schema.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from marshmallow import fields, Schema
1+
from marshmallow import fields, validate as v, Schema
22

33

44
class SourceInformationSchema(Schema):
@@ -42,6 +42,11 @@ class VectorSchema(Schema):
4242
summary = fields.Str(allow_none=True)
4343
first_aes = fields.Raw(allow_none=True)
4444
last_acr = fields.Int(allow_none=True)
45+
path_status = fields.Str(validate=v.OneOf(["to_do", "in_progress",
46+
"in_review", "done",
47+
"chain_prevented",
48+
"accepted"]),
49+
allow_none=True)
4550

4651

4752
class VectorsPageSchema(Schema):

tenable/tenableone/attack_path/findings/schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class StatusEnum(Enum):
2121
done = "done"
2222
to_do = "to_do"
2323
in_review = "in_review"
24+
accepted = "accepted"
2425

2526

2627
class NodeInfoSchema(BaseModel):

tenable/tenableone/attack_path/vectors/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ def top_attack_paths_search(
190190
>>> for attack_path in response.data:
191191
... print(f"Attack Path: {attack_path.name}, Priority: {attack_path.priority}")
192192
193+
Filter by path_status to get only actionable paths
194+
195+
>>> filter_data = {
196+
... "property": "path_status",
197+
... "operator": "in",
198+
... "value": ["to_do", "in_progress", "in_review"]
199+
... }
200+
>>> response = t1.attack_path.vectors.top_attack_paths_search(
201+
... filter=filter_data
202+
... )
203+
193204
Simple search with default parameters
194205
195206
>>> response = t1.attack_path.vectors.top_attack_paths_search()

tenable/tenableone/attack_path/vectors/schema.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
from enum import Enum
2+
13
from pydantic import BaseModel, RootModel
24
from typing import List, Optional, Any, Union
35

46

7+
class PathStatusEnum(Enum):
8+
to_do = "to_do"
9+
in_progress = "in_progress"
10+
in_review = "in_review"
11+
done = "done"
12+
chain_prevented = "chain_prevented"
13+
accepted = "accepted"
14+
15+
516
class SourceInformationSchema(BaseModel):
617
provider_detection_id: Optional[str] = None
718
detection_code: Optional[str] = None
@@ -79,6 +90,7 @@ class VectorRow(BaseModel):
7990
summary: Optional[str] = None
8091
first_aes: Optional[float] = None
8192
last_acr: Optional[int] = None
93+
path_status: Optional[PathStatusEnum] = None
8294

8395

8496
class DiscoverPageTableResponse(BaseModel):

0 commit comments

Comments
 (0)