Skip to content

Commit 035b791

Browse files
committed
Fix credential impersonation and serializer/auth regressions
1 parent 7ec0259 commit 035b791

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { getPollingProviderFromOAuth } from '@/lib/credential-sets/providers'
1010
import {
1111
getCanonicalScopesForProvider,
1212
getProviderIdFromServiceId,
13-
getServiceAccountProviderForProviderId,
1413
OAUTH_PROVIDERS,
1514
type OAuthProvider,
1615
parseProvider,
@@ -122,11 +121,6 @@ export function CredentialSelector({
122121
[selectedCredential]
123122
)
124123

125-
const supportsServiceAccount = useMemo(
126-
() => !!getServiceAccountProviderForProviderId(effectiveProviderId),
127-
[effectiveProviderId]
128-
)
129-
130124
const selectedCredentialSet = useMemo(
131125
() => credentialSets.find((cs) => cs.id === selectedCredentialSetId),
132126
[credentialSets, selectedCredentialSetId]
@@ -377,7 +371,7 @@ export function CredentialSelector({
377371
className={overlayContent ? 'pl-7' : ''}
378372
/>
379373

380-
{supportsServiceAccount && !isPreview && (
374+
{isServiceAccount && !isPreview && (
381375
<div className='mt-2.5 flex flex-col gap-2.5'>
382376
<div className='flex items-center gap-1.5 pl-0.5'>
383377
<Label>

apps/sim/lib/auth/hybrid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const BEARER_PREFIX = 'Bearer '
2525
export function hasExternalApiCredentials(headers: Headers): boolean {
2626
if (headers.has(API_KEY_HEADER)) return true
2727
const auth = headers.get('authorization')
28-
return auth?.startsWith(BEARER_PREFIX)
28+
return auth?.startsWith(BEARER_PREFIX) ?? false
2929
}
3030

3131
export interface AuthResult {

apps/sim/serializer/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,17 @@ export class Serializer {
347347
)
348348
)
349349

350-
const isOrphanWithValue =
351-
matchingConfigs.length === 0 && subBlock.value != null && subBlock.value !== ''
350+
const isImpersonateUserEmailOrphanWithValue =
351+
id === 'impersonateUserEmail' &&
352+
matchingConfigs.length === 0 &&
353+
subBlock.value != null &&
354+
subBlock.value !== ''
352355

353356
if (
354357
(matchingConfigs.length > 0 && shouldInclude) ||
355358
hasStarterInputFormatValues ||
356359
isLegacyAgentField ||
357-
isOrphanWithValue
360+
isImpersonateUserEmailOrphanWithValue
358361
) {
359362
params[id] = subBlock.value
360363
}

0 commit comments

Comments
 (0)