race condition security patch

This commit is contained in:
Christian Beutel
2025-04-18 12:59:17 +02:00
parent 29b8a0352e
commit d8f7a862f6
53 changed files with 240 additions and 222 deletions

View File

@@ -5,11 +5,9 @@
import StravaSettingsModal from "$lib/components/settings/integrations/strava_settings_modal.svelte";
import {
Integration,
type BaseIntegration,
type KomootIntegration,
type StravaIntegration,
type StravaIntegration
} from "$lib/models/integration.js";
import { pb } from "$lib/pocketbase.js";
import {
integrations_create,
integrations_update,

View File

@@ -1,9 +1,7 @@
import { pb } from "$lib/pocketbase";
import { integrations_index, integrations_update } from "$lib/stores/integration_store";
import { error, redirect, type RequestEvent, type ServerLoad } from "@sveltejs/kit";
import { error, redirect, type ServerLoad } from "@sveltejs/kit";
import { ClientResponseError } from "pocketbase";
export const load: ServerLoad = async ({ url, fetch }) => {
export const load: ServerLoad = async ({ url, fetch, locals }) => {
const oauthError = url.searchParams.get('error');
if (oauthError) {
// user cancelled
@@ -22,7 +20,7 @@ export const load: ServerLoad = async ({ url, fetch }) => {
}
try {
await pb.send("/integration/strava/token", {
await locals.pb.send("/integration/strava/token", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({