mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-01-25 02:08:11 +00:00
feat: Integrate Prowler MCP to Lighthouse AI (#9255)
Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com> Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com> Co-authored-by: Alan Buscaglia <gentlemanprogramming@gmail.com> Co-authored-by: Adrián Jesús Peña Rodríguez <adrianjpr@gmail.com> Co-authored-by: Andoni Alonso <14891798+andoniaf@users.noreply.github.com> Co-authored-by: Rubén De la Torre Vico <ruben@prowler.com> Co-authored-by: Daniel Barranquero <danielbo2001@gmail.com>
This commit is contained in:
committed by
GitHub
parent
c83374d4ed
commit
b9bfdc1a5a
@@ -1,14 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const checkSchema = z.object({
|
||||
providerType: z.enum(["aws", "gcp", "azure", "kubernetes", "m365"]),
|
||||
service: z.array(z.string()).optional(),
|
||||
severity: z
|
||||
.array(z.enum(["informational", "low", "medium", "high", "critical"]))
|
||||
.optional(),
|
||||
compliances: z.array(z.string()).optional(),
|
||||
});
|
||||
|
||||
export const checkDetailsSchema = z.object({
|
||||
checkId: z.string(),
|
||||
});
|
||||
@@ -1,122 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Get Compliances Overview Schema
|
||||
const getCompliancesOverviewFields = z.enum([
|
||||
"inserted_at",
|
||||
"compliance_id",
|
||||
"framework",
|
||||
"version",
|
||||
"requirements_status",
|
||||
"region",
|
||||
"provider_type",
|
||||
"scan",
|
||||
"url",
|
||||
]);
|
||||
|
||||
const getCompliancesOverviewFilters = z.object({
|
||||
"filter[compliance_id]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"The compliance ID to get the compliances overview for (ex: iso27001_2013_aws).",
|
||||
),
|
||||
"filter[compliance_id__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("List of compliance IDs to get the compliances overview for."),
|
||||
"filter[framework]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"The framework to get the compliances overview for (ex: ISO27001)",
|
||||
),
|
||||
"filter[framework__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("List of frameworks to get the compliances overview for."),
|
||||
"filter[framework__iexact]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("The exact framework to get the compliances overview for."),
|
||||
"filter[inserted_at]": z.string().optional(),
|
||||
"filter[inserted_at__date]": z.string().optional(),
|
||||
"filter[inserted_at__gte]": z.string().optional(),
|
||||
"filter[inserted_at__lte]": z.string().optional(),
|
||||
"filter[provider_type]": z.string().optional(),
|
||||
"filter[provider_type__in]": z.string().optional(),
|
||||
"filter[region]": z.string().optional(),
|
||||
"filter[region__icontains]": z.string().optional(),
|
||||
"filter[region__in]": z.string().optional(),
|
||||
"filter[search]": z.string().optional(),
|
||||
"filter[version]": z.string().optional(),
|
||||
"filter[version__icontains]": z.string().optional(),
|
||||
});
|
||||
|
||||
const getCompliancesOverviewSort = z.enum([
|
||||
"inserted_at",
|
||||
"-inserted_at",
|
||||
"compliance_id",
|
||||
"-compliance_id",
|
||||
"framework",
|
||||
"-framework",
|
||||
"region",
|
||||
"-region",
|
||||
]);
|
||||
|
||||
export const getCompliancesOverviewSchema = z.object({
|
||||
scanId: z
|
||||
.string()
|
||||
.describe(
|
||||
"(Mandatory) The ID of the scan to get the compliances overview for. ID is UUID.",
|
||||
),
|
||||
fields: z
|
||||
.array(getCompliancesOverviewFields)
|
||||
.optional()
|
||||
.describe(
|
||||
"The fields to get from the compliances overview. If not provided, all fields will be returned.",
|
||||
),
|
||||
filters: getCompliancesOverviewFilters
|
||||
.optional()
|
||||
.describe(
|
||||
"The filters to get the compliances overview for. If not provided, all regions will be returned by default.",
|
||||
),
|
||||
page: z.number().optional().describe("Page number. Default is 1."),
|
||||
pageSize: z.number().optional().describe("Page size. Default is 10."),
|
||||
sort: getCompliancesOverviewSort
|
||||
.optional()
|
||||
.describe("Sort by field. Default is inserted_at."),
|
||||
});
|
||||
|
||||
export const getComplianceFrameworksSchema = z.object({
|
||||
providerType: z
|
||||
.enum(["aws", "azure", "gcp", "kubernetes", "m365"])
|
||||
.describe("The provider type to get the compliance frameworks for."),
|
||||
});
|
||||
|
||||
export const getComplianceOverviewSchema = z.object({
|
||||
complianceId: z
|
||||
.string()
|
||||
.describe(
|
||||
"The compliance ID to get the compliance overview for. ID is UUID and fetched from getCompliancesOverview tool for each provider.",
|
||||
),
|
||||
fields: z
|
||||
.array(
|
||||
z.enum([
|
||||
"inserted_at",
|
||||
"compliance_id",
|
||||
"framework",
|
||||
"version",
|
||||
"requirements_status",
|
||||
"region",
|
||||
"provider_type",
|
||||
"scan",
|
||||
"url",
|
||||
"description",
|
||||
"requirements",
|
||||
]),
|
||||
)
|
||||
.optional()
|
||||
.describe(
|
||||
"The fields to get from the compliance standard. If not provided, all fields will be returned.",
|
||||
),
|
||||
});
|
||||
@@ -1,381 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Get Findings Schema
|
||||
|
||||
const deltaEnum = z.enum(["", "new", "changed"]);
|
||||
|
||||
const impactEnum = z.enum([
|
||||
"",
|
||||
"critical",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"informational",
|
||||
]);
|
||||
|
||||
const providerTypeEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]);
|
||||
|
||||
const statusEnum = z.enum(["", "FAIL", "PASS", "MANUAL", "MUTED"]);
|
||||
|
||||
const sortFieldsEnum = z.enum([
|
||||
"",
|
||||
"status",
|
||||
"-status",
|
||||
"severity",
|
||||
"-severity",
|
||||
"check_id",
|
||||
"-check_id",
|
||||
"inserted_at",
|
||||
"-inserted_at",
|
||||
"updated_at",
|
||||
"-updated_at",
|
||||
]);
|
||||
|
||||
export const getFindingsSchema = z.object({
|
||||
page: z.number().int().describe("The page number to get. Default is 1."),
|
||||
pageSize: z
|
||||
.number()
|
||||
.int()
|
||||
.describe("The number of findings to get per page. Default is 10."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Default is empty string."),
|
||||
sort: sortFieldsEnum.describe(
|
||||
"The sort order to use. Default is empty string.",
|
||||
),
|
||||
filters: z
|
||||
.object({
|
||||
"filter[check_id]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"ID of checks supported for each provider. Use getProviderChecks tool to get the list of checks for a provider.",
|
||||
),
|
||||
"filter[check_id__icontains]": z.string().optional(),
|
||||
"filter[check_id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of check UUIDs"),
|
||||
|
||||
// Delta filter
|
||||
"filter[delta]": deltaEnum.nullable().optional(),
|
||||
"filter[delta__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of UUID values"),
|
||||
|
||||
// UUID filters
|
||||
"filter[id]": z.string().optional().describe("UUID"),
|
||||
"filter[id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of UUID values"),
|
||||
|
||||
// Impact and Severity filters
|
||||
"filter[impact]": impactEnum.optional(),
|
||||
"filter[impact__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of impact values"),
|
||||
"filter[severity]": z
|
||||
.enum(["critical", "high", "medium", "low", "informational"])
|
||||
.optional(),
|
||||
"filter[severity__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of severity values. Do not use it with severity filter.",
|
||||
),
|
||||
|
||||
// Date filters
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__date]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
// Provider filters
|
||||
"filter[provider]": z.string().optional().describe("Provider UUID"),
|
||||
"filter[provider__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider UUID values"),
|
||||
"filter[provider_alias]": z.string().optional(),
|
||||
"filter[provider_alias__icontains]": z.string().optional(),
|
||||
"filter[provider_alias__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider aliases"),
|
||||
"filter[provider_type]": providerTypeEnum.optional(),
|
||||
"filter[provider_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider types"),
|
||||
"filter[provider_uid]": z.string().optional(),
|
||||
"filter[provider_uid__icontains]": z.string().optional(),
|
||||
"filter[provider_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider UIDs"),
|
||||
|
||||
// Region filters
|
||||
"filter[region]": z.string().optional(),
|
||||
"filter[region__icontains]": z.string().optional(),
|
||||
"filter[region__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of region values"),
|
||||
|
||||
// Resource filters
|
||||
"filter[resource_name]": z.string().optional(),
|
||||
"filter[resource_name__icontains]": z.string().optional(),
|
||||
"filter[resource_name__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource names"),
|
||||
"filter[resource_type]": z.string().optional(),
|
||||
"filter[resource_type__icontains]": z.string().optional(),
|
||||
"filter[resource_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource types"),
|
||||
"filter[resource_uid]": z.string().optional(),
|
||||
"filter[resource_uid__icontains]": z.string().optional(),
|
||||
"filter[resource_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource UIDs"),
|
||||
"filter[resources]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource UUID values"),
|
||||
|
||||
// Scan filters
|
||||
"filter[scan]": z.string().optional().describe("Scan UUID"),
|
||||
"filter[scan__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of scan UUID values"),
|
||||
|
||||
// Service filters
|
||||
"filter[service]": z.string().optional(),
|
||||
"filter[service__icontains]": z.string().optional(),
|
||||
"filter[service__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of service values"),
|
||||
|
||||
// Status filters
|
||||
"filter[status]": statusEnum.optional(),
|
||||
"filter[status__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of status values"),
|
||||
|
||||
// UID filters
|
||||
"filter[uid]": z.string().optional(),
|
||||
"filter[uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of UUID values"),
|
||||
|
||||
// Updated at filters
|
||||
"filter[updated_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
})
|
||||
.optional()
|
||||
.describe(
|
||||
"The filters to apply. Default is {}. Only add necessary filters and ignore others. Generate the filters object **only** with non-empty values included.",
|
||||
),
|
||||
});
|
||||
|
||||
// Get Metadata Info Schema
|
||||
|
||||
export const getMetadataInfoSchema = z.object({
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Optional. Default is empty string."),
|
||||
sort: z
|
||||
.string()
|
||||
.describe("The sort order to use. Optional. Default is empty string."),
|
||||
filters: z
|
||||
.object({
|
||||
// Basic string filters
|
||||
"filter[check_id]": z.string().optional(),
|
||||
"filter[check_id__icontains]": z.string().optional(),
|
||||
"filter[check_id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of check UUIDs"),
|
||||
|
||||
// Delta filter
|
||||
"filter[delta]": deltaEnum.nullable().optional(),
|
||||
"filter[delta__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of UUID values"),
|
||||
|
||||
// UUID filters
|
||||
"filter[id]": z.string().optional().describe("UUID"),
|
||||
"filter[id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of UUID values"),
|
||||
|
||||
// Impact and Severity filters
|
||||
"filter[impact]": impactEnum.optional(),
|
||||
"filter[impact__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of impact values"),
|
||||
"filter[severity]": z
|
||||
.enum(["critical", "high", "medium", "low", "informational"])
|
||||
.optional(),
|
||||
"filter[severity__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of severity values"),
|
||||
|
||||
// Date filters
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__date]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
// Provider filters
|
||||
"filter[provider]": z.string().optional().describe("Provider UUID"),
|
||||
"filter[provider__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of provider UUID values. Use either provider or provider__in, not both.",
|
||||
),
|
||||
"filter[provider_alias]": z.string().optional(),
|
||||
"filter[provider_alias__icontains]": z.string().optional(),
|
||||
"filter[provider_alias__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of provider aliases. Use either provider_alias or provider_alias__in, not both.",
|
||||
),
|
||||
"filter[provider_type]": providerTypeEnum.optional(),
|
||||
"filter[provider_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of provider types. Use either provider_type or provider_type__in, not both.",
|
||||
),
|
||||
"filter[provider_uid]": z.string().optional(),
|
||||
"filter[provider_uid__icontains]": z.string().optional(),
|
||||
"filter[provider_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of provider UIDs. Use either provider_uid or provider_uid__in, not both.",
|
||||
),
|
||||
|
||||
// Region filters (excluding region__in)
|
||||
"filter[region]": z.string().optional(),
|
||||
"filter[region__icontains]": z.string().optional(),
|
||||
|
||||
// Resource filters (excluding resource_type__in)
|
||||
"filter[resource_name]": z.string().optional(),
|
||||
"filter[resource_name__icontains]": z.string().optional(),
|
||||
"filter[resource_name__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource names"),
|
||||
"filter[resource_type]": z.string().optional(),
|
||||
"filter[resource_type__icontains]": z.string().optional(),
|
||||
"filter[resource_uid]": z.string().optional(),
|
||||
"filter[resource_uid__icontains]": z.string().optional(),
|
||||
"filter[resource_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource UIDs"),
|
||||
"filter[resources]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of resource UUID values"),
|
||||
|
||||
// Scan filters
|
||||
"filter[scan]": z.string().optional().describe("Scan UUID"),
|
||||
"filter[scan__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of scan UUID values"),
|
||||
|
||||
// Service filters (excluding service__in)
|
||||
"filter[service]": z.string().optional(),
|
||||
"filter[service__icontains]": z.string().optional(),
|
||||
|
||||
// Status filters
|
||||
"filter[status]": statusEnum.optional(),
|
||||
"filter[status__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of status values. Use either status or status__in, not both.",
|
||||
),
|
||||
|
||||
// UID filters
|
||||
"filter[uid]": z.string().optional(),
|
||||
"filter[uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of UUID values. Use either uid or uid__in, not both.",
|
||||
),
|
||||
|
||||
// Updated at filters
|
||||
"filter[updated_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
})
|
||||
.partial()
|
||||
.describe(
|
||||
"The filters to apply. Optional. Default is empty object. Only add necessary filters and ignore others.",
|
||||
),
|
||||
});
|
||||
@@ -1,12 +1,3 @@
|
||||
export * from "./checks";
|
||||
export * from "./compliances";
|
||||
export * from "./credentials";
|
||||
export * from "./findings";
|
||||
export * from "./lighthouse-providers";
|
||||
export * from "./model-params";
|
||||
export * from "./overviews";
|
||||
export * from "./providers";
|
||||
export * from "./resources";
|
||||
export * from "./roles";
|
||||
export * from "./scans";
|
||||
export * from "./users";
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Get Providers Overview
|
||||
|
||||
export const getProvidersOverviewSchema = z.object({
|
||||
page: z
|
||||
.number()
|
||||
.int()
|
||||
.describe("The page number to get. Optional. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Optional. Default is empty string."),
|
||||
sort: z
|
||||
.string()
|
||||
.describe("The sort order to use. Optional. Default is empty string."),
|
||||
filters: z.object({}).describe("Always empty object."),
|
||||
});
|
||||
|
||||
// Get Findings By Status
|
||||
|
||||
const providerTypeEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]);
|
||||
|
||||
const sortFieldsEnum = z.enum([
|
||||
"",
|
||||
"id",
|
||||
"-id",
|
||||
"new",
|
||||
"-new",
|
||||
"changed",
|
||||
"-changed",
|
||||
"unchanged",
|
||||
"-unchanged",
|
||||
"fail_new",
|
||||
"-fail_new",
|
||||
"fail_changed",
|
||||
"-fail_changed",
|
||||
"pass_new",
|
||||
"-pass_new",
|
||||
"pass_changed",
|
||||
"-pass_changed",
|
||||
"muted_new",
|
||||
"-muted_new",
|
||||
"muted_changed",
|
||||
"-muted_changed",
|
||||
"total",
|
||||
"-total",
|
||||
"fail",
|
||||
"-fail",
|
||||
"muted",
|
||||
"-muted",
|
||||
]);
|
||||
|
||||
export const getFindingsByStatusSchema = z.object({
|
||||
page: z
|
||||
.number()
|
||||
.int()
|
||||
.describe("The page number to get. Optional. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Optional. Default is empty string."),
|
||||
sort: sortFieldsEnum
|
||||
.optional()
|
||||
.describe("The sort order to use. Optional. Default is empty string."),
|
||||
filters: z
|
||||
.object({
|
||||
// Fields selection
|
||||
"fields[findings-overview]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Comma-separated list of fields to include in the response. Default is empty string.",
|
||||
),
|
||||
|
||||
// Date filters
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__date]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
// Boolean filters (passed as strings in query params)
|
||||
"filter[muted_findings]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Boolean as string ('true' or 'false'). Default is empty string.",
|
||||
),
|
||||
|
||||
// Provider filters
|
||||
"filter[provider_id]": z.string().optional().describe("Provider ID"),
|
||||
"filter[provider_type]": providerTypeEnum.optional(),
|
||||
"filter[provider_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider types"),
|
||||
|
||||
// Region filters
|
||||
"filter[region]": z.string().optional(),
|
||||
"filter[region__icontains]": z.string().optional(),
|
||||
"filter[region__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of regions"),
|
||||
|
||||
// Search filter
|
||||
"filter[search]": z.string().optional(),
|
||||
})
|
||||
.partial()
|
||||
.describe("Use filters only when needed. Default is empty object."),
|
||||
});
|
||||
|
||||
// Get Findings By Severity
|
||||
|
||||
export const getFindingsBySeveritySchema = z.object({
|
||||
filters: z
|
||||
.object({
|
||||
// Date filters
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__date]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
// Boolean filters (passed as strings in query params)
|
||||
"filter[muted_findings]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Boolean as string ('true' or 'false'). Default is empty string.",
|
||||
),
|
||||
|
||||
// Provider filters
|
||||
"filter[provider_id]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Valid provider UUID"),
|
||||
"filter[provider_type]": providerTypeEnum.optional(),
|
||||
"filter[provider_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider types"),
|
||||
|
||||
// Region filters
|
||||
"filter[region]": z.string().optional(),
|
||||
"filter[region__icontains]": z.string().optional(),
|
||||
"filter[region__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of regions"),
|
||||
|
||||
// Search filter
|
||||
"filter[search]": z.string().optional(),
|
||||
})
|
||||
.partial()
|
||||
.describe("Use filters only when needed. Default is empty object."),
|
||||
});
|
||||
@@ -1,100 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Get Providers Schema
|
||||
|
||||
const providerEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]);
|
||||
|
||||
const sortFieldsEnum = z.enum([
|
||||
"",
|
||||
"provider",
|
||||
"-provider",
|
||||
"uid",
|
||||
"-uid",
|
||||
"alias",
|
||||
"-alias",
|
||||
"connected",
|
||||
"-connected",
|
||||
"inserted_at",
|
||||
"-inserted_at",
|
||||
"updated_at",
|
||||
"-updated_at",
|
||||
]);
|
||||
|
||||
export const getProvidersSchema = z
|
||||
.object({
|
||||
page: z.number().describe("The page number to get. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Default is empty string."),
|
||||
sort: sortFieldsEnum.describe(
|
||||
"The sort order to use. Default is empty string.",
|
||||
),
|
||||
filters: z
|
||||
.object({
|
||||
"filter[alias]": z.string().optional(),
|
||||
"filter[alias__icontains]": z.string().optional(),
|
||||
"filter[alias__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider aliases"),
|
||||
|
||||
"filter[connected]": z.boolean().optional().describe("Default True."),
|
||||
|
||||
"filter[id]": z.string().optional().describe("Provider UUID"),
|
||||
"filter[id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider UUID values"),
|
||||
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
"filter[provider]": providerEnum.optional(),
|
||||
"filter[provider__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider types"),
|
||||
|
||||
"filter[search]": z.string().optional(),
|
||||
|
||||
"filter[uid]": z.string().optional(),
|
||||
"filter[uid__icontains]": z.string().optional(),
|
||||
"filter[uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider UIDs"),
|
||||
|
||||
"filter[updated_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[updated_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
})
|
||||
.describe(
|
||||
"The filters to apply. Optional. Don't use individual filters unless needed. Default is {}.",
|
||||
),
|
||||
})
|
||||
.required();
|
||||
|
||||
// Get Provider Schema
|
||||
|
||||
export const getProviderSchema = z.object({
|
||||
id: z.string().describe("Provider UUID"),
|
||||
});
|
||||
@@ -1,174 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const resourceFieldsEnum = z.enum([
|
||||
"",
|
||||
"inserted_at",
|
||||
"updated_at",
|
||||
"uid",
|
||||
"name",
|
||||
"region",
|
||||
"service",
|
||||
"tags",
|
||||
"provider",
|
||||
"findings",
|
||||
"failed_findings_count",
|
||||
"url",
|
||||
"type",
|
||||
]);
|
||||
|
||||
const resourceIncludeEnum = z.enum(["", "provider", "findings"]);
|
||||
|
||||
const resourceSortEnum = z.enum([
|
||||
"",
|
||||
"provider_uid",
|
||||
"-provider_uid",
|
||||
"uid",
|
||||
"-uid",
|
||||
"name",
|
||||
"-name",
|
||||
"region",
|
||||
"-region",
|
||||
"service",
|
||||
"-service",
|
||||
"type",
|
||||
"-type",
|
||||
"inserted_at",
|
||||
"-inserted_at",
|
||||
"updated_at",
|
||||
"-updated_at",
|
||||
]);
|
||||
|
||||
const providerTypeEnum = z.enum(["", "aws", "gcp", "azure", "kubernetes"]);
|
||||
|
||||
export const getResourcesSchema = z.object({
|
||||
page: z.number().optional().describe("The page number to fetch."),
|
||||
query: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("The search query to filter resources."),
|
||||
sort: resourceSortEnum.optional().describe("The sort order to use."),
|
||||
filters: z
|
||||
.object({
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("The date to filter by."),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by date greater than or equal to."),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by date less than or equal to."),
|
||||
"filter[name]": z.string().optional().describe("Filter by name."),
|
||||
"filter[name__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by substring."),
|
||||
"filter[provider]": z.string().optional().describe("Filter by provider."),
|
||||
"filter[provider__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by provider in."),
|
||||
"filter[provider_alias]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by provider alias."),
|
||||
"filter[provider_alias__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by substring."),
|
||||
"filter[provider_alias__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Multiple values separated by commas."),
|
||||
"filter[provider_type]": providerTypeEnum
|
||||
.optional()
|
||||
.describe("Filter by provider type."),
|
||||
"filter[provider_type__in]": providerTypeEnum
|
||||
.optional()
|
||||
.describe("Filter by multiple provider types separated by commas."),
|
||||
"filter[provider_uid]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by provider uid."),
|
||||
"filter[provider_uid__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by substring."),
|
||||
"filter[provider_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by multiple provider uids separated by commas."),
|
||||
"filter[region]": z.string().optional().describe("Filter by region."),
|
||||
"filter[region__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by region substring."),
|
||||
"filter[region__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by multiple regions separated by commas."),
|
||||
"filter[service]": z.string().optional().describe("Filter by service."),
|
||||
"filter[service__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by service substring."),
|
||||
"filter[service__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by multiple services separated by commas."),
|
||||
"filter[tag]": z.string().optional().describe("Filter by tag."),
|
||||
"filter[tag_key]": z.string().optional().describe("Filter by tag key."),
|
||||
"filter[tag_value]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by tag value."),
|
||||
"filter[tags]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by multiple tags separated by commas."),
|
||||
"filter[type]": z.string().optional().describe("Filter by type."),
|
||||
"filter[type__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by substring."),
|
||||
"filter[type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by multiple types separated by commas."),
|
||||
"filter[uid]": z.string().optional().describe("Filter by uid."),
|
||||
"filter[uid__icontains]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by substring."),
|
||||
"filter[updated_at]": z.string().optional().describe("Filter by date."),
|
||||
"filter[updated_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by date greater than or equal to."),
|
||||
"filter[updated_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Filter by date less than or equal to."),
|
||||
})
|
||||
.optional()
|
||||
.describe("The filters to apply to the resources."),
|
||||
fields: z
|
||||
.array(resourceFieldsEnum)
|
||||
.optional()
|
||||
.describe("The fields to include in the response."),
|
||||
});
|
||||
|
||||
export const getResourceSchema = z.object({
|
||||
id: z.string().describe("The UUID of the resource to get."),
|
||||
fields: z
|
||||
.array(resourceFieldsEnum)
|
||||
.optional()
|
||||
.describe("The fields to include in the response."),
|
||||
include: z
|
||||
.array(resourceIncludeEnum)
|
||||
.optional()
|
||||
.describe("Other details to include in the response."),
|
||||
});
|
||||
@@ -1,52 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const getRolesSchema = z.object({
|
||||
page: z.number().describe("The page number to get. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Default is empty string."),
|
||||
sort: z.string().describe("The sort order to use. Default is empty string."),
|
||||
filters: z
|
||||
.object({
|
||||
"filter[id]": z.string().optional().describe("Role UUID"),
|
||||
"filter[id__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of role UUID values"),
|
||||
"filter[inserted_at]": z.string().optional().describe("Date of creation"),
|
||||
"filter[inserted_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date of creation greater than or equal to"),
|
||||
"filter[inserted_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date of creation less than or equal to"),
|
||||
"filter[name]": z.string().optional().describe("Role name"),
|
||||
"filter[name__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of role name values"),
|
||||
"filter[permission_state]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Permission state"),
|
||||
"filter[updated_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date of last update"),
|
||||
"filter[updated_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date of last update greater than or equal to"),
|
||||
"filter[updated_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date of last update less than or equal to"),
|
||||
})
|
||||
.describe("Use empty object if no filters are needed."),
|
||||
});
|
||||
|
||||
export const getRoleSchema = z.object({
|
||||
id: z.string().describe("The UUID of the role to get."),
|
||||
});
|
||||
@@ -1,133 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const providerTypeEnum = z.enum(["", "aws", "azure", "gcp", "kubernetes"]);
|
||||
const stateEnum = z.enum([
|
||||
"",
|
||||
"available",
|
||||
"cancelled",
|
||||
"completed",
|
||||
"executing",
|
||||
"failed",
|
||||
"scheduled",
|
||||
]);
|
||||
const triggerEnum = z.enum(["", "manual", "scheduled"]);
|
||||
|
||||
const getScansSortEnum = z.enum([
|
||||
"",
|
||||
"name",
|
||||
"-name",
|
||||
"trigger",
|
||||
"-trigger",
|
||||
"scheduled_at",
|
||||
"-scheduled_at",
|
||||
"inserted_at",
|
||||
"-inserted_at",
|
||||
"updated_at",
|
||||
"-updated_at",
|
||||
]);
|
||||
|
||||
// Get Scans Schema
|
||||
export const getScansSchema = z.object({
|
||||
page: z.number().describe("The page number to get. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Default is empty string."),
|
||||
sort: getScansSortEnum.describe(
|
||||
"The sort order to use. Default is empty string.",
|
||||
),
|
||||
filters: z
|
||||
.object({
|
||||
// Date filters
|
||||
"filter[completed_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[inserted_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[started_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[started_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[started_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
|
||||
// Next scan filters
|
||||
"filter[next_scan_at]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[next_scan_at__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
"filter[next_scan_at__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("ISO 8601 datetime string"),
|
||||
|
||||
// Name filters
|
||||
"filter[name]": z.string().optional(),
|
||||
"filter[name__icontains]": z.string().optional(),
|
||||
|
||||
// Provider filters
|
||||
"filter[provider]": z.string().optional().describe("Provider UUID"),
|
||||
"filter[provider__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider UUIDs"),
|
||||
|
||||
// Provider alias filters
|
||||
"filter[provider_alias]": z.string().optional(),
|
||||
"filter[provider_alias__icontains]": z.string().optional(),
|
||||
"filter[provider_alias__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of provider aliases"),
|
||||
|
||||
// Provider type filters
|
||||
"filter[provider_type]": providerTypeEnum.optional(),
|
||||
"filter[provider_type__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of values"),
|
||||
|
||||
// Provider UID filters
|
||||
"filter[provider_uid]": z.string().optional(),
|
||||
"filter[provider_uid__icontains]": z.string().optional(),
|
||||
"filter[provider_uid__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of values"),
|
||||
|
||||
// State filters
|
||||
"filter[state]": stateEnum.optional(),
|
||||
"filter[state__in]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Comma-separated list of values"),
|
||||
|
||||
// Trigger filter
|
||||
"filter[trigger]": triggerEnum
|
||||
.optional()
|
||||
.describe("Options are manual and scheduled"),
|
||||
|
||||
// Search filter
|
||||
"filter[search]": z.string().optional(),
|
||||
})
|
||||
.describe(
|
||||
"Used to filter the scans. Use filters only if you need to filter the scans. Don't add date filters unless the user asks for it. Default is {}.",
|
||||
),
|
||||
});
|
||||
|
||||
// Get Scan Schema
|
||||
export const getScanSchema = z.object({
|
||||
id: z.string().describe("Scan UUID"),
|
||||
});
|
||||
@@ -1,79 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Get Users Schema
|
||||
|
||||
const userFieldsEnum = z.enum([
|
||||
"",
|
||||
"name",
|
||||
"email",
|
||||
"company_name",
|
||||
"date_joined",
|
||||
"memberships",
|
||||
"roles",
|
||||
]);
|
||||
|
||||
const sortFieldsEnum = z.enum([
|
||||
"",
|
||||
"name",
|
||||
"-name",
|
||||
"email",
|
||||
"-email",
|
||||
"company_name",
|
||||
"-company_name",
|
||||
"date_joined",
|
||||
"-date_joined",
|
||||
"is_active",
|
||||
"-is_active",
|
||||
]);
|
||||
|
||||
const filtersSchema = z
|
||||
.object({
|
||||
// Fields selection
|
||||
"fields[users]": z
|
||||
.array(userFieldsEnum)
|
||||
.optional()
|
||||
.describe("Comma-separated list of user fields to include"),
|
||||
|
||||
// String filters
|
||||
"filter[company_name]": z.string().optional(),
|
||||
"filter[company_name__icontains]": z.string().optional(),
|
||||
"filter[email]": z.string().optional(),
|
||||
"filter[email__icontains]": z.string().optional(),
|
||||
"filter[name]": z.string().optional(),
|
||||
"filter[name__icontains]": z.string().optional(),
|
||||
|
||||
// Date filters
|
||||
"filter[date_joined]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[date_joined__date]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[date_joined__gte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
"filter[date_joined__lte]": z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Date in format YYYY-MM-DD"),
|
||||
|
||||
// Boolean filters
|
||||
"filter[is_active]": z.boolean().optional(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
export const getUsersSchema = z.object({
|
||||
page: z.number().int().describe("The page number to get. Default is 1."),
|
||||
query: z
|
||||
.string()
|
||||
.describe("The query to search for. Default is empty string."),
|
||||
sort: sortFieldsEnum.describe(
|
||||
"The sort order to use. Default is empty string.",
|
||||
),
|
||||
filters: filtersSchema.describe(
|
||||
"The filters to apply. Default is empty object.",
|
||||
),
|
||||
});
|
||||
@@ -71,7 +71,7 @@ interface ResourceItemProps {
|
||||
severity: "informational" | "low" | "medium" | "high" | "critical";
|
||||
check_id: string;
|
||||
check_metadata: CheckMetadataProps;
|
||||
raw_result: Record<string, any>;
|
||||
raw_result: Record<string, unknown>;
|
||||
inserted_at: string;
|
||||
updated_at: string;
|
||||
first_seen_at: string;
|
||||
@@ -113,7 +113,7 @@ interface CheckMetadataProps {
|
||||
relatedto: string[];
|
||||
categories: string[];
|
||||
checktitle: string;
|
||||
compliance: any;
|
||||
compliance: unknown;
|
||||
relatedurl: string;
|
||||
description: string;
|
||||
remediation: {
|
||||
|
||||
Reference in New Issue
Block a user