Skip to content

Commit 44c5a78

Browse files
authored
Merge pull request #2566 from trycompai/fix/single-fix-security-hardening
fix(cloud-tests): derive organizationId from session, remove acknowledgment default
2 parents 348f5da + 69a170d commit 44c5a78

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

apps/app/src/app/(app)/[orgId]/cloud-tests/actions/single-fix.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { headers } from 'next/headers';
66

77
interface SingleFixInput {
88
connectionId: string;
9-
organizationId: string;
109
checkResultId: string;
1110
remediationKey: string;
1211
acknowledgment?: string;
@@ -24,9 +23,14 @@ export async function startSingleFix(
2423
return { error: 'Unauthorized' };
2524
}
2625

26+
const organizationId = session.session?.activeOrganizationId;
27+
if (!organizationId) {
28+
return { error: 'No active organization' };
29+
}
30+
2731
const handle = await tasks.trigger('remediate-single', {
2832
connectionId: input.connectionId,
29-
organizationId: input.organizationId,
33+
organizationId,
3034
checkResultId: input.checkResultId,
3135
remediationKey: input.remediationKey,
3236
userId: session.user.id,

apps/app/src/app/(app)/[orgId]/cloud-tests/components/RemediationDialog.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from '@trycompai/ui/dialog';
1313
import { useRealtimeRun } from '@trigger.dev/react-hooks';
1414
import { AlertTriangle, ListOrdered, Loader2, RotateCcw } from 'lucide-react';
15-
import { useParams } from 'next/navigation';
1615
import { useCallback, useEffect, useRef, useState } from 'react';
1716
import { toast } from 'sonner';
1817
import { startSingleFix } from '../actions/single-fix';
@@ -269,7 +268,6 @@ export function RemediationDialog({
269268
onComplete,
270269
}: RemediationDialogProps) {
271270
const api = useApi();
272-
const { orgId } = useParams<{ orgId: string }>();
273271
const [preview, setPreview] = useState<PreviewData | null>(null);
274272
const [isLoadingPreview, setIsLoadingPreview] = useState(false);
275273
const [isExecuting, setIsExecuting] = useState(false);
@@ -399,7 +397,6 @@ export function RemediationDialog({
399397
try {
400398
const result = await startSingleFix({
401399
connectionId,
402-
organizationId: orgId,
403400
checkResultId,
404401
remediationKey,
405402
acknowledgment: acknowledgment ?? undefined,

apps/app/src/trigger/tasks/cloud-security/remediate-single.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const remediateSingle = task({
5858
connectionId,
5959
checkResultId,
6060
remediationKey,
61-
acknowledgment: acknowledgment ?? 'acknowledged',
61+
acknowledgment,
6262
}),
6363
});
6464

0 commit comments

Comments
 (0)