diff --git a/backend/src/controllers/v2/usersController.ts b/backend/src/controllers/v2/usersController.ts index 74c3b5418..9940ddc56 100644 --- a/backend/src/controllers/v2/usersController.ts +++ b/backend/src/controllers/v2/usersController.ts @@ -41,7 +41,7 @@ export const getMe = async (req: Request, res: Response) => { try { user = await User .findById(req.user._id) - .select('+publicKey +encryptedPrivateKey +iv +tag'); + .select('+salt +publicKey +encryptedPrivateKey +iv +tag +encryptionVersion +protectedKey +protectedKeyIV +protectedKeyTag'); } catch (err) { Sentry.setUser({ email: req.user.email }); Sentry.captureException(err); diff --git a/backend/src/integrations/apps.ts b/backend/src/integrations/apps.ts index 39d7cfe65..2bb666119 100644 --- a/backend/src/integrations/apps.ts +++ b/backend/src/integrations/apps.ts @@ -197,21 +197,40 @@ const getAppsVercel = async ({ * @returns {String} apps.name - name of Netlify site */ const getAppsNetlify = async ({ accessToken }: { accessToken: string }) => { - let apps; + const apps: any = []; try { - const res = ( - await request.get(`${INTEGRATION_NETLIFY_API_URL}/api/v1/sites`, { + let page = 1; + const perPage = 10; + let hasMorePages = true; + + // paginate through all sites + while (hasMorePages) { + const params = new URLSearchParams({ + page: String(page), + per_page: String(perPage) + }); + + const { data } = await request.get(`${INTEGRATION_NETLIFY_API_URL}/api/v1/sites`, { + params, headers: { Authorization: `Bearer ${accessToken}`, 'Accept-Encoding': 'application/json' } - }) - ).data; + }); + + data.map((a: any) => { + apps.push({ + name: a.name, + appId: a.site_id + }); + }); + + if (data.length < perPage) { + hasMorePages = false; + } - apps = res.map((a: any) => ({ - name: a.name, - appId: a.site_id, - })); + page++; + } } catch (err) { Sentry.setUser(null); Sentry.captureException(err); diff --git a/frontend/src/helpers/key.ts b/frontend/src/helpers/key.ts index 05562628d..8dd9dc8e3 100644 --- a/frontend/src/helpers/key.ts +++ b/frontend/src/helpers/key.ts @@ -75,7 +75,6 @@ let privateKey; throw new Error('Insufficient details to decrypt private key'); } } catch (err) { - console.error(err); throw new Error('Failed to decrypt private key'); }