Merge branch 'master' into PRWLR-7160-findings-page-scan-id-filter-improvement

# Conflicts:
#	ui/CHANGELOG.md
#	ui/app/(prowler)/compliance/page.tsx
#	ui/types/components.ts
This commit is contained in:
sumit_chaturvedi committed 2025-06-03 12:17:29 +05:30
commit d2d68ded2b
108 files changed
+5916 -1193

No files matched your search

+119
View File
@@ -0,0 +1,119 @@
export type RequirementStatus = "PASS" | "FAIL" | "MANUAL" | "No findings";
export type ComplianceId = "ens_rd2022_aws";
export interface CompliancesOverview {
data: ComplianceOverviewData[];
}
export interface ComplianceOverviewData {
type: "compliance-requirements-status";
id: string;
attributes: {
framework: string;
version: string;
requirements_passed: number;
requirements_failed: number;
requirements_manual: number;
total_requirements: number;
};
}
export interface Requirement {
name: string;
description: string;
status: RequirementStatus;
type: string;
pass: number;
fail: number;
manual: number;
check_ids: string[];
// ENS
nivel?: string;
dimensiones?: string[];
}
export interface Control {
label: string;
type: string;
pass: number;
fail: number;
manual: number;
requirements: Requirement[];
}
export interface Category {
name: string;
pass: number;
fail: number;
manual: number;
controls: Control[];
}
export interface Framework {
name: string;
pass: number;
fail: number;
manual: number;
categories: Category[];
}
export type MappedComplianceData = Framework[];
export interface FailedSection {
name: string;
total: number;
types: { [key: string]: number };
}
export interface RequirementsTotals {
pass: number;
fail: number;
manual: number;
}
// API Responses types:
export interface AttributesMetadata {
IdGrupoControl: string;
Marco: string;
Categoria: string;
DescripcionControl: string;
Tipo: string;
Nivel: string;
Dimensiones: string[];
ModoEjecucion: string;
Dependencias: any[];
}
export interface AttributesItemData {
type: "compliance-requirements-attributes";
id: string;
attributes: {
framework: string;
version: string;
description: string;
attributes: {
metadata: AttributesMetadata[];
check_ids: string[];
};
};
}
export interface RequirementItemData {
type: "compliance-requirements-details";
id: string;
attributes: {
framework: string;
version: string;
description: string;
status: RequirementStatus;
};
}
export interface AttributesData {
data: AttributesItemData[];
}
export interface RequirementsData {
data: RequirementItemData[];
}
+13 -108
View File
@@ -1,7 +1,7 @@
import { LucideIcon } from "lucide-react";
import { SVGProps } from "react";
import { ProviderAccountProps, ProviderType } from "./providers";
import { ProviderAccountProps } from "./providers";
export type IconSvgProps = SVGProps<SVGSVGElement> & {
size?: number;
@@ -44,18 +44,6 @@ export interface CollapseMenuButtonProps {
isOpen: boolean | undefined;
}
export interface SelectScanComplianceDataProps {
scans: (ScanProps & {
providerInfo: {
provider: ProviderType;
uid: string;
alias: string;
};
})[];
selectedScanId: string;
onSelectionChange: (selectedKey: string) => void;
}
export type NextUIVariants =
| "solid"
| "faded"
@@ -229,7 +217,7 @@ export type M365Credentials = {
providerId: string;
};
export type GCPCredentials = {
export type GCPDefaultCredentials = {
client_id: string;
client_secret: string;
refresh_token: string;
@@ -237,6 +225,12 @@ export type GCPCredentials = {
providerId: string;
};
export type GCPServiceAccountKey = {
service_account_key: string;
secretName: string;
providerId: string;
};
export type KubernetesCredentials = {
kubeconfig_content: string;
secretName: string;
@@ -246,7 +240,8 @@ export type KubernetesCredentials = {
export type CredentialsFormSchema =
| AWSCredentials
| AzureCredentials
| GCPCredentials
| GCPDefaultCredentials
| GCPServiceAccountKey
| KubernetesCredentials
| M365Credentials;
@@ -262,53 +257,6 @@ export interface ApiError {
};
code: string;
}
export interface CompliancesOverview {
links: {
first: string;
last: string;
next: string | null;
prev: string | null;
};
data: ComplianceOverviewData[];
meta: {
pagination: {
page: number;
pages: number;
count: number;
};
version: string;
};
}
export interface ComplianceOverviewData {
type: "compliance-overviews";
id: string;
attributes: {
inserted_at: string;
compliance_id: string;
framework: string;
version: string;
requirements_status: {
passed: number;
failed: number;
manual: number;
total: number;
};
region: string;
provider_type: string;
};
relationships: {
scan: {
data: {
type: "scans";
id: string;
};
};
};
links: {
self: string;
};
}
export interface InvitationProps {
type: "invitations";
@@ -490,52 +438,9 @@ export interface UserProps {
}[];
}
export interface ScanProps {
type: "scans";
id: string;
attributes: {
name: string;
trigger: "scheduled" | "manual";
state:
| "available"
| "scheduled"
| "executing"
| "completed"
| "failed"
| "cancelled";
unique_resource_count: number;
progress: number;
scanner_args: {
only_logs?: boolean;
excluded_checks?: string[];
aws_retries_max_attempts?: number;
} | null;
duration: number;
started_at: string;
inserted_at: string;
completed_at: string;
scheduled_at: string;
next_scan_at: string;
};
relationships: {
provider: {
data: {
id: string;
type: "providers";
};
};
task: {
data: {
id: string;
type: "tasks";
};
};
};
providerInfo?: {
provider: ProviderType;
uid: string;
alias: string;
};
export interface FindingsResponse {
data: FindingProps[];
meta: MetaDataProps;
}
export interface FindingProps {
+33
View File
@@ -1,5 +1,7 @@
import { z } from "zod";
import { ProviderType } from "./providers";
export const addRoleFormSchema = z.object({
name: z.string().min(1, "Name is required"),
manage_users: z.boolean().default(false),
@@ -176,6 +178,37 @@ export const addCredentialsRoleFormSchema = (providerType: string) =>
providerType: z.string(),
});
export const addCredentialsServiceAccountFormSchema = (
providerType: ProviderType,
) =>
providerType === "gcp"
? z.object({
providerId: z.string(),
providerType: z.string(),
service_account_key: z.string().refine(
(val) => {
try {
const parsed = JSON.parse(val);
return (
typeof parsed === "object" &&
parsed !== null &&
!Array.isArray(parsed)
);
} catch {
return false;
}
},
{
message: "Invalid JSON format. Please provide a valid JSON object.",
},
),
secretName: z.string().optional(),
})
: z.object({
providerId: z.string(),
providerType: z.string(),
});
export const testConnectionFormSchema = z.object({
providerId: z.string(),
runOnce: z.boolean().default(false),
+1
View File
@@ -3,3 +3,4 @@ export * from "./components";
export * from "./filters";
export * from "./formSchemas";
export * from "./providers";
export * from "./scans";
+49
View File
@@ -0,0 +1,49 @@
import { ProviderType } from "./providers";
export interface ScanProps {
type: "scans";
id: string;
attributes: {
name: string;
trigger: "scheduled" | "manual";
state:
| "available"
| "scheduled"
| "executing"
| "completed"
| "failed"
| "cancelled";
unique_resource_count: number;
progress: number;
scanner_args: {
only_logs?: boolean;
excluded_checks?: string[];
aws_retries_max_attempts?: number;
} | null;
duration: number;
started_at: string;
inserted_at: string;
completed_at: string;
scheduled_at: string;
next_scan_at: string;
};
relationships: {
provider: {
data: {
id: string;
type: "providers";
};
};
task: {
data: {
id: string;
type: "tasks";
};
};
};
providerInfo?: {
provider: ProviderType;
uid: string;
alias: string;
};
}
File renamed without changes.
-1
View File
@@ -1 +0,0 @@
export * from "./users";