feat(api): add accept header text/plain to attack paths query endpoints for support llm-friendly output (#10162)

Co-authored-by: Adrián Jesús Peña Rodríguez <adrianjpr@gmail.com>
This commit is contained in:
Josema Camacho
2026-02-26 12:53:58 +01:00
committed by GitHub
parent 902558f2d4
commit b3a67fa1a0
11 changed files with 677 additions and 70 deletions
@@ -62,6 +62,27 @@ INTERNAL_LABELS: list[str] = [
*[config.deprecated_resource_label for config in PROVIDER_CONFIGS.values()],
]
# Provider isolation properties
PROVIDER_ISOLATION_PROPERTIES: list[str] = [
"_provider_id",
"_provider_element_id",
"provider_id",
"provider_element_id",
]
# Cartography bookkeeping metadata
CARTOGRAPHY_METADATA_PROPERTIES: list[str] = [
"lastupdated",
"firstseen",
"_module_name",
"_module_version",
]
INTERNAL_PROPERTIES: list[str] = [
*PROVIDER_ISOLATION_PROPERTIES,
*CARTOGRAPHY_METADATA_PROPERTIES,
]
# Provider Config Accessors
# -------------------------
@@ -14,6 +14,7 @@ from api.attack_paths import database as graph_database
from tasks.jobs.attack_paths.config import (
BATCH_SIZE,
DEPRECATED_PROVIDER_RESOURCE_LABEL,
PROVIDER_ISOLATION_PROPERTIES,
PROVIDER_RESOURCE_LABEL,
)
from tasks.jobs.attack_paths.indexes import IndexType, create_indexes
@@ -199,11 +200,6 @@ def sync_relationships(
def _strip_internal_properties(props: dict[str, Any]) -> None:
"""Remove internal properties that shouldn't be copied during sync."""
for key in [
"_provider_element_id",
"_provider_id",
"provider_element_id", # Deprecated
"provider_id", # Deprecated
]:
"""Remove provider isolation properties before the += spread in sync templates."""
for key in PROVIDER_ISOLATION_PROPERTIES:
props.pop(key, None)