mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 21:29:20 +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",
|
action: "subscribe",
|
||||||
conditions: {
|
conditions: {
|
||||||
eventType: r.event,
|
eventType: r.event,
|
||||||
secretPath: r.conditions?.secretPath ?? "/",
|
...(r.conditions
|
||||||
environment: r.conditions?.environmentSlug
|
? {
|
||||||
|
secretPath: r.conditions?.secretPath,
|
||||||
|
environment: r.conditions?.environmentSlug
|
||||||
|
}
|
||||||
|
: {})
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ export enum ApiDocsTags {
|
|||||||
SecretScanning = "Secret Scanning",
|
SecretScanning = "Secret Scanning",
|
||||||
OidcSso = "OIDC SSO",
|
OidcSso = "OIDC SSO",
|
||||||
SamlSso = "SAML SSO",
|
SamlSso = "SAML SSO",
|
||||||
LdapSso = "LDAP SSO"
|
LdapSso = "LDAP SSO",
|
||||||
|
Events = "Event Subscriptions"
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GROUPS = {
|
export const GROUPS = {
|
||||||
@@ -2869,3 +2870,10 @@ export const LdapSso = {
|
|||||||
caCert: "The CA certificate to use when verifying the LDAP server certificate."
|
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 { getServerSentEventsHeaders } from "@app/ee/services/event/event-sse-stream";
|
||||||
import { EventRegisterSchema } from "@app/ee/services/event/types";
|
import { EventRegisterSchema } from "@app/ee/services/event/types";
|
||||||
import { ProjectPermissionSecretActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
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 { BadRequestError, ForbiddenRequestError, RateLimitError } from "@app/lib/errors";
|
||||||
import { readLimit } from "@app/server/config/rateLimiter";
|
import { readLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
@@ -20,10 +21,14 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
|
|||||||
rateLimit: readLimit
|
rateLimit: readLimit
|
||||||
},
|
},
|
||||||
schema: {
|
schema: {
|
||||||
|
hide: false,
|
||||||
|
tags: [ApiDocsTags.Events],
|
||||||
|
description: "Subscribe to project events",
|
||||||
body: z.object({
|
body: z.object({
|
||||||
projectId: z.string().trim(),
|
projectId: z.string().trim().describe(EventSubscriptions.SUBSCRIBE_PROJECT_EVENTS.projectId),
|
||||||
register: z.array(EventRegisterSchema).max(10)
|
register: z.array(EventRegisterSchema).max(10)
|
||||||
})
|
}),
|
||||||
|
produces: ["text/event-stream"]
|
||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
handler: async (req, reply) => {
|
handler: async (req, reply) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user