Skip to content

📨 The ultimate agentic social media scheduling tool 🤖

fix(security): non axios ssrf checking

Nevo David6c4a8ca41d54
diff --git a/libraries/nestjs-libraries/src/dtos/webhooks/ssrf.safe.dispatcher.ts b/libraries/nestjs-libraries/src/dtos/webhooks/ssrf.safe.dispatcher.ts
index dfd69abee..05cc43f7e 100644
--- a/libraries/nestjs-libraries/src/dtos/webhooks/ssrf.safe.dispatcher.ts
+++ b/libraries/nestjs-libraries/src/dtos/webhooks/ssrf.safe.dispatcher.ts
@@ -1,43 +1,66 @@
import { Agent } from 'undici';
+import axios, { AxiosInstance } from 'axios';
import dns from 'node:dns';
import net from 'node:net';
+import http from 'node:http';
+import https from 'node:https';
import { isBlockedIp } from './webhook.url.validator';
// Pins DNS resolution: every resolved IP is checked with `isBlockedIp` and
-// the caller (undici) connects to that same set. Closes the TOCTOU window
+// the caller connects to that same set. Closes the TOCTOU window
// `isSafePublicHttpsUrl` alone leaves open (see GHSA-f7jj-p389-4w45).
-export const ssrfSafeDispatcher = new Agent({
- connect: {
- lookup(hostname, options, callback) {
- if (net.isIP(hostname)) {
- const family = net.isIP(hostname);
- if (isBlockedIp(hostname)) {
+function ssrfSafeLookup(
+ hostname: string,
+ options: any,
+ callback: (
+ err: NodeJS.ErrnoException | null,
+ address: any,
+ family?: number
+ ) => void
+) {
+ if (net.isIP(hostname)) {
+ const family = net.isIP(hostname);
+ if (isBlockedIp(hostname)) {
+ return callback(new Error('Blocked IP'), '', 0);
+ }
+ return options && (options as any).all
+ ? callback(null, [{ address: hostname, family }] as any, family)
+ : callback(null, hostname, family);
+ }
+
+ dns.lookup(hostname, options, (err, address: any, family: any) => {
+ if (err) return callback(err, '', 0);
+ if (Array.isArray(address)) {
+ for (const entry of address) {
+ if (isBlockedIp(entry.address)) {
return callback(new Error('Blocked IP'), '', 0);
}
- return options && (options as any).all
- ? callback(null, [{ address: hostname, family }] as any, family)
- : callback(null, hostname, family);
}
+ return callback(null, address as any, 0);
+ }
+ if (isBlockedIp(address)) {
+ return callback(new Error('Blocked IP'), '', 0);
+ }
+ callback(null, address, family);
+ });
+}
- dns.lookup(hostname, options, (err, address: any, family: any) => {
- if (err) return callback(err, '', 0);
- if (Array.isArray(address)) {
- for (const entry of address) {
- if (isBlockedIp(entry.address)) {
- return callback(new Error('Blocked IP'), '', 0);
- }
- }
- return callback(null, address as any, 0);
- }
- if (isBlockedIp(address)) {
- return callback(new Error('Blocked IP'), '', 0);
- }
- callback(null, address, family);
- });
- },
+export const ssrfSafeDispatcher = new Agent({
+ connect: {
+ lookup: ssrfSafeLookup,
},
});
+// axios can't use an undici dispatcher, but Node's http(s) agents accept the
+// same `lookup` hook, so axios requests (providers that need form-data /
+// stream uploads) get the identical pinned-DNS guard as `this.fetch`.
+const ssrfSafeAxios = axios.create({
+ httpAgent: new http.Agent({ lookup: ssrfSafeLookup } as http.AgentOptions),
+ httpsAgent: new https.Agent({
+ lookup: ssrfSafeLookup,
+ } as https.AgentOptions),
+});
+
// Self-hosters legitimately connect Postiz to WordPress/Mastodon/Lemmy/Listmonk
// instances that live on a private network (e.g. the same Docker network or VPC).
// Setting DISABLE_SSRF_PROTECTION=true opts those deployments out of the IP
@@ -47,3 +70,7 @@ export function getSsrfSafeDispatcher(): Agent | undefined {
? undefined
: ssrfSafeDispatcher;
}
+
+export function getSsrfSafeAxios(): AxiosInstance {
+ return process.env.DISABLE_SSRF_PROTECTION === 'true' ? axios : ssrfSafeAxios;
+}
diff --git a/libraries/nestjs-libraries/src/integrations/social.abstract.ts b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
index 6db987825..0b6a1cb3d 100644
--- a/libraries/nestjs-libraries/src/integrations/social.abstract.ts
+++ b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
@@ -3,7 +3,10 @@ import { Integration } from '@prisma/client';
import { PendingCheckResponse } from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
import { ApplicationFailure } from '@temporalio/activity';
import { readOrFetch } from '@gitroom/helpers/utils/read.or.fetch';
-import { getSsrfSafeDispatcher } from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
+import {
+ getSsrfSafeAxios,
+ getSsrfSafeDispatcher,
+} from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
import sharp from 'sharp';
import { createReadStream, statSync } from 'fs';
import { Readable } from 'stream';
@@ -152,6 +155,13 @@ export abstract class SocialAbstract {
);
}
+ // axios flavor of the SSRF-safe dispatcher that `this.fetch` applies - for
+ // providers that need axios (form-data / stream uploads). Never call plain
+ // axios with a user-influenced URL.
+ protected getSsrfSafeAxios() {
+ return getSsrfSafeAxios();
+ }
+
protected assetBoolean(value: boolean | string) {
if (typeof value === 'string') {
return value.toLowerCase() === 'true';
diff --git a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
index 33866c6c7..0bd962b3b 100644
--- a/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts
@@ -24,11 +24,13 @@ import dayjs from 'dayjs';
import { Integration } from '@prisma/client';
import { AuthService } from '@gitroom/helpers/auth/auth.service';
import { isSafePublicHttpsUrl } from '@gitroom/nestjs-libraries/dtos/webhooks/webhook.url.validator';
-import { getSsrfSafeDispatcher } from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
+import {
+ getSsrfSafeAxios,
+ getSsrfSafeDispatcher,
+} from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
import sharp from 'sharp';
import { Plug } from '@gitroom/helpers/decorators/plug.decorator';
import { timer } from '@gitroom/helpers/utils/timer';
-import axios from 'axios';
import { stripHtmlValidation } from '@gitroom/helpers/utils/strip.html.validation';
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
import { hasExtension } from '@gitroom/helpers/utils/has.extension';
@@ -36,7 +38,9 @@ import { hasExtension } from '@gitroom/helpers/utils/has.extension';
async function reduceImageBySize(url: string, maxSizeKB = 976) {
try {
// Fetch the image from the URL
- const response = await axios.get(url, { responseType: 'arraybuffer' });
+ const response = await getSsrfSafeAxios().get(url, {
+ responseType: 'arraybuffer',
+ });
let imageBuffer = Buffer.from(response.data);
// Use sharp to get the metadata of the image
@@ -228,7 +232,8 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
override maxConcurrentJob = 2; // Bluesky has moderate rate limits
identifier = 'bluesky';
name = 'Bluesky';
- toolTip = "We don’t currently support two-factor authentication. If it’s enabled on Bluesky, you’ll need to disable it."
+ toolTip =
+ 'We don’t currently support two-factor authentication. If it’s enabled on Bluesky, you’ll need to disable it.';
isBetweenSteps = false;
scopes = ['write:statuses', 'profile', 'write:media'];
editor = 'normal' as const;
@@ -564,7 +569,11 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
// skipped): hand back to the workflow to keep polling.
return {
status: 'pending',
- pendingData: { ...pendingData, attempting: false, confirmed: false },
+ pendingData: {
+ ...pendingData,
+ attempting: false,
+ confirmed: false,
+ },
};
}
@@ -655,9 +664,9 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
return {
status: 'completed',
postId: uri,
- releaseURL: `https://bsky.app/profile/${
- integration.internalId
- }/post/${uri.split('/').pop()}`,
+ releaseURL: `https://bsky.app/profile/${integration.internalId}/post/${uri
+ .split('/')
+ .pop()}`,
};
}
@@ -765,9 +774,11 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
// @ts-ignore
const parentCid = parentThread.data.thread.post?.cid;
// @ts-ignore
- const rootUri = parentThread.data.thread.post?.record?.reply?.root?.uri || postId;
+ const rootUri =
+ parentThread.data.thread.post?.record?.reply?.root?.uri || postId;
// @ts-ignore
- const rootCid = parentThread.data.thread.post?.record?.reply?.root?.cid || parentCid;
+ const rootCid =
+ parentThread.data.thread.post?.record?.reply?.root?.cid || parentCid;
// @ts-ignore
const { cid, uri, commit } = await agent.post({
@@ -792,7 +803,9 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
id: commentPost.id,
postId: uri,
status: 'completed',
- releaseURL: `https://bsky.app/profile/${id}/post/${uri.split('/').pop()}`,
+ releaseURL: `https://bsky.app/profile/${id}/post/${uri
+ .split('/')
+ .pop()}`,
},
];
}
diff --git a/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts b/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts
index ab9d6a18e..61608a56f 100644
--- a/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts
@@ -9,7 +9,6 @@ import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.ab
import { Integration } from '@prisma/client';
import { DiscordDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/discord.dto';
import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';
-import axios from 'axios';
import FormDataUpload from 'form-data';
export class DiscordProvider extends SocialAbstract implements SocialProvider {
@@ -173,7 +172,7 @@ export class DiscordProvider extends SocialAbstract implements SocialProvider {
index++;
}
- const { data } = await axios.post(
+ const { data } = await this.getSsrfSafeAxios().post(
`https://discord.com/api/channels/${channel}/messages`,
form,
{
diff --git a/libraries/nestjs-libraries/src/integrations/social/dribbble.provider.ts b/libraries/nestjs-libraries/src/integrations/social/dribbble.provider.ts
index 7b93eae45..eab2e725a 100644
--- a/libraries/nestjs-libraries/src/integrations/social/dribbble.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/dribbble.provider.ts
@@ -6,7 +6,6 @@ import {
SocialProvider,
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
-import axios from 'axios';
import FormData from 'form-data';
import {
SocialAbstract,
@@ -29,9 +28,9 @@ export class DribbbleProvider extends SocialAbstract implements SocialProvider {
}
dto = DribbbleDto;
- override async checkValidity(
- [firstItem]: Array<ValidityMedia[]>
- ): Promise<string | true> {
+ override async checkValidity([firstItem]: Array<ValidityMedia[]>): Promise<
+ string | true
+ > {
const isMp4 = firstItem?.find(
(item) => (item?.path?.indexOf?.('mp4') ?? -1) > -1
);
@@ -163,7 +162,7 @@ export class DribbbleProvider extends SocialAbstract implements SocialProvider {
accessToken: string,
postDetails: PostDetails<DribbbleDto>[]
): Promise<PostResponse[]> {
- const { data, status } = await axios.get(
+ const { data, status } = await this.getSsrfSafeAxios().get(
postDetails?.[0]?.media?.[0]?.path!,
{
responseType: 'stream',
@@ -181,7 +180,7 @@ export class DribbbleProvider extends SocialAbstract implements SocialProvider {
formData.append('title', postDetails[0].settings.title);
formData.append('description', postDetails[0].message);
- const data2 = await axios.post(
+ const data2 = await this.getSsrfSafeAxios().post(
'https://api.dribbble.com/v2/shots',
formData,
{
diff --git a/libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts b/libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts
index 50d44445d..2bc8db4e3 100644
--- a/libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/moltbook.provider.ts
@@ -8,7 +8,6 @@ import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import dayjs from 'dayjs';
import { Integration } from '@prisma/client';
-import axios from 'axios';
const MOLTBOOK_API_BASE = 'https://www.moltbook.com/api/v1';
@@ -47,7 +46,7 @@ export class MoltbookProvider extends SocialAbstract implements SocialProvider {
}
async registerAgent(name: string, description: string) {
- const response = await axios.post(
+ const response = await this.getSsrfSafeAxios().post(
`${MOLTBOOK_API_BASE}/agents/register`,
{ name, description },
{ headers: { 'Content-Type': 'application/json' } }
@@ -61,17 +60,23 @@ export class MoltbookProvider extends SocialAbstract implements SocialProvider {
}
async checkAgentStatus(apiKey: string) {
- const response = await axios.get(`${MOLTBOOK_API_BASE}/agents/status`, {
- headers: { Authorization: `Bearer ${apiKey}` },
- });
+ const response = await this.getSsrfSafeAxios().get(
+ `${MOLTBOOK_API_BASE}/agents/status`,
+ {
+ headers: { Authorization: `Bearer ${apiKey}` },
+ }
+ );
return response.data;
}
async getAgentProfile(apiKey: string) {
- const response = await axios.get(`${MOLTBOOK_API_BASE}/agents/me`, {
- headers: { Authorization: `Bearer ${apiKey}` },
- });
+ const response = await this.getSsrfSafeAxios().get(
+ `${MOLTBOOK_API_BASE}/agents/me`,
+ {
+ headers: { Authorization: `Bearer ${apiKey}` },
+ }
+ );
if (!response.data.success) {
throw new Error(response.data.error || 'Failed to get profile');
@@ -120,7 +125,7 @@ export class MoltbookProvider extends SocialAbstract implements SocialProvider {
content: post.message,
};
- const response = await axios.post(
+ const response = await this.getSsrfSafeAxios().post(
`${MOLTBOOK_API_BASE}/posts`,
postData,
{
@@ -166,7 +171,7 @@ export class MoltbookProvider extends SocialAbstract implements SocialProvider {
commentData.parent_id = lastCommentId;
}
- const response = await axios.post(
+ const response = await this.getSsrfSafeAxios().post(
`${MOLTBOOK_API_BASE}/posts/${postId}/comments`,
commentData,
{
diff --git a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
index 98100cbf2..3317cd507 100644
--- a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
@@ -9,7 +9,6 @@ import {
import { Integration } from '@prisma/client';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { PinterestSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/pinterest.dto';
-import axios from 'axios';
import FormData from 'form-data';
import { timer } from '@gitroom/helpers/utils/timer';
import {
@@ -69,9 +68,9 @@ export class PinterestProvider
dto = PinterestSettingsDto;
- override async checkValidity(
- [firstItem]: Array<ValidityMedia[]>
- ): Promise<string | true> {
+ override async checkValidity([firstItem]: Array<ValidityMedia[]>): Promise<
+ string | true
+ > {
const isMp4 = firstItem?.find(
(item) => (item?.path?.indexOf?.('mp4') ?? -1) > -1
);
@@ -125,20 +124,22 @@ export class PinterestProvider
if (body.indexOf('Unable to reach the URL') > -1) {
return {
type: 'retry' as const,
- value: 'Pinterest was unable to reach the URL provided. Please check the link and try again.',
- }
+ value:
+ 'Pinterest was unable to reach the URL provided. Please check the link and try again.',
+ };
}
if (body.indexOf(`does not match '^\\\\\\\\\\\\\\\\d+$'`) > -1) {
return {
type: 'bad-body' as const,
- value: 'The board ID must be a numeric string. Please check the board ID format.',
- }
+ value:
+ 'The board ID must be a numeric string. Please check the board ID format.',
+ };
}
if (body.indexOf('Board not found') > -1) {
return {
type: 'bad-body' as const,
value: 'The specified board was not found. Please check the board ID.',
- }
+ };
}
if (body.indexOf('cover_image_url or cover_image_content_type') > -1) {
return {
@@ -298,7 +299,7 @@ export class PinterestProvider
})
).json();
- const { data } = await axios.get(findMp4.path, {
+ const { data } = await this.getSsrfSafeAxios().get(findMp4.path, {
responseType: 'stream',
});
@@ -310,7 +311,7 @@ export class PinterestProvider
}, new FormData());
formData.append('file', data);
- await axios.post(upload_url, formData);
+ await this.getSsrfSafeAxios().post(upload_url, formData);
mediaId = media_id;
}
diff --git a/libraries/nestjs-libraries/src/integrations/social/reddit.provider.ts b/libraries/nestjs-libraries/src/integrations/social/reddit.provider.ts
index 25b843a4f..627645b36 100644
--- a/libraries/nestjs-libraries/src/integrations/social/reddit.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/reddit.provider.ts
@@ -15,7 +15,6 @@ import {
ValidityMedia,
} from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { lookup } from 'mime-types';
-import axios from 'axios';
import FormDataUpload from 'form-data';
import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';
import { Integration } from '@prisma/client';
@@ -227,7 +226,7 @@ export class RedditProvider extends SocialAbstract implements SocialProvider {
knownLength: fileSize,
});
- const d = await axios.post('https:' + action, upload, {
+ const d = await this.getSsrfSafeAxios().post('https:' + action, upload, {
headers: upload.getHeaders(),
});
@@ -280,9 +279,7 @@ export class RedditProvider extends SocialAbstract implements SocialProvider {
// an earlier schedule, a template repost - must never be mistaken for
// this one. Fall back to a one-hour window for pendingData that predates
// the armedAt field.
- const cutoff = armedAt
- ? armedAt - 60 * 1000
- : Date.now() - 60 * 60 * 1000;
+ const cutoff = armedAt ? armedAt - 60 * 1000 : Date.now() - 60 * 60 * 1000;
const found = (data?.children || []).find(
(c: any) =>
@@ -308,8 +305,14 @@ export class RedditProvider extends SocialAbstract implements SocialProvider {
): PendingCheckResponse {
return {
status: 'completed',
- postId: results.map((p) => p.postId).filter(Boolean).join(','),
- releaseURL: results.map((p) => p.releaseURL).filter(Boolean).join(','),
+ postId: results
+ .map((p) => p.postId)
+ .filter(Boolean)
+ .join(','),
+ releaseURL: results
+ .map((p) => p.releaseURL)
+ .filter(Boolean)
+ .join(','),
};
}
diff --git a/libraries/nestjs-libraries/src/integrations/social/tumblr.provider.ts b/libraries/nestjs-libraries/src/integrations/social/tumblr.provider.ts
index c19533146..9761021c8 100644
--- a/libraries/nestjs-libraries/src/integrations/social/tumblr.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/tumblr.provider.ts
@@ -12,7 +12,6 @@ import {
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { TumblrDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/tumblr.dto';
import { Integration } from '@prisma/client';
-import axios from 'axios';
import FormDataUpload from 'form-data';
import { lookup } from 'mime-types';
import { hasExtension } from '@gitroom/helpers/utils/has.extension';
@@ -533,7 +532,7 @@ export class TumblrProvider extends SocialAbstract implements SocialProvider {
});
}
- const { data: response } = await axios.post(
+ const { data: response } = await this.getSsrfSafeAxios().post(
`${TUMBLR_API_URL}/blog/${encodeURIComponent(blogName)}/posts`,
formData,
{
diff --git a/libraries/nestjs-libraries/src/integrations/social/vk.provider.ts b/libraries/nestjs-libraries/src/integrations/social/vk.provider.ts
index f767d531e..26fa196af 100644
--- a/libraries/nestjs-libraries/src/integrations/social/vk.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/vk.provider.ts
@@ -8,7 +8,6 @@ import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import dayjs from 'dayjs';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { createHash, randomBytes } from 'crypto';
-import axios from 'axios';
import FormDataNew from 'form-data';
import mime from 'mime-types';
import { Integration } from '@prisma/client';
@@ -175,7 +174,7 @@ export class VkProvider extends SocialAbstract implements SocialProvider {
)
).json();
- const { data } = await axios.get(media.path!, {
+ const { data } = await this.getSsrfSafeAxios().get(media.path!, {
responseType: 'stream',
});
@@ -187,11 +186,15 @@ export class VkProvider extends SocialAbstract implements SocialProvider {
contentType: mime.lookup(slash!) || '',
});
const value = (
- await axios.post(all.response.upload_url, formData, {
- headers: {
- ...formData.getHeaders(),
- },
- })
+ await this.getSsrfSafeAxios().post(
+ all.response.upload_url,
+ formData,
+ {
+ headers: {
+ ...formData.getHeaders(),
+ },
+ }
+ )
).data;
if (hasExtension(media.path, 'mp4')) {
diff --git a/libraries/nestjs-libraries/src/integrations/social/wordpress.provider.ts b/libraries/nestjs-libraries/src/integrations/social/wordpress.provider.ts
index 161f598bb..d7ba3d773 100644
--- a/libraries/nestjs-libraries/src/integrations/social/wordpress.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/wordpress.provider.ts
@@ -11,7 +11,6 @@ import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { WordpressDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/wordpress.dto';
import slugify from 'slugify';
// import FormData from 'form-data';
-import axios from 'axios';
import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';
import { getSsrfSafeDispatcher } from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
import { string } from 'yup';
diff --git a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts
index 5567b1339..96ef5ad3a 100644
--- a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts
@@ -10,7 +10,6 @@ import { Integration } from '@prisma/client';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { google } from 'googleapis';
import { OAuth2Client } from 'google-auth-library/build/src/auth/oauth2client';
-import axios from 'axios';
import { YoutubeSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/youtube.settings.dto';
import {
BadBody,
@@ -97,8 +96,7 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {
if (body.includes('invalidTags')) {
return {
type: 'bad-body',
- value:
- 'The maximum allowed is 500 characters in total.',
+ value: 'The maximum allowed is 500 characters in total.',
};
}
@@ -785,7 +783,7 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {
videoId,
media: {
body: (
- await axios({
+ await this.getSsrfSafeAxios()({
url: pendingData.thumbnail,
method: 'GET',
responseType: 'stream',