mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-01-25 02:08:11 +00:00
feat(api): support alibabacloud provider (#9485)
This commit is contained in:
@@ -48,22 +48,66 @@ export interface CollapseMenuButtonProps {
|
||||
isOpen: boolean | undefined;
|
||||
}
|
||||
|
||||
export const NEXT_UI_VARIANTS = {
|
||||
SOLID: "solid",
|
||||
FADED: "faded",
|
||||
BORDERED: "bordered",
|
||||
LIGHT: "light",
|
||||
FLAT: "flat",
|
||||
GHOST: "ghost",
|
||||
SHADOW: "shadow",
|
||||
} as const;
|
||||
export type NextUIVariants =
|
||||
| "solid"
|
||||
| "faded"
|
||||
| "bordered"
|
||||
| "light"
|
||||
| "flat"
|
||||
| "ghost"
|
||||
| "shadow";
|
||||
(typeof NEXT_UI_VARIANTS)[keyof typeof NEXT_UI_VARIANTS];
|
||||
|
||||
export type NextUIColors =
|
||||
| "primary"
|
||||
| "secondary"
|
||||
| "success"
|
||||
| "warning"
|
||||
| "danger"
|
||||
| "default";
|
||||
export const NEXT_UI_COLORS = {
|
||||
PRIMARY: "primary",
|
||||
SECONDARY: "secondary",
|
||||
SUCCESS: "success",
|
||||
WARNING: "warning",
|
||||
DANGER: "danger",
|
||||
DEFAULT: "default",
|
||||
} as const;
|
||||
export type NextUIColors = (typeof NEXT_UI_COLORS)[keyof typeof NEXT_UI_COLORS];
|
||||
|
||||
export const PERMISSION_STATE = {
|
||||
UNLIMITED: "unlimited",
|
||||
LIMITED: "limited",
|
||||
NONE: "none",
|
||||
} as const;
|
||||
export type PermissionState =
|
||||
(typeof PERMISSION_STATE)[keyof typeof PERMISSION_STATE];
|
||||
|
||||
export const FINDING_DELTA = {
|
||||
NEW: "new",
|
||||
CHANGED: "changed",
|
||||
} as const;
|
||||
export type FindingDelta =
|
||||
| (typeof FINDING_DELTA)[keyof typeof FINDING_DELTA]
|
||||
| null;
|
||||
|
||||
export const FINDING_STATUS = {
|
||||
PASS: "PASS",
|
||||
FAIL: "FAIL",
|
||||
MANUAL: "MANUAL",
|
||||
} as const;
|
||||
export type FindingStatus =
|
||||
(typeof FINDING_STATUS)[keyof typeof FINDING_STATUS];
|
||||
|
||||
export const SEVERITY = {
|
||||
INFORMATIONAL: "informational",
|
||||
LOW: "low",
|
||||
MEDIUM: "medium",
|
||||
HIGH: "high",
|
||||
CRITICAL: "critical",
|
||||
} as const;
|
||||
export type Severity = (typeof SEVERITY)[keyof typeof SEVERITY];
|
||||
|
||||
export const USER_STATUS = {
|
||||
ACTIVE: "active",
|
||||
INACTIVE: "inactive",
|
||||
} as const;
|
||||
export type UserStatus = (typeof USER_STATUS)[keyof typeof USER_STATUS];
|
||||
|
||||
export interface PermissionInfo {
|
||||
field: string;
|
||||
@@ -186,6 +230,13 @@ export interface TaskDetails {
|
||||
};
|
||||
};
|
||||
}
|
||||
export const AWS_CREDENTIALS_TYPE = {
|
||||
AWS_SDK_DEFAULT: "aws-sdk-default",
|
||||
ACCESS_SECRET_KEY: "access-secret-key",
|
||||
} as const;
|
||||
export type AWSCredentialsType =
|
||||
(typeof AWS_CREDENTIALS_TYPE)[keyof typeof AWS_CREDENTIALS_TYPE];
|
||||
|
||||
export type AWSCredentials = {
|
||||
[ProviderCredentialFields.AWS_ACCESS_KEY_ID]: string;
|
||||
[ProviderCredentialFields.AWS_SECRET_ACCESS_KEY]: string;
|
||||
@@ -201,9 +252,7 @@ export type AWSCredentialsRole = {
|
||||
[ProviderCredentialFields.EXTERNAL_ID]?: string;
|
||||
[ProviderCredentialFields.ROLE_SESSION_NAME]?: string;
|
||||
[ProviderCredentialFields.SESSION_DURATION]?: number;
|
||||
[ProviderCredentialFields.CREDENTIALS_TYPE]?:
|
||||
| "aws-sdk-default"
|
||||
| "access-secret-key";
|
||||
[ProviderCredentialFields.CREDENTIALS_TYPE]?: AWSCredentialsType;
|
||||
};
|
||||
|
||||
export type AzureCredentials = {
|
||||
@@ -270,8 +319,23 @@ export type MongoDBAtlasCredentials = {
|
||||
[ProviderCredentialFields.PROVIDER_ID]: string;
|
||||
};
|
||||
|
||||
export type AlibabaCloudCredentials = {
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_ID]: string;
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_SECRET]: string;
|
||||
[ProviderCredentialFields.PROVIDER_ID]: string;
|
||||
};
|
||||
|
||||
export type AlibabaCloudCredentialsRole = {
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ROLE_ARN]: string;
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_ID]: string;
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_SECRET]: string;
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ROLE_SESSION_NAME]?: string;
|
||||
[ProviderCredentialFields.PROVIDER_ID]: string;
|
||||
};
|
||||
|
||||
export type CredentialsFormSchema =
|
||||
| AWSCredentials
|
||||
| AWSCredentialsRole
|
||||
| AzureCredentials
|
||||
| GCPDefaultCredentials
|
||||
| GCPServiceAccountKey
|
||||
@@ -279,7 +343,9 @@ export type CredentialsFormSchema =
|
||||
| IacCredentials
|
||||
| M365Credentials
|
||||
| OCICredentials
|
||||
| MongoDBAtlasCredentials;
|
||||
| MongoDBAtlasCredentials
|
||||
| AlibabaCloudCredentials
|
||||
| AlibabaCloudCredentialsRole;
|
||||
|
||||
export interface SearchParamsProps {
|
||||
[key: string]: string | string[] | undefined;
|
||||
@@ -294,6 +360,14 @@ export interface ApiError {
|
||||
code: string;
|
||||
}
|
||||
|
||||
export type ApiResponse = {
|
||||
error?: string;
|
||||
errors?: ApiError[];
|
||||
data?: unknown;
|
||||
success?: boolean;
|
||||
status?: number;
|
||||
};
|
||||
|
||||
export interface InvitationProps {
|
||||
type: "invitations";
|
||||
id: string;
|
||||
@@ -325,7 +399,7 @@ export interface InvitationProps {
|
||||
manage_providers?: boolean;
|
||||
manage_integrations?: boolean;
|
||||
manage_scans?: boolean;
|
||||
permission_state?: "unlimited" | "limited" | "none";
|
||||
permission_state?: PermissionState;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -350,7 +424,7 @@ export interface Role {
|
||||
manage_integrations: boolean;
|
||||
manage_scans: boolean;
|
||||
unlimited_visibility: boolean;
|
||||
permission_state: "unlimited" | "limited" | "none";
|
||||
permission_state: PermissionState;
|
||||
inserted_at: string;
|
||||
updated_at: string;
|
||||
};
|
||||
@@ -484,10 +558,10 @@ export interface FindingProps {
|
||||
id: string;
|
||||
attributes: {
|
||||
uid: string;
|
||||
delta: "new" | "changed" | null;
|
||||
status: "PASS" | "FAIL" | "MANUAL";
|
||||
delta: FindingDelta;
|
||||
status: FindingStatus;
|
||||
status_extended: string;
|
||||
severity: "informational" | "low" | "medium" | "high" | "critical";
|
||||
severity: Severity;
|
||||
check_id: string;
|
||||
muted: boolean;
|
||||
muted_reason?: string;
|
||||
@@ -496,7 +570,7 @@ export interface FindingProps {
|
||||
notes: string;
|
||||
checkid: string;
|
||||
provider: string;
|
||||
severity: "informational" | "low" | "medium" | "high" | "critical";
|
||||
severity: Severity;
|
||||
checktype: string[];
|
||||
dependson: string[];
|
||||
relatedto: string[];
|
||||
@@ -647,5 +721,5 @@ export interface UserProps {
|
||||
name: string;
|
||||
role: string;
|
||||
dateAdded: string;
|
||||
status: "active" | "inactive";
|
||||
status: UserStatus;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,11 @@ export const addProviderFormSchema = z
|
||||
[ProviderCredentialFields.PROVIDER_ALIAS]: z.string(),
|
||||
providerUid: z.string(),
|
||||
}),
|
||||
z.object({
|
||||
providerType: z.literal("alibabacloud"),
|
||||
[ProviderCredentialFields.PROVIDER_ALIAS]: z.string(),
|
||||
providerUid: z.string(),
|
||||
}),
|
||||
]),
|
||||
);
|
||||
|
||||
@@ -245,9 +250,18 @@ export const addCredentialsFormSchema = (
|
||||
.string()
|
||||
.min(1, "Atlas Private Key is required"),
|
||||
}
|
||||
: {}),
|
||||
: providerType === "alibabacloud"
|
||||
? {
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_ID]:
|
||||
z.string().min(1, "Access Key ID is required"),
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_SECRET]:
|
||||
z
|
||||
.string()
|
||||
.min(1, "Access Key Secret is required"),
|
||||
}
|
||||
: {}),
|
||||
})
|
||||
.superRefine((data: Record<string, any>, ctx) => {
|
||||
.superRefine((data: Record<string, string | undefined>, ctx) => {
|
||||
if (providerType === "m365") {
|
||||
// Validate based on the via parameter
|
||||
if (via === "app_client_secret") {
|
||||
@@ -339,10 +353,27 @@ export const addCredentialsRoleFormSchema = (providerType: string) =>
|
||||
path: [ProviderCredentialFields.AWS_ACCESS_KEY_ID],
|
||||
},
|
||||
)
|
||||
: z.object({
|
||||
providerId: z.string(),
|
||||
providerType: z.string(),
|
||||
});
|
||||
: providerType === "alibabacloud"
|
||||
? z.object({
|
||||
[ProviderCredentialFields.PROVIDER_ID]: z.string(),
|
||||
[ProviderCredentialFields.PROVIDER_TYPE]: z.string(),
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ROLE_ARN]: z
|
||||
.string()
|
||||
.min(1, "RAM Role ARN is required"),
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_ID]: z
|
||||
.string()
|
||||
.min(1, "Access Key ID is required"),
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ACCESS_KEY_SECRET]: z
|
||||
.string()
|
||||
.min(1, "Access Key Secret is required"),
|
||||
[ProviderCredentialFields.ALIBABACLOUD_ROLE_SESSION_NAME]: z
|
||||
.string()
|
||||
.optional(),
|
||||
})
|
||||
: z.object({
|
||||
providerId: z.string(),
|
||||
providerType: z.string(),
|
||||
});
|
||||
|
||||
export const addCredentialsServiceAccountFormSchema = (
|
||||
providerType: ProviderType,
|
||||
|
||||
@@ -8,6 +8,7 @@ export const PROVIDER_TYPES = [
|
||||
"github",
|
||||
"iac",
|
||||
"oraclecloud",
|
||||
"alibabacloud",
|
||||
] as const;
|
||||
|
||||
export type ProviderType = (typeof PROVIDER_TYPES)[number];
|
||||
@@ -22,6 +23,7 @@ export const PROVIDER_DISPLAY_NAMES: Record<ProviderType, string> = {
|
||||
github: "GitHub",
|
||||
iac: "Infrastructure as Code",
|
||||
oraclecloud: "Oracle Cloud Infrastructure",
|
||||
alibabacloud: "Alibaba Cloud",
|
||||
};
|
||||
|
||||
export function getProviderDisplayName(providerId: string): string {
|
||||
|
||||
Reference in New Issue
Block a user