mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: make the conditions optional in casl check
This commit is contained in:
@@ -71,8 +71,12 @@ export function createEventStreamClient(redis: Redis, options: IEventStreamClien
|
||||
action: "subscribe",
|
||||
conditions: {
|
||||
eventType: r.event,
|
||||
secretPath: r.conditions?.secretPath ?? "/",
|
||||
environment: r.conditions?.environmentSlug
|
||||
...(r.conditions
|
||||
? {
|
||||
secretPath: r.conditions?.secretPath,
|
||||
environment: r.conditions?.environmentSlug
|
||||
}
|
||||
: {})
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ export enum ApiDocsTags {
|
||||
SecretScanning = "Secret Scanning",
|
||||
OidcSso = "OIDC SSO",
|
||||
SamlSso = "SAML SSO",
|
||||
LdapSso = "LDAP SSO"
|
||||
LdapSso = "LDAP SSO",
|
||||
Events = "Event Subscriptions"
|
||||
}
|
||||
|
||||
export const GROUPS = {
|
||||
@@ -2869,3 +2870,10 @@ export const LdapSso = {
|
||||
caCert: "The CA certificate to use when verifying the LDAP server certificate."
|
||||
}
|
||||
};
|
||||
|
||||
export const EventSubscriptions = {
|
||||
SUBSCRIBE_PROJECT_EVENTS: {
|
||||
projectId: "The ID of the project the group belongs to.",
|
||||
register: "List of events you want to subscribe to"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ActionProjectType, ProjectType } from "@app/db/schemas";
|
||||
import { getServerSentEventsHeaders } from "@app/ee/services/event/event-sse-stream";
|
||||
import { EventRegisterSchema } from "@app/ee/services/event/types";
|
||||
import { ProjectPermissionSecretActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { ApiDocsTags, EventSubscriptions } from "@app/lib/api-docs";
|
||||
import { BadRequestError, ForbiddenRequestError, RateLimitError } from "@app/lib/errors";
|
||||
import { readLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
@@ -20,10 +21,14 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
|
||||
rateLimit: readLimit
|
||||
},
|
||||
schema: {
|
||||
hide: false,
|
||||
tags: [ApiDocsTags.Events],
|
||||
description: "Subscribe to project events",
|
||||
body: z.object({
|
||||
projectId: z.string().trim(),
|
||||
projectId: z.string().trim().describe(EventSubscriptions.SUBSCRIBE_PROJECT_EVENTS.projectId),
|
||||
register: z.array(EventRegisterSchema).max(10)
|
||||
})
|
||||
}),
|
||||
produces: ["text/event-stream"]
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||
handler: async (req, reply) => {
|
||||
|
||||
Reference in New Issue
Block a user