Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ prowler dashboard
| M365 | 70 | 7 | 3 | 2 | Official | UI, API, CLI |
| OCI | 51 | 13 | 1 | 10 | Official | UI, API, CLI |
| IaC | [See `trivy` docs.](https://trivy.dev/latest/docs/coverage/iac/) | N/A | N/A | N/A | Official | UI, API, CLI |
| MongoDB Atlas | 10 | 3 | 0 | 0 | Official | CLI, API |
| MongoDB Atlas | 10 | 3 | 0 | 0 | Official | UI, API, CLI |
| LLM | [See `promptfoo` docs.](https://www.promptfoo.dev/docs/red-team/plugins/) | N/A | N/A | N/A | Official | CLI |
| NHN | 6 | 2 | 1 | 0 | Unofficial | CLI |

Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The supported providers right now are:
| [Github](/user-guide/providers/github/getting-started-github) | Official | UI, API, CLI |
| [Oracle Cloud](/user-guide/providers/oci/getting-started-oci) | Official | UI, API, CLI |
| [Infra as Code](/user-guide/providers/iac/getting-started-iac) | Official | UI, API, CLI |
| [MongoDB Atlas](/user-guide/providers/mongodbatlas/getting-started-mongodbatlas) | Official | CLI, API |
| [MongoDB Atlas](/user-guide/providers/mongodbatlas/getting-started-mongodbatlas) | Official | UI, API, CLI |
| [LLM](/user-guide/providers/llm/getting-started-llm) | Official | CLI |
| **NHN** | Unofficial | CLI |

Expand Down
1 change: 1 addition & 0 deletions ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All notable changes to the **Prowler UI** are documented in this file.
- IaC (Infrastructure as Code) provider support for scanning remote repositories [(#8751)](https://github.com/prowler-cloud/prowler/pull/8751)
- PDF reporting for NIS2 compliance framework [(#9170)](https://github.com/prowler-cloud/prowler/pull/9170)
- External resource link to IaC findings for direct navigation to source code in Git repositories [(#9151)](https://github.com/prowler-cloud/prowler/pull/9151)
- MongoDB Atlas provider support [(#9253)](https://github.com/prowler-cloud/prowler/pull/9253)
- New Overview page and new app styles [(#9234)](https://github.com/prowler-cloud/prowler/pull/9234)
- Use branch name as region for IaC findings [(#9296)](https://github.com/prowler-cloud/prowler/pull/9296)

Expand Down
64 changes: 2 additions & 62 deletions ui/actions/findings/findings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,6 @@ import { redirect } from "next/navigation";

import { apiBaseUrl, getAuthHeaders } from "@/lib";
import { handleApiResponse } from "@/lib/server-actions-helper";
import { FindingsResponse } from "@/types";

interface IncludedItem {
type: string;
id: string;
attributes?: { provider?: string };
relationships?: { provider?: { data?: { id: string } } };
}

type FindingsApiResponse = FindingsResponse & {
included?: IncludedItem[];
};

const filterMongoFindings = <T extends FindingsApiResponse | null | undefined>(
result: T,
): T => {
if (!result?.data) return result;

const included = (result as FindingsApiResponse).included || [];

// Get IDs of providers containing "mongo" in included items
const mongoProviderIds = new Set(
included
.filter(
(item) =>
item.type === "providers" &&
item.attributes?.provider?.toLowerCase().includes("mongo"),
)
.map((item) => item.id),
);

// Filter out findings associated with mongo providers
result.data = result.data.filter((finding) => {
const scanId = finding.relationships?.scan?.data?.id;
// Find the scan in included items
const scan = included.find(
(item) => item.type === "scans" && item.id === scanId,
);
const providerId = scan?.relationships?.provider?.data?.id;
return !providerId || !mongoProviderIds.has(providerId);
});

// Filter out mongo-related included items
if ((result as FindingsApiResponse).included) {
(result as FindingsApiResponse).included = included.filter(
(item) =>
!(
item.type === "providers" &&
item.attributes?.provider?.toLowerCase().includes("mongo")
),
);
}

return result;
};

export const getFindings = async ({
page = 1,
pageSize = 10,
Expand Down Expand Up @@ -89,9 +33,7 @@ export const getFindings = async ({
headers,
});

const result = await handleApiResponse(findings);

return filterMongoFindings(result);
return handleApiResponse(findings);
} catch (error) {
console.error("Error fetching findings:", error);
return undefined;
Expand Down Expand Up @@ -129,9 +71,7 @@ export const getLatestFindings = async ({
headers,
});

const result = await handleApiResponse(findings);

return filterMongoFindings(result);
return handleApiResponse(findings);
} catch (error) {
console.error("Error fetching findings:", error);
return undefined;
Expand Down
4 changes: 0 additions & 4 deletions ui/actions/overview/sankey.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ interface AggregatedProvider {
fail: number;
}

const EXCLUDED_PROVIDERS = new Set(["mongo", "mongodb", "mongodbatlas"]);

// API can return multiple entries for the same provider type, so we sum their findings
function aggregateProvidersByType(
providers: ProviderOverview[],
Expand All @@ -39,8 +37,6 @@ function aggregateProvidersByType(
for (const provider of providers) {
const { id, attributes } = provider;

if (EXCLUDED_PROVIDERS.has(id)) continue;

const existing = aggregated.get(id);

if (existing) {
Expand Down
19 changes: 1 addition & 18 deletions ui/actions/providers/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,9 @@ export const getProviders = async ({
headers,
});

const result = (await handleApiResponse(response)) as
return (await handleApiResponse(response)) as
| ProvidersApiResponse
| undefined;

if (result?.data) {
// Filter out providers with provider type containing "mongo"
result.data = result.data.filter(
(provider) =>
!provider.attributes?.provider?.toLowerCase().includes("mongo"),
);

// Also filter out mongo-related included items if present
if (result.included) {
result.included = result.included.filter(
(item) => !item.type.toLowerCase().includes("mongo"),
);
}
}

return result;
} catch (error) {
console.error("Error fetching providers:", error);
return undefined;
Expand Down
46 changes: 1 addition & 45 deletions ui/actions/scans/scans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,6 @@ import {
} from "@/lib/compliance/compliance-report-types";
import { addScanOperation } from "@/lib/sentry-breadcrumbs";
import { handleApiError, handleApiResponse } from "@/lib/server-actions-helper";
import { ScansApiResponse } from "@/types";

const filterMongoScans = (result: ScansApiResponse | undefined) => {
if (!result?.data) return result;

const included = result.included || [];

// Get IDs of providers containing "mongo"
const mongoProviderIds = new Set(
included
.filter(
(item) =>
item.type === "providers" &&
item.attributes?.provider?.toLowerCase().includes("mongo"),
)
.map((item) => item.id),
);

// If no mongo providers found, return as-is
if (mongoProviderIds.size === 0) return result;

// Filter out scans associated with mongo providers
result.data = result.data.filter((scan) => {
const providerId = scan.relationships?.provider?.data?.id;
return !providerId || !mongoProviderIds.has(providerId);
});

// Filter out mongo-related included items
if (result.included) {
result.included = included.filter(
(item) =>
!(
item.type === "providers" &&
item.attributes?.provider?.toLowerCase().includes("mongo")
),
);
}

return result;
};

export const getScans = async ({
page = 1,
query = "",
Expand Down Expand Up @@ -84,10 +43,7 @@ export const getScans = async ({
try {
const response = await fetch(url.toString(), { headers });

const result = await handleApiResponse(response);

// Filter out mongo-related scans when provider is included
return filterMongoScans(result);
return handleApiResponse(response);
} catch (error) {
console.error("Error fetching scans:", error);
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
IacProviderBadge,
KS8ProviderBadge,
M365ProviderBadge,
MongoDBAtlasProviderBadge,
OracleCloudProviderBadge,
} from "@/components/icons/providers-badge";
import {
Expand All @@ -31,6 +32,7 @@ const PROVIDER_ICON: Record<ProviderType, ReactNode> = {
github: <GitHubProviderBadge width={18} height={18} />,
iac: <IacProviderBadge width={18} height={18} />,
oraclecloud: <OracleCloudProviderBadge width={18} height={18} />,
mongodbatlas: <MongoDBAtlasProviderBadge width={18} height={18} />,
};

interface AccountsSelectorProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const OracleCloudProviderBadge = lazy(() =>
default: m.OracleCloudProviderBadge,
})),
);
const MongoDBAtlasProviderBadge = lazy(() =>
import("@/components/icons/providers-badge").then((m) => ({
default: m.MongoDBAtlasProviderBadge,
})),
);

type IconProps = { width: number; height: number };

Expand Down Expand Up @@ -95,6 +100,10 @@ const PROVIDER_DATA: Record<
label: "Oracle Cloud Infrastructure",
icon: OracleCloudProviderBadge,
},
mongodbatlas: {
label: "MongoDB Atlas",
icon: MongoDBAtlasProviderBadge,
},
};

type ProviderTypeSelectorProps = {
Expand Down
10 changes: 10 additions & 0 deletions ui/components/filters/custom-provider-inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IacProviderBadge,
KS8ProviderBadge,
M365ProviderBadge,
MongoDBAtlasProviderBadge,
OracleCloudProviderBadge,
} from "../icons/providers-badge";

Expand Down Expand Up @@ -38,6 +39,15 @@ export const CustomProviderInputM365 = () => {
);
};

export const CustomProviderInputMongoDBAtlas = () => {
return (
<div className="flex items-center gap-x-2">
<MongoDBAtlasProviderBadge width={25} height={25} />
<p className="text-sm">MongoDB Atlas</p>
</div>
);
};

export const CustomProviderInputGCP = () => {
return (
<div className="flex items-center gap-x-2">
Expand Down
27 changes: 16 additions & 11 deletions ui/components/filters/custom-select-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
CustomProviderInputIac,
CustomProviderInputKubernetes,
CustomProviderInputM365,
CustomProviderInputMongoDBAtlas,
CustomProviderInputOracleCloud,
} from "./custom-provider-inputs";

Expand All @@ -25,21 +26,13 @@ const providerDisplayData: Record<
label: "Amazon Web Services",
component: <CustomProviderInputAWS />,
},
gcp: {
label: "Google Cloud Platform",
component: <CustomProviderInputGCP />,
},
azure: {
label: "Microsoft Azure",
component: <CustomProviderInputAzure />,
},
m365: {
label: "Microsoft 365",
component: <CustomProviderInputM365 />,
},
kubernetes: {
label: "Kubernetes",
component: <CustomProviderInputKubernetes />,
gcp: {
label: "Google Cloud Platform",
component: <CustomProviderInputGCP />,
},
github: {
label: "GitHub",
Expand All @@ -49,6 +42,18 @@ const providerDisplayData: Record<
label: "Infrastructure as Code",
component: <CustomProviderInputIac />,
},
kubernetes: {
label: "Kubernetes",
component: <CustomProviderInputKubernetes />,
},
m365: {
label: "Microsoft 365",
component: <CustomProviderInputM365 />,
},
mongodbatlas: {
label: "MongoDB Atlas",
component: <CustomProviderInputMongoDBAtlas />,
},
oraclecloud: {
label: "Oracle Cloud Infrastructure",
component: <CustomProviderInputOracleCloud />,
Expand Down
18 changes: 17 additions & 1 deletion ui/components/filters/data-filters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { CONNECTION_STATUS_MAPPING } from "@/lib/helper-filters";
import { FilterOption, FilterType } from "@/types/filters";
import { PROVIDER_TYPES } from "@/types/providers";
import {
PROVIDER_DISPLAY_NAMES,
PROVIDER_TYPES,
ProviderType,
} from "@/types/providers";

// Create a mapping for provider types to display with icons and labels
const PROVIDER_TYPE_MAPPING = PROVIDER_TYPES.map((providerType) => ({
[providerType]: {
provider: providerType as ProviderType,
uid: "",
alias: PROVIDER_DISPLAY_NAMES[providerType],
},
}));

export const filterProviders: FilterOption[] = [
{
Expand All @@ -13,6 +26,7 @@ export const filterProviders: FilterOption[] = [
key: "provider__in",
labelCheckboxGroup: "Cloud Provider",
values: [...PROVIDER_TYPES],
valueLabelMapping: PROVIDER_TYPE_MAPPING,
},
// Add more filter categories as needed
];
Expand All @@ -22,6 +36,7 @@ export const filterScans = [
key: "provider_type__in",
labelCheckboxGroup: "Cloud Provider",
values: [...PROVIDER_TYPES],
valueLabelMapping: PROVIDER_TYPE_MAPPING,
index: 0,
},
{
Expand Down Expand Up @@ -64,6 +79,7 @@ export const filterFindings = [
key: FilterType.PROVIDER_TYPE,
labelCheckboxGroup: "Cloud Provider",
values: [...PROVIDER_TYPES],
valueLabelMapping: PROVIDER_TYPE_MAPPING,
index: 5,
},
{
Expand Down
3 changes: 3 additions & 0 deletions ui/components/icons/providers-badge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { GitHubProviderBadge } from "./github-provider-badge";
import { IacProviderBadge } from "./iac-provider-badge";
import { KS8ProviderBadge } from "./ks8-provider-badge";
import { M365ProviderBadge } from "./m365-provider-badge";
import { MongoDBAtlasProviderBadge } from "./mongodbatlas-provider-badge";
import { OracleCloudProviderBadge } from "./oraclecloud-provider-badge";

export {
Expand All @@ -17,6 +18,7 @@ export {
IacProviderBadge,
KS8ProviderBadge,
M365ProviderBadge,
MongoDBAtlasProviderBadge,
OracleCloudProviderBadge,
};

Expand All @@ -30,4 +32,5 @@ export const PROVIDER_ICONS: Record<string, React.FC<IconSvgProps>> = {
GitHub: GitHubProviderBadge,
"Infrastructure as Code": IacProviderBadge,
"Oracle Cloud Infrastructure": OracleCloudProviderBadge,
"MongoDB Atlas": MongoDBAtlasProviderBadge,
};
Loading
Loading