Skip to content

Commit 7ec6a83

Browse files
committed
fix: disable loginmethod read, create, and update endpoints in cloud
1 parent afa24cc commit 7ec6a83

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

packages/server/src/enterprise/controllers/login-method.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export class LoginMethodController {
6666
try {
6767
queryRunner = getRunningExpressApp().AppDataSource.createQueryRunner()
6868
await queryRunner.connect()
69+
if (getRunningExpressApp().identityManager.getPlatformType() === Platform.CLOUD) {
70+
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, GeneralErrorMessage.FORBIDDEN)
71+
}
6972
const query = req.query as Partial<LoginMethod>
7073
const loginMethodService = new LoginMethodService()
7174

@@ -103,6 +106,9 @@ export class LoginMethodController {
103106
public async update(req: Request, res: Response, next: NextFunction) {
104107
try {
105108
const loginMethodService = new LoginMethodService()
109+
if (getRunningExpressApp().identityManager.getPlatformType() === Platform.CLOUD) {
110+
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, GeneralErrorMessage.FORBIDDEN)
111+
}
106112
const loginMethod = await loginMethodService.createOrUpdateConfig(req.body)
107113
if (loginMethod?.status === 'OK' && loginMethod?.organizationId) {
108114
const appServer = getRunningExpressApp()

packages/server/src/enterprise/services/login-method.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { decrypt, encrypt } from '../utils/encryption.util'
88
import { UserErrorMessage, UserService } from './user.service'
99
import { OrganizationErrorMessage, OrganizationService } from './organization.service'
1010
import { IsNull } from 'typeorm'
11+
import { Platform } from '../../Interface'
12+
import { GeneralErrorMessage } from '../../utils/constants'
1113

1214
export const enum LoginMethodErrorMessage {
1315
INVALID_LOGIN_METHOD_ID = 'Invalid Login Method Id',
@@ -77,6 +79,9 @@ export class LoginMethodService {
7779
try {
7880
queryRunner = this.dataSource.createQueryRunner()
7981
await queryRunner.connect()
82+
if (getRunningExpressApp().identityManager.getPlatformType() === Platform.CLOUD) {
83+
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, GeneralErrorMessage.FORBIDDEN)
84+
}
8085
const createdBy = await this.userService.readUserById(data.createdBy, queryRunner)
8186
if (!createdBy) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, UserErrorMessage.USER_NOT_FOUND)
8287
const organization = await this.organizationService.readOrganizationById(data.organizationId, queryRunner)

packages/server/src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const WHITELIST_URLS = [
5757
export const API_KEY_BLACKLIST_URLS = ['/api/v1/nvidia-nim']
5858

5959
export const enum GeneralErrorMessage {
60+
FORBIDDEN = 'Forbidden',
6061
UNAUTHORIZED = 'Unauthorized',
6162
UNHANDLED_EDGE_CASE = 'Unhandled Edge Case',
6263
INVALID_PASSWORD = 'Invalid Password',

0 commit comments

Comments
 (0)