mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 18:29:07 +00:00
Small fixes
This commit is contained in:
@@ -57,3 +57,4 @@ yarn-error.log*
|
||||
|
||||
# Infisical init
|
||||
.infisical.json
|
||||
.vscode
|
||||
@@ -4,7 +4,7 @@ import { tmpdir } from "os";
|
||||
import { join } from "path"
|
||||
import { SecretMatch } from "./types";
|
||||
|
||||
export async function scanFullContentAndGetFindings(octokit: any, installationId: number, repositoryFullName: string): Promise<SecretMatch[]> {
|
||||
export async function scanFullRepoContentAndGetFindings(octokit: any, installationId: number, repositoryFullName: string): Promise<SecretMatch[]> {
|
||||
const tempFolder = await createTempFolder();
|
||||
const findingsPath = join(tempFolder, "findings.json");
|
||||
const repoPath = join(tempFolder, "repo.git")
|
||||
|
||||
@@ -5,7 +5,7 @@ import { sendMail } from "../../helpers";
|
||||
import GitRisks from "../../ee/models/gitRisks";
|
||||
import { MembershipOrg, User } from "../../models";
|
||||
import { ADMIN, OWNER } from "../../variables";
|
||||
import { convertKeysToLowercase, scanFullContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
||||
import { convertKeysToLowercase, scanFullRepoContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
||||
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
||||
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
||||
|
||||
@@ -22,6 +22,7 @@ type TScanPushEventQueueDetails = {
|
||||
|
||||
githubFullRepositorySecretScan.process(async (job: Job, done: Queue.DoneCallback) => {
|
||||
const { organizationId, repository, installationId }: TScanPushEventQueueDetails = job.data
|
||||
try {
|
||||
const octokit = new ProbotOctokit({
|
||||
auth: {
|
||||
appId: await getSecretScanningGitAppId(),
|
||||
@@ -29,9 +30,7 @@ githubFullRepositorySecretScan.process(async (job: Job, done: Queue.DoneCallback
|
||||
installationId: installationId
|
||||
},
|
||||
});
|
||||
try {
|
||||
const findings : SecretMatch[] = await scanFullContentAndGetFindings(octokit, installationId, repository.fullName)
|
||||
|
||||
const findings : SecretMatch[] = await scanFullRepoContentAndGetFindings(octokit, installationId, repository.fullName)
|
||||
for (const finding of findings) {
|
||||
await GitRisks.findOneAndUpdate({ fingerprint: finding.Fingerprint},
|
||||
{
|
||||
@@ -87,7 +86,6 @@ try {
|
||||
} catch (error) {
|
||||
done(new Error(`gitHubHistoricalScanning.process: an error occurred ${error}`), null)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
export const scanGithubFullRepoForSecretLeaks = (pushEventPayload: TScanPushEventQueueDetails) => {
|
||||
|
||||
Reference in New Issue
Block a user