Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/src/entities/company-info/company-info.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import {
IRemoveUserFromCompany,
IRevokeUserInvitationInCompany,
ISuspendUsersInCompany,
IUnsuspendUsersInCompany,
IToggleCompanyTestConnectionsMode,
IUnsuspendUsersInCompany,
IUpdateCompanyName,
IUpdateUsers2faStatusInCompany,
IUpdateUsersCompanyRoles,
Expand Down Expand Up @@ -173,6 +173,7 @@ export class CompanyInfoController {
description: 'Get company name by id.',
type: FoundCompanyNameDs,
})
@Throttle({ default: { limit: isTest() ? 200 : 10, ttl: 60000 } })
@Get('name/:companyId')
async getCompanyNameById(@Param('companyId') companyId: string): Promise<FoundCompanyNameDs> {
return await this.getCompanyNameUseCase.execute(companyId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BadRequestException } from '@nestjs/common';
import { ConnectionTypesEnum } from '@rocketadmin/shared-code/dist/src/shared/enums/connection-types-enum.js';
import { isReadOnlyMongoAggregationPipeline } from '../../../../ai-core/tools/query-validators.js';
import { slackPostMessage } from '../../../../helpers/slack/slack-post-message.js';

const FORBIDDEN_SQL_KEYWORDS = [
Expand Down Expand Up @@ -175,6 +176,14 @@ export function checkMongoQueryIsSafe(query: string): QuerySafetyResult {
}
}

if (!isReadOnlyMongoAggregationPipeline(query)) {
return {
isSafe: false,
reason:
'Query must be a read-only aggregation pipeline (write stages or server-side JavaScript operators such as $out, $merge, $function, $accumulator, $where are not allowed)',
};
}
Comment on lines +179 to +185

return { isSafe: true };
}

Expand Down
Loading