Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: pr changes

sidwebworks806165b9e92f
diff --git a/backend/src/ee/services/event/event-sse-stream.ts b/backend/src/ee/services/event/event-sse-stream.ts
index 0b7607ee51..4c5fcf779c 100644
--- a/backend/src/ee/services/event/event-sse-stream.ts
+++ b/backend/src/ee/services/event/event-sse-stream.ts
@@ -66,19 +66,24 @@ export type EventStreamClient = {
};
export function createEventStreamClient(redis: Redis, options: IEventStreamClientOpts): EventStreamClient {
- const rules = options.registered.map((r) => ({
- subject: options.type,
- action: "subscribe",
- conditions: {
- eventType: r.event,
- ...(r.conditions
- ? {
- secretPath: r.conditions?.secretPath,
- environment: r.conditions?.environmentSlug
- }
- : {})
- }
- }));
+ const rules = options.registered.map((r) => {
+ const secretPath = r.conditions?.secretPath;
+ const hasConditions = r.conditions?.environmentSlug || r.conditions?.secretPath;
+
+ return {
+ subject: options.type,
+ action: "subscribe",
+ conditions: {
+ eventType: r.event,
+ ...(hasConditions
+ ? {
+ environment: r.conditions?.environmentSlug ?? "",
+ secretPath: r.conditions?.recursive ? { $glob: `${secretPath}/**` } : secretPath
+ }
+ : {})
+ }
+ };
+ });
const id = `sse-${nanoid()}`;
const control = new AbortController();
diff --git a/backend/src/ee/services/event/types.ts b/backend/src/ee/services/event/types.ts
index 721e6ea13b..72227c8639 100644
--- a/backend/src/ee/services/event/types.ts
+++ b/backend/src/ee/services/event/types.ts
@@ -117,7 +117,8 @@ export const EventRegisterSchema = z.object({
conditions: z
.object({
secretPath: z.string().optional().default("/"),
- environmentSlug: z.string()
+ environmentSlug: z.string(),
+ recursive: z.boolean().optional().default(false)
})
.optional()
});
diff --git a/backend/src/server/routes/v1/event-router.ts b/backend/src/server/routes/v1/event-router.ts
index dd6932c9a2..c379089444 100644
--- a/backend/src/server/routes/v1/event-router.ts
+++ b/backend/src/server/routes/v1/event-router.ts
@@ -80,13 +80,15 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
}
req.body.register.forEach((r) => {
+ const fields = {
+ environment: r.conditions?.environmentSlug ?? "",
+ secretPath: r.conditions?.secretPath ?? "/",
+ eventType: r.event
+ };
+
const allowed = info.permission.can(
ProjectPermissionSecretActions.Subscribe,
- subject(ProjectPermissionSub.Secrets, {
- environment: r.conditions?.environmentSlug ?? "",
- secretPath: r.conditions?.secretPath ?? "/",
- eventType: r.event
- })
+ subject(ProjectPermissionSub.Secrets, fields)
);
if (!allowed) {
@@ -94,9 +96,9 @@ export const registerEventRouter = async (server: FastifyZodProvider) => {
name: "PermissionDenied",
message: `You are not allowed to subscribe on secrets`,
details: {
- event: r.event,
- environmentSlug: r.conditions?.environmentSlug,
- secretPath: r.conditions?.secretPath ?? "/"
+ event: fields.eventType,
+ environmentSlug: fields.environment,
+ secretPath: fields.secretPath
}
});
}
diff --git a/docs/documentation/platform/event-subscriptions.mdx b/docs/documentation/platform/event-subscriptions.mdx
index 017fd937e7..cefef68247 100644
--- a/docs/documentation/platform/event-subscriptions.mdx
+++ b/docs/documentation/platform/event-subscriptions.mdx
@@ -5,20 +5,12 @@ description: "Subscribe to events in Infisical for real-time updates"
---
<Info>
- <strong>Note:</strong> Event Subscriptions is a paid feature.
- <br />
- <br />
- On Infisical Cloud, this feature is available on the <strong>
- Pro
- </strong> and <strong>Enterprise</strong> tiers, with each tier providing
- different event retention periods.
- <br />
- For self-hosted deployments, please contact{" "}
- <a href="mailto:[email protected]">[email protected]</a> to purchase an
+ **Note:** Event Subscriptions is a paid feature. - **Infisical Cloud users:** Event Subscriptions is
+ available under the **Enterprise Tier**. - **Self-Hosted Infisical:** Please
+ contact [[email protected]](mailto:[email protected]) to purchase an
enterprise license.
</Info>
-## Introduction
Event Subscriptions in Infisical allow you to receive real-time notifications when specific actions occur within your account or organization. These notifications can include changes to secrets, users, teams, and other important resources.
@@ -30,9 +22,10 @@ You can currently subscribe to notifications for the following event types:
- `secret:updated`: Triggered when a secret is updated.
- `secret:deleted`: Triggered when a secret is deleted.
+
## Permissions Setup
-Proper permissions are required to configure event subscriptions. Follow these steps to set up the necessary permissions:
+In order to receive events on a supported resource, the identity is required to have a Subscribe permission on that resource. Follow these steps to set up the necessary permissions:
<Steps>
<Step title="Select a project and copy the 'Project ID'">
diff --git a/docs/images/platform/events/project-role.png b/docs/images/platform/events/project-role.png
index 54bb625816..b6178939f3 100644
Binary files a/docs/images/platform/events/project-role.png and b/docs/images/platform/events/project-role.png differ