()
const key = (workspace: string, permissionedAs: string) => `${workspace}:${permissionedAs}`
diff --git a/frontend/src/lib/components/apps/editor/AppPreview.svelte b/frontend/src/lib/components/apps/editor/AppPreview.svelte
index a33e26504d..ff620dc868 100644
--- a/frontend/src/lib/components/apps/editor/AppPreview.svelte
+++ b/frontend/src/lib/components/apps/editor/AppPreview.svelte
@@ -24,6 +24,7 @@
import HiddenComponent from '../components/helpers/HiddenComponent.svelte'
import RecomputeAllComponents from './RecomputeAllComponents.svelte'
import { BG_PREFIX } from './appUtilsCore'
+ import { runAsEmailLabel } from '$lib/components/access/serviceAccounts.svelte'
interface Props {
app: App
@@ -301,7 +302,9 @@
{summary}
- {policy.on_behalf_of ? `on behalf of ${policy.on_behalf_of_email}` : ''}
+ {policy.on_behalf_of
+ ? `on behalf of ${runAsEmailLabel(policy.on_behalf_of_email)}`
+ : ''}
diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte
index d787564c0c..33ae04df98 100644
--- a/frontend/src/lib/components/apps/editor/GridEditor.svelte
+++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte
@@ -27,6 +27,7 @@
import Popover from '$lib/components/Popover.svelte'
import type { Policy } from '$lib/gen'
import { BG_PREFIX, findGridItem } from './appUtilsCore'
+ import { runAsEmailLabel } from '$lib/components/access/serviceAccounts.svelte'
interface Props {
policy: Policy
@@ -174,7 +175,7 @@
/>
- {policy.on_behalf_of ? `Author ${policy.on_behalf_of_email}` : ''}
+ {policy.on_behalf_of ? `Author ${runAsEmailLabel(policy.on_behalf_of_email)}` : ''}
The scripts will be run on behalf of the author and a tight policy ensure security about
the possible inputs of the runnables.
diff --git a/frontend/src/lib/utils/previewOnBehalfOf.ts b/frontend/src/lib/utils/previewOnBehalfOf.ts
index 3b28223b88..0b0fe8f9a6 100644
--- a/frontend/src/lib/utils/previewOnBehalfOf.ts
+++ b/frontend/src/lib/utils/previewOnBehalfOf.ts
@@ -1,3 +1,5 @@
+import { PENDING_EMAIL_DOMAIN } from '$lib/components/access/serviceAccounts.svelte'
+
type ActingUser =
| { is_admin?: boolean; is_super_admin?: boolean; operator?: boolean; groups?: string[] }
| undefined
@@ -18,6 +20,8 @@ export function previewOnBehalfOf(
!user?.operator &&
(!!user?.is_admin || !!user?.is_super_admin || !!user?.groups?.includes('wm_deployers'))
if (!canPreserve) return undefined
+ // A service account created at deploy does not exist yet, so the server refuses to run as it.
+ if (onBehalfOfEmail?.endsWith(`@${PENDING_EMAIL_DOMAIN}`)) return undefined
return onBehalfOf || onBehalfOfEmail || undefined
}