chore: tweaks for m365 provider (#7668)

This commit is contained in:
Pablo Lara
2025-05-06 17:06:44 +02:00
committed by GitHub
parent 3b17eb024c
commit d823b2b9de
8 changed files with 87 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import {
AzureProviderBadge,
GCPProviderBadge,
KS8ProviderBadge,
M365ProviderBadge,
} from "../icons/providers-badge";
export const CustomProviderInputAWS = () => {
@@ -25,6 +26,15 @@ export const CustomProviderInputAzure = () => {
);
};
export const CustomProviderInputM365 = () => {
return (
<div className="flex items-center gap-x-2">
<M365ProviderBadge width={25} height={25} />
<p className="text-sm">Microsoft 365</p>
</div>
);
};
export const CustomProviderInputGCP = () => {
return (
<div className="flex items-center gap-x-2">

View File

@@ -9,6 +9,7 @@ import {
CustomProviderInputAzure,
CustomProviderInputGCP,
CustomProviderInputKubernetes,
CustomProviderInputM365,
} from "./custom-provider-inputs";
const dataInputsProvider = [
@@ -27,6 +28,11 @@ const dataInputsProvider = [
label: "Microsoft Azure",
value: <CustomProviderInputAzure />,
},
{
key: "m365",
label: "Microsoft 365",
value: <CustomProviderInputM365 />,
},
{
key: "kubernetes",
label: "Kubernetes",

View File

@@ -52,7 +52,7 @@ export const filterFindings = [
{
key: "provider_type__in",
labelCheckboxGroup: "Cloud Provider",
values: ["aws", "azure", "gcp", "kubernetes"],
values: ["aws", "azure", "m365", "gcp", "kubernetes"],
},
// Add more filter categories as needed
];

View File

@@ -1006,6 +1006,31 @@ export const AzureIcon: React.FC<IconSvgProps> = ({
);
};
export const M365Icon: React.FC<IconSvgProps> = ({
size = 24,
width,
height,
...props
}) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size || width}
height={size || height}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<path d="M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" />
<path d="M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5" />
</svg>
);
};
export const GCPIcon: React.FC<IconSvgProps> = ({
size = 24,
width,

View File

@@ -19,6 +19,7 @@ import {
AzureCredentials,
GCPCredentials,
KubernetesCredentials,
M365Credentials,
} from "@/types";
import { ProviderTitleDocs } from "../provider-title-docs";
@@ -26,6 +27,7 @@ import { AWScredentialsForm } from "./via-credentials/aws-credentials-form";
import { AzureCredentialsForm } from "./via-credentials/azure-credentials-form";
import { GCPcredentialsForm } from "./via-credentials/gcp-credentials-form";
import { KubernetesCredentialsForm } from "./via-credentials/k8s-credentials-form";
import { M365CredentialsForm } from "./via-credentials/m365-credentials-form";
type CredentialsFormSchema = z.infer<
ReturnType<typeof addCredentialsFormSchema>
@@ -35,6 +37,7 @@ type CredentialsFormSchema = z.infer<
type FormType = CredentialsFormSchema &
AWSCredentials &
AzureCredentials &
M365Credentials &
GCPCredentials &
KubernetesCredentials;
@@ -77,17 +80,25 @@ export const UpdateViaCredentialsForm = ({
client_secret: "",
tenant_id: "",
}
: providerType === "gcp"
: providerType === "m365"
? {
client_id: "",
client_secret: "",
refresh_token: "",
tenant_id: "",
user: "",
encrypted_password: "",
}
: providerType === "kubernetes"
: providerType === "gcp"
? {
kubeconfig_content: "",
client_id: "",
client_secret: "",
refresh_token: "",
}
: {}),
: providerType === "kubernetes"
? {
kubeconfig_content: "",
}
: {}),
},
});
@@ -136,6 +147,18 @@ export const UpdateViaCredentialsForm = ({
message: errorMessage,
});
break;
case "/data/attributes/secret/user":
form.setError("user", {
type: "server",
message: errorMessage,
});
break;
case "/data/attributes/secret/encrypted_password":
form.setError("encrypted_password", {
type: "server",
message: errorMessage,
});
break;
case "/data/attributes/secret/tenant_id":
form.setError("tenant_id", {
type: "server",
@@ -192,6 +215,11 @@ export const UpdateViaCredentialsForm = ({
control={form.control as unknown as Control<AzureCredentials>}
/>
)}
{providerType === "m365" && (
<M365CredentialsForm
control={form.control as unknown as Control<M365Credentials>}
/>
)}
{providerType === "gcp" && (
<GCPcredentialsForm
control={form.control as unknown as Control<GCPCredentials>}

View File

@@ -21,6 +21,11 @@ export const ProviderTitleDocs = ({
text: "Need help connecting your Azure subscription?",
link: "https://goto.prowler.com/provider-azure",
};
case "m365":
return {
text: "Need help connecting your Microsoft 365 account?",
link: "https://goto.prowler.com/provider-m365",
};
case "gcp":
return {
text: "Need help connecting your GCP project?",

View File

@@ -26,6 +26,7 @@ import {
CircleHelpIcon,
DocIcon,
GCPIcon,
M365Icon,
SupportIcon,
} from "@/components/icons/Icons";
import { GroupProps } from "@/types";
@@ -94,6 +95,11 @@ export const getMenuList = (pathname: string): GroupProps[] => {
label: "Microsoft Azure",
icon: AzureIcon,
},
{
href: "/findings?filter[status__in]=FAIL&filter[severity__in]=critical%2Chigh%2Cmedium&filter[provider_type__in]=m365&sort=severity,-inserted_at",
label: "Microsoft 365",
icon: M365Icon,
},
{
href: "/findings?filter[status__in]=FAIL&filter[severity__in]=critical%2Chigh%2Cmedium&filter[provider_type__in]=gcp&sort=severity,-inserted_at",
label: "Google Cloud",

View File

@@ -513,7 +513,7 @@ export interface ProviderProps {
id: string;
type: "providers";
attributes: {
provider: "aws" | "azure" | "gcp" | "kubernetes";
provider: "aws" | "azure" | "m365" | "gcp" | "kubernetes";
uid: string;
alias: string;
status: "completed" | "pending" | "cancelled";