Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: autopost url

Nevo Davidbe5d871896e9
diff --git a/apps/backend/src/api/routes/autopost.controller.ts b/apps/backend/src/api/routes/autopost.controller.ts
index 9e6914edb..ced3c4247 100644
--- a/apps/backend/src/api/routes/autopost.controller.ts
+++ b/apps/backend/src/api/routes/autopost.controller.ts
@@ -15,6 +15,7 @@ import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permis
import { AutopostService } from '@gitroom/nestjs-libraries/database/prisma/autopost/autopost.service';
import { AutopostDto } from '@gitroom/nestjs-libraries/dtos/autopost/autopost.dto';
import { AuthorizationActions, Sections } from '@gitroom/backend/services/auth/permissions/permission.exception.class';
+import { OnlyURL } from '@gitroom/nestjs-libraries/dtos/webhooks/webhooks.dto';
@ApiTags('Autopost')
@Controller('/autopost')
@@ -62,7 +63,7 @@ export class AutopostController {
}
@Post('/send')
- async sendWebhook(@Query('url') url: string) {
- return this._autopostsService.loadXML(url);
+ async sendWebhook(@Query() query: OnlyURL) {
+ return this._autopostsService.loadXML(query.url);
}
}
diff --git a/libraries/nestjs-libraries/src/dtos/autopost/autopost.dto.ts b/libraries/nestjs-libraries/src/dtos/autopost/autopost.dto.ts
index 4732b211f..d2850db58 100644
--- a/libraries/nestjs-libraries/src/dtos/autopost/autopost.dto.ts
+++ b/libraries/nestjs-libraries/src/dtos/autopost/autopost.dto.ts
@@ -8,6 +8,7 @@ import {
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
+import { IsSafeWebhookUrl } from '@gitroom/nestjs-libraries/dtos/webhooks/webhook.url.validator';
export class Integrations {
@IsString()
@@ -38,6 +39,10 @@ export class AutopostDto {
@IsUrl()
@IsDefined()
+ @IsSafeWebhookUrl({
+ message:
+ 'Autopost URL must be a public HTTPS URL and cannot point to internal network addresses',
+ })
url: string;
@IsBoolean()