mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 17:27:40 +00:00
remove the use of owner everywhere else
This commit is contained in:
@@ -4,7 +4,7 @@ import TelemetryService from "../../services/TelemetryService";
|
|||||||
import { sendMail } from "../../helpers";
|
import { sendMail } from "../../helpers";
|
||||||
import GitRisks from "../../ee/models/gitRisks";
|
import GitRisks from "../../ee/models/gitRisks";
|
||||||
import { MembershipOrg, User } from "../../models";
|
import { MembershipOrg, User } from "../../models";
|
||||||
import { ADMIN, OWNER } from "../../variables";
|
import { ADMIN } from "../../variables";
|
||||||
import { convertKeysToLowercase, scanFullRepoContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
import { convertKeysToLowercase, scanFullRepoContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
||||||
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
||||||
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
||||||
@@ -24,22 +24,22 @@ githubFullRepositorySecretScan.process(async (job: Job, done: Queue.DoneCallback
|
|||||||
const { organizationId, repository, installationId }: TScanPushEventQueueDetails = job.data
|
const { organizationId, repository, installationId }: TScanPushEventQueueDetails = job.data
|
||||||
try {
|
try {
|
||||||
const octokit = new ProbotOctokit({
|
const octokit = new ProbotOctokit({
|
||||||
auth: {
|
auth: {
|
||||||
appId: await getSecretScanningGitAppId(),
|
appId: await getSecretScanningGitAppId(),
|
||||||
privateKey: await getSecretScanningPrivateKey(),
|
privateKey: await getSecretScanningPrivateKey(),
|
||||||
installationId: installationId
|
installationId: installationId
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const findings : SecretMatch[] = await scanFullRepoContentAndGetFindings(octokit, installationId, repository.fullName)
|
const findings: SecretMatch[] = await scanFullRepoContentAndGetFindings(octokit, installationId, repository.fullName)
|
||||||
for (const finding of findings) {
|
for (const finding of findings) {
|
||||||
await GitRisks.findOneAndUpdate({ fingerprint: finding.Fingerprint},
|
await GitRisks.findOneAndUpdate({ fingerprint: finding.Fingerprint },
|
||||||
{
|
{
|
||||||
...convertKeysToLowercase(finding),
|
...convertKeysToLowercase(finding),
|
||||||
installationId: installationId,
|
installationId: installationId,
|
||||||
organization: organizationId,
|
organization: organizationId,
|
||||||
repositoryFullName: repository.fullName,
|
repositoryFullName: repository.fullName,
|
||||||
repositoryId: repository.id
|
repositoryId: repository.id
|
||||||
}, {
|
}, {
|
||||||
upsert: true
|
upsert: true
|
||||||
}).lean()
|
}).lean()
|
||||||
}
|
}
|
||||||
@@ -47,10 +47,7 @@ githubFullRepositorySecretScan.process(async (job: Job, done: Queue.DoneCallback
|
|||||||
// get emails of admins
|
// get emails of admins
|
||||||
const adminsOfWork = await MembershipOrg.find({
|
const adminsOfWork = await MembershipOrg.find({
|
||||||
organization: organizationId,
|
organization: organizationId,
|
||||||
$or: [
|
role: ADMIN,
|
||||||
{ role: OWNER },
|
|
||||||
{ role: ADMIN }
|
|
||||||
]
|
|
||||||
}).lean()
|
}).lean()
|
||||||
|
|
||||||
const userEmails = await User.find({
|
const userEmails = await User.find({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import TelemetryService from "../../services/TelemetryService";
|
|||||||
import { sendMail } from "../../helpers";
|
import { sendMail } from "../../helpers";
|
||||||
import GitRisks from "../../ee/models/gitRisks";
|
import GitRisks from "../../ee/models/gitRisks";
|
||||||
import { MembershipOrg, User } from "../../models";
|
import { MembershipOrg, User } from "../../models";
|
||||||
import { ADMIN, OWNER } from "../../variables";
|
import { ADMIN } from "../../variables";
|
||||||
import { convertKeysToLowercase, scanContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
import { convertKeysToLowercase, scanContentAndGetFindings } from "../../ee/services/GithubSecretScanning/helper";
|
||||||
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
import { getSecretScanningGitAppId, getSecretScanningPrivateKey } from "../../config";
|
||||||
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
import { SecretMatch } from "../../ee/services/GithubSecretScanning/types";
|
||||||
@@ -88,10 +88,7 @@ githubPushEventSecretScan.process(async (job: Job, done: Queue.DoneCallback) =>
|
|||||||
// get emails of admins
|
// get emails of admins
|
||||||
const adminsOfWork = await MembershipOrg.find({
|
const adminsOfWork = await MembershipOrg.find({
|
||||||
organization: organizationId,
|
organization: organizationId,
|
||||||
$or: [
|
role: ADMIN
|
||||||
{ role: OWNER },
|
|
||||||
{ role: ADMIN }
|
|
||||||
]
|
|
||||||
}).lean()
|
}).lean()
|
||||||
|
|
||||||
const userEmails = await User.find({
|
const userEmails = await User.find({
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
requireAuth,
|
requireAuth,
|
||||||
requireOrganizationAuth
|
requireOrganizationAuth
|
||||||
} from "../../middleware";
|
} from "../../middleware";
|
||||||
import { ACCEPTED, ADMIN, AuthMode, OWNER } from "../../variables";
|
import { ACCEPTED, ADMIN, AuthMode } from "../../variables";
|
||||||
import { organizationsController } from "../../controllers/v2";
|
import { organizationsController } from "../../controllers/v2";
|
||||||
|
|
||||||
// TODO: /POST to create membership
|
// TODO: /POST to create membership
|
||||||
@@ -48,7 +48,7 @@ router.get(
|
|||||||
acceptedAuthModes: [AuthMode.JWT]
|
acceptedAuthModes: [AuthMode.JWT]
|
||||||
}),
|
}),
|
||||||
requireOrganizationAuth({
|
requireOrganizationAuth({
|
||||||
acceptedRoles: [OWNER, ADMIN],
|
acceptedRoles: [ADMIN],
|
||||||
acceptedStatuses: [ACCEPTED]
|
acceptedStatuses: [ACCEPTED]
|
||||||
}),
|
}),
|
||||||
organizationsController.getOrganizationServiceAccounts
|
organizationsController.getOrganizationServiceAccounts
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import {
|
|||||||
OWNER,
|
OWNER,
|
||||||
VIEWER
|
VIEWER
|
||||||
} from "../../variables";
|
} from "../../variables";
|
||||||
|
|
||||||
import { InternalServerError } from "../errors";
|
import { InternalServerError } from "../errors";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// membership roles
|
// membership roles
|
||||||
export const OWNER = "owner";
|
export const OWNER = "owner"; // depreciated
|
||||||
export const ADMIN = "admin";
|
export const ADMIN = "admin";
|
||||||
export const MEMBER = "member";
|
export const MEMBER = "member";
|
||||||
export const VIEWER = "viewer";
|
export const VIEWER = "viewer";
|
||||||
|
|||||||
Reference in New Issue
Block a user