mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 16:02:11 +00:00
disallow loading public app if not visible anymore
This commit is contained in:
@@ -258,6 +258,15 @@ async fn get_public_app_by_secret(
|
||||
tx.commit().await?;
|
||||
|
||||
let app = not_found_if_none(app_o, "App", id.to_string())?;
|
||||
|
||||
let policy = serde_json::from_value::<Policy>(app.policy.clone()).map_err(to_anyhow)?;
|
||||
|
||||
if !matches!(policy.execution_mode, ExecutionMode::Anonymous) {
|
||||
return Err(Error::NotAuthorized(
|
||||
"App visibility does not allow public access".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
Ok(Json(app))
|
||||
}
|
||||
|
||||
|
||||
@@ -162,10 +162,13 @@
|
||||
<Alert title="Require saving" type="error">Save this app once before you can publish it</Alert
|
||||
>
|
||||
{:else}
|
||||
<Alert title="App executed on behalf of publisher"
|
||||
>Every runnable will run with the permissions of the publisher of the app. This ensures that
|
||||
every users gets the same experience. Make sure that the app does not expose actions that
|
||||
are too sensitive to be exposed publicly.</Alert
|
||||
<Alert title="App executed on behalf of publisher">
|
||||
A viewer of the app will execute the runnables of the app on behalf of the publisher
|
||||
avoiding the risk that a resource or script would not be available to the viewer. To
|
||||
guarantee tight security, a policy is computed at time of saving of the app which only allow
|
||||
the scripts/flows referred to in the app to be called on behalf of. Furthermore, static
|
||||
parameters are not overridable. Hence, users will only be able to use the app as intended by
|
||||
the publisher without risk for leaking resources not used in the app.</Alert
|
||||
>
|
||||
<div class="mt-4" />
|
||||
<Toggle
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { workspaceStore, userWorkspaces, switchWorkspace } from '$lib/stores'
|
||||
import { workspaceStore, userWorkspaces, switchWorkspace, usersWorkspaceStore } from '$lib/stores'
|
||||
import { classNames } from '$lib/utils'
|
||||
import Icon from 'svelte-awesome'
|
||||
import { Building } from 'lucide-svelte'
|
||||
|
||||
import Menu from '../common/menu/Menu.svelte'
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if workspaces}
|
||||
{#if workspaces && $usersWorkspaceStore}
|
||||
{#if workspaces.length == 0}
|
||||
<p class="text-sm text-gray-600 mt-2">
|
||||
You are not a member of any workspace yet. Accept an invitation or create your own
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import AppPreview from '$lib/components/apps/editor/AppPreview.svelte'
|
||||
import type { EditorBreakpoint } from '$lib/components/apps/types'
|
||||
|
||||
import { Skeleton } from '$lib/components/common'
|
||||
import { Alert, Skeleton } from '$lib/components/common'
|
||||
import { WindmillIcon } from '$lib/components/icons'
|
||||
import { AppService, AppWithLastVersion, GlobalUserInfo, UserService } from '$lib/gen'
|
||||
import github from 'svelte-highlight/styles/github'
|
||||
@@ -12,12 +12,17 @@
|
||||
|
||||
let app: AppWithLastVersion | undefined = undefined
|
||||
let user: GlobalUserInfo | undefined = undefined
|
||||
let notExists = false
|
||||
|
||||
async function loadApp() {
|
||||
app = await AppService.getPublicAppBySecret({
|
||||
workspace: $page.params.workspace,
|
||||
path: $page.params.secret
|
||||
})
|
||||
try {
|
||||
app = await AppService.getPublicAppBySecret({
|
||||
workspace: $page.params.workspace,
|
||||
path: $page.params.secret
|
||||
})
|
||||
} catch (e) {
|
||||
notExists = true
|
||||
}
|
||||
}
|
||||
|
||||
async function loadUser() {
|
||||
@@ -42,17 +47,24 @@
|
||||
>Powered by <WindmillIcon /> Windmill</a
|
||||
>
|
||||
</div>
|
||||
{#if app}
|
||||
<div class="z-50 text-xs text-gray-500 fixed top-1 left-2">
|
||||
<div>
|
||||
{#if user}
|
||||
Logged in as {user.email}
|
||||
{:else}
|
||||
Not logged in
|
||||
{/if}
|
||||
</div>
|
||||
<a class="text-blue-400" href="/">Go to app</a>
|
||||
<div class="z-50 text-xs text-gray-500 fixed top-1 left-2">
|
||||
<div>
|
||||
{#if user}
|
||||
Logged in as {user.email}
|
||||
{:else}
|
||||
Not logged in
|
||||
{/if}
|
||||
</div>
|
||||
<a class="text-blue-400" href="/">Go to app</a>
|
||||
</div>
|
||||
{#if notExists}
|
||||
<div class="px-4 mt-20"
|
||||
><Alert type="error" title="Not found"
|
||||
>There was an error loading the app. Either it does not exist at this url or its visibility
|
||||
has changed to not be public anymore. <a href="/">Go to app</a>
|
||||
</Alert></div
|
||||
>
|
||||
{:else if app}
|
||||
<div class="border rounded-md p-2 w-full">
|
||||
<AppPreview
|
||||
workspace={$page.params.workspace}
|
||||
|
||||
Reference in New Issue
Block a user