|
18 | 18 | from utils.query_helpers import create_standard_response
|
19 | 19 |
|
20 | 20 | # Configure logging
|
21 |
| -log = logging.getLogger(__name__) |
22 | 21 | logging.basicConfig(format="%(asctime)s-%(process)d-%(levelname)s- %(message)s", level=os.environ.get("LOGLEVEL", "ERROR"))
|
| 22 | +log = logging.getLogger(__name__) |
23 | 23 |
|
24 | 24 | # Load app config (expects keys: mcp.host, mcp.port, mcp.transport)
|
25 | 25 | app_config = get_app_config()
|
@@ -69,12 +69,143 @@ def tool_list_resources(
|
69 | 69 | Field(
|
70 | 70 | description=(
|
71 | 71 | """
|
72 |
| - Sysdig Secure filter expression for inventory resources, |
73 |
| - base filter: platform in ("GCP", "AWS", "Azure", "Kubernetes"), |
74 |
| - Examples: |
75 |
| - not isExposed exists; category in ("IAM") and isExposed exists; category in ("IAM","Audit & Monitoring") |
| 72 | + Use the filter-query-language to filter the results. |
| 73 | + |
| 74 | + List of supported fields: |
| 75 | + - field: accountName |
| 76 | + Description: The account name that will be included in the results. |
| 77 | + - field: accountId |
| 78 | + Description: The account id that will be included in the results. |
| 79 | + - field: cluster |
| 80 | + Description: The kubernetes cluster that will be included in the results. |
| 81 | + - field: externalDNS |
| 82 | + Description: The external DNS that will be included in the results. |
| 83 | + - field: distribution |
| 84 | + Description: The kubernetes distribution that will be included in the results. |
| 85 | + - field: integrationName |
| 86 | + Description: The name of the integration an IaC resource belongs to. |
| 87 | + - field: labels |
| 88 | + Description: The resource labels that will be included in the results. |
| 89 | + - field: location |
| 90 | + Description: The web address of an IaC Manifest. |
| 91 | + - field: name |
| 92 | + Description: The names that will be included in the results. |
| 93 | + - field: namespace |
| 94 | + Description: The namespace that will be included in the results. |
| 95 | + - field: nodeType |
| 96 | + Description: The nodeType that will be included in the results. |
| 97 | + - field: osName |
| 98 | + Description: The operating system that will be included in the results. |
| 99 | + - field: osImage |
| 100 | + Description: The operating system image that will be included in the results. |
| 101 | + - field: organization |
| 102 | + Description: The organization that will be included in the results. |
| 103 | + - field: platform |
| 104 | + Description: The platform that will be included in the results. |
| 105 | + - field: control.accepted |
| 106 | + Description: Include (or Exclude) only resources with accepted results. |
| 107 | + Supported operators: exists and not exists. |
| 108 | + - field: policy |
| 109 | + Description: Include resources that applied the selected policies. |
| 110 | + Supported operators: in, not in, exists, not exists. |
| 111 | + - field: control.severity |
| 112 | + Description: Include resources that have violated risks in the selected severities. |
| 113 | + Supported operators: in, not in. |
| 114 | + - field: control.failed |
| 115 | + Description: Include resources that have violated the selected risks. |
| 116 | + Supported operators: in, not in, exists, not exists. |
| 117 | + - field: policy.failed |
| 118 | + Description: Include resources that failed the selected policies. |
| 119 | + Supported operators: in, not in, exists, not exists. |
| 120 | + - field: policy.passed |
| 121 | + Description: Include resources that passed the selected policies. |
| 122 | + Supported operators: in, not in, exists, not exists. |
| 123 | + - field: projectName |
| 124 | + Description: The project name that will be included in the results. |
| 125 | + - field: projectId |
| 126 | + Description: The project id that will be included in the results. |
| 127 | + - field: region |
| 128 | + Description: The regions that will be included in the results. |
| 129 | + - field: repository |
| 130 | + Description: The Repository an IaC resource belongs to. |
| 131 | + - field: resourceOrigin |
| 132 | + Description: Origin of the resource. Supported values: Code, Deployed. |
| 133 | + - field: type |
| 134 | + Description: The resource types that will be included in the results. |
| 135 | + - field: subscriptionName |
| 136 | + Description: The Azure subscription name that will be included in the results. |
| 137 | + - field: subscriptionId |
| 138 | + Description: The Azure subscription id that will be included in the results. |
| 139 | + - field: sourceType |
| 140 | + Description: The source type of an IaC resource. |
| 141 | + Supported values: YAML, Kustomize, Terraform, Helm. |
| 142 | + - field: version |
| 143 | + Description: OCP Cluster versions that will be included in the results. |
| 144 | + - field: zone |
| 145 | + Description: The zones that will be included in the results. |
| 146 | + - field: category |
| 147 | + Description: The category that will be included in the results. |
| 148 | + Supported operators: in, not in. |
| 149 | + - field: isExposed |
| 150 | + Description: Specifies whether the resource to return is exposed to the internet. |
| 151 | + Supported operators: exists and not exists. |
| 152 | + - field: validatedExposure |
| 153 | + Description: Specifies whether the resource to return is exposed to the internet and could be reach |
| 154 | + by our network exposure validator. Supported operators: exists and not exists. |
| 155 | + - field: arn |
| 156 | + Description: The AWS ARN of the resource. |
| 157 | + - field: resourceId |
| 158 | + Description: The Azure or GCP Resource Identifier of the resource. |
| 159 | + - field: container.name |
| 160 | + Description: Filters the resource by a container. |
| 161 | + - field: architecture |
| 162 | + Description: Image architecture. |
| 163 | + - field: baseOS |
| 164 | + Description: Image Base OS. |
| 165 | + - field: digest |
| 166 | + Description: Image Digest. |
| 167 | + - field: imageId |
| 168 | + Description: Image Id. |
| 169 | + - field: os |
| 170 | + Description: Image OS. |
| 171 | + - field: container.imageName |
| 172 | + Description: Image Pullstring. |
| 173 | + - field: image.registry |
| 174 | + Description: Image Registry. |
| 175 | + - field: image.tag |
| 176 | + Description: Image tag. |
| 177 | + - field: package.inUse |
| 178 | + Description: Package in use filter. Supported operators: exists and not exists. |
| 179 | + - field: package.info |
| 180 | + Description: Filters by a package using the format [packge name] - field: [version]. |
| 181 | + - field: package.path |
| 182 | + Description: Filters by package path. |
| 183 | + - field: package.type |
| 184 | + Description: Package type. |
| 185 | + - field: vuln.cvssScore |
| 186 | + Description: Filter by vulnerability CVSS. Supported operators: = and >=. |
| 187 | + - field: vuln.hasExploit |
| 188 | + Description: Filters resources by the existence of vulnerabilities with exploits. |
| 189 | + Supported operators: exists and not exists. |
| 190 | + - field: vuln.hasFix |
| 191 | + Description: Filters resources by the existence of vulnerabilities with fixes. |
| 192 | + Supported operators: exists and not exists. |
| 193 | + - field: vuln.name |
| 194 | + Description: Filter by vulnerability name. |
| 195 | + - field: vuln.severity |
| 196 | + Description: Filter by vulnerability severity. Supported operators: in, not in, exists and not exists. |
| 197 | + - field: machineImage |
| 198 | + Description: Filter by host machine image. |
76 | 199 | """
|
77 |
| - ) |
| 200 | + ), |
| 201 | + examples=[ |
| 202 | + 'zone in ("zone1") and machineImage = "ami-0b22b359fdfabe1b5"', |
| 203 | + '(projectId = "1235495521" or projectId = "987654321") and vuln.severity in ("Critical")', |
| 204 | + 'vuln.name in ("CVE-2023-0049")', |
| 205 | + 'vuln.cvssScore >= "3"', |
| 206 | + 'container.name in ("sysdig-container") and not labels exists', |
| 207 | + 'imageId in ("sha256:3768ff6176e29a35ce1354622977a1e5c013045cbc4f30754ef3459218be8ac")', |
| 208 | + ], |
78 | 209 | ),
|
79 | 210 | ] = 'platform in ("GCP", "AWS", "Azure", "Kubernetes")',
|
80 | 211 | page_number: Annotated[int, Field(ge=1, description="Page number for pagination (1-based index)")] = 1,
|
|
0 commit comments