Skip to content

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

fix: add GATEWAY_ACCESS_TOKEN to relay list endpoint for CLI relay selection

bernie-gf90dc4966ad6
diff --git a/backend/src/ee/routes/v1/relay-router.ts b/backend/src/ee/routes/v1/relay-router.ts
index 89b2a9531b..66e6640e45 100644
--- a/backend/src/ee/routes/v1/relay-router.ts
+++ b/backend/src/ee/routes/v1/relay-router.ts
@@ -114,7 +114,7 @@ export const registerRelayRouter = async (server: FastifyZodProvider) => {
config: {
rateLimit: readLimit
},
- onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.GATEWAY_ACCESS_TOKEN]),
handler: async (req) => {
return server.services.relay.getRelays({
actorId: req.permission.id,
diff --git a/backend/src/ee/services/relay/relay-service.ts b/backend/src/ee/services/relay/relay-service.ts
index f1b98ba530..4f0b9c3439 100644
--- a/backend/src/ee/services/relay/relay-service.ts
+++ b/backend/src/ee/services/relay/relay-service.ts
@@ -1154,16 +1154,18 @@ export const relayServiceFactory = ({
actorAuthMethod: ActorAuthMethod;
actorOrgId: string;
}) => {
- const { permission } = await permissionService.getOrgPermission({
- scope: OrganizationActionScope.Any,
- actor,
- actorId,
- orgId: actorOrgId,
- actorAuthMethod: actorAuthMethod!,
- actorOrgId
- });
+ if (actor !== ActorType.GATEWAY) {
+ const { permission } = await permissionService.getOrgPermission({
+ scope: OrganizationActionScope.Any,
+ actor,
+ actorId,
+ orgId: actorOrgId,
+ actorAuthMethod: actorAuthMethod!,
+ actorOrgId
+ });
- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionRelayActions.ListRelays, OrgPermissionSubjects.Relay);
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionRelayActions.ListRelays, OrgPermissionSubjects.Relay);
+ }
const instanceRelays = await relayDAL.find({
orgId: null