Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

check resource type

x03220539567116c840
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogOutput.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogOutput.tsx
index 92d173f7e9..ba2f380578 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogOutput.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogOutput.tsx
@@ -1,3 +1,4 @@
+import { PamResourceType } from "@app/hooks/api/pam";
import { useState } from "react";
type TableLog = {
@@ -6,26 +7,36 @@ type TableLog = {
total_rows?: number;
};
-export const PamSessionLogOutput = ({ content }: { content: string }) => {
+export const PamSessionLogOutput = ({
+ content,
+ resourceType
+}: {
+ content: string;
+ resourceType: PamResourceType;
+}) => {
const [isRawView, setIsRawView] = useState(false);
let parsedContent: TableLog | null = null;
- try {
- const parsed = JSON.parse(content);
- if (
- parsed &&
- typeof parsed === "object" &&
- !Array.isArray(parsed) &&
- parsed.data_rows &&
- Array.isArray(parsed.data_rows) &&
- parsed.data_rows.length > 0 &&
- typeof parsed.data_rows[0] === "object" &&
- parsed.data_rows[0] !== null
- ) {
- parsedContent = parsed;
+
+ if (resourceType === PamResourceType.Postgres || resourceType === PamResourceType.MySQL) {
+ try {
+ const parsed = JSON.parse(content);
+
+ if (
+ parsed &&
+ typeof parsed === "object" &&
+ !Array.isArray(parsed) &&
+ parsed.data_rows &&
+ Array.isArray(parsed.data_rows) &&
+ parsed.data_rows.length > 0 &&
+ typeof parsed.data_rows[0] === "object" &&
+ parsed.data_rows[0] !== null
+ ) {
+ parsedContent = parsed;
+ }
+ } catch (error) {
+ // Not a valid JSON or doesn't match structure, will render as plain text
}
- } catch (error) {
- // Not a valid JSON or doesn't match structure, will render as plain text
}
if (parsedContent) {
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
index 9350f6cd91..413f379e27 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
@@ -68,7 +68,10 @@ export const PamSessionLogsSection = ({ session }: Props) => {
<div className="h-px w-full bg-mineshaft-400"></div>
</div>
<div className="pt-2 text-bunker-300">
- <PamSessionLogOutput content={log.output} />
+ <PamSessionLogOutput
+ content={log.output}
+ resourceType={session.resourceType}
+ />
</div>
</>
)}