mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 20:29:34 +00:00
feat(infisical-pg): completed secret scanner
This commit is contained in:
@@ -2,20 +2,23 @@ import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* Will create a new integration session and return it for the given org
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
const createNewIntegrationSession = (organizationId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/secret-scanning/create-installation-session/organization/${organizationId}`, {
|
||||
SecurityClient.fetchCall("/api/v1/secret-scanning/create-installation-session/organization", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
},
|
||||
body: JSON.stringify({
|
||||
organizationId
|
||||
})
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log("Failed to create integration session");
|
||||
console.log("response", res)
|
||||
console.log("response", res);
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -2,20 +2,23 @@ import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* Will create a new integration session and return it for the given org
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
const getInstallationStatus = (organizationId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/secret-scanning/installation-status/organization/${organizationId}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
SecurityClient.fetchCall(
|
||||
`/api/v1/secret-scanning/installation-status/organization/${organizationId}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
}).then(async (res) => {
|
||||
).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).appInstallationComplete;
|
||||
return (await res.json()).appInstallationCompleted;
|
||||
}
|
||||
console.log("Failed to check installation status");
|
||||
console.log("response", res)
|
||||
console.log("response", res);
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export type IGitRisks = {
|
||||
email: string;
|
||||
};
|
||||
createdAt: string;
|
||||
organization: string;
|
||||
orgId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,11 @@ const SecretScanning = withPermission(
|
||||
const linkInstallation = async () => {
|
||||
if (
|
||||
typeof queryParams.state === "string" &&
|
||||
typeof queryParams.installationid === "string"
|
||||
typeof queryParams.installation_id === "string"
|
||||
) {
|
||||
try {
|
||||
const isLinked = await linkGitAppInstallationWithOrganization(
|
||||
queryParams.installationid as string,
|
||||
queryParams.installation_id as string,
|
||||
queryParams.state as string
|
||||
);
|
||||
if (isLinked) {
|
||||
@@ -47,12 +47,12 @@ const SecretScanning = withPermission(
|
||||
|
||||
fetchInstallationStatus();
|
||||
linkInstallation();
|
||||
}, [queryParams.state, queryParams.installationid]);
|
||||
}, [queryParams.state, queryParams.installation_id]);
|
||||
|
||||
const generateNewIntegrationSession = async () => {
|
||||
const session = await createNewIntegrationSession(String(localStorage.getItem("orgData.id")));
|
||||
router.push(
|
||||
`https://github.com/apps/infisical-radar/installations/new?state=${session.sessionId}`
|
||||
`https://github.com/apps/infisical-test/installations/new?state=${session.sessionId}`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user