mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 11:27:47 +00:00
Feat: List secrets by project slug
This commit is contained in:
@@ -17,6 +17,7 @@ import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
|||||||
import { getUserAgentType } from "@app/server/plugins/audit-log";
|
import { getUserAgentType } from "@app/server/plugins/audit-log";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { ProjectFilterType } from "@app/services/project/project-types";
|
||||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
import { secretRawSchema } from "../sanitizedSchemas";
|
import { secretRawSchema } from "../sanitizedSchemas";
|
||||||
@@ -70,6 +71,18 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
environment = scope[0].environment;
|
environment = scope[0].environment;
|
||||||
workspaceId = req.auth.serviceToken.projectId;
|
workspaceId = req.auth.serviceToken.projectId;
|
||||||
}
|
}
|
||||||
|
} else if (req.permission.type === ActorType.IDENTITY && req.query.workspaceSlug && !workspaceId) {
|
||||||
|
const workspace = await server.services.project.getAProject({
|
||||||
|
filter: {
|
||||||
|
type: ProjectFilterType.SLUG,
|
||||||
|
orgId: req.permission.orgId,
|
||||||
|
slug: req.query.workspaceSlug
|
||||||
|
},
|
||||||
|
actorId: req.permission.id,
|
||||||
|
actor: req.permission.type,
|
||||||
|
actorOrgId: req.permission.orgId
|
||||||
|
});
|
||||||
|
workspaceId = workspace.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!workspaceId || !environment) throw new BadRequestError({ message: "Missing workspace id or environment" });
|
if (!workspaceId || !environment) throw new BadRequestError({ message: "Missing workspace id or environment" });
|
||||||
@@ -85,7 +98,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await server.services.auditLog.createAuditLog({
|
await server.services.auditLog.createAuditLog({
|
||||||
projectId: req.query.workspaceId,
|
projectId: workspaceId,
|
||||||
...req.auditLogInfo,
|
...req.auditLogInfo,
|
||||||
event: {
|
event: {
|
||||||
type: EventType.GET_SECRETS,
|
type: EventType.GET_SECRETS,
|
||||||
|
|||||||
Reference in New Issue
Block a user