Files
wekan/server/notifications/storedWebhookHttp.js
T
Lauri Ojansivu 2cc0b59a51 On Sandstorm, send webhooks through the Powerbox, and accept the REST API with a grain API key.
A grain has no network but the bridge proxy, so an outgoing webhook now
leaves only through an API a board admin approved in the Powerbox for that
webhook's address: each saved webhook offers "Allow this grain to reach this
address". The grant belongs to the destination, not to a person, is found
by the URL being sent to, and is approved as the address's parent path so
the bridge delivers to the exact address. Every sender - immediate, grouped
and stored - goes through webhookFetch, which off Sandstorm, or for an
address no grant covers, is exactly the SSRF-guarded fetchSafe.

The REST API called with a Sandstorm API key acts as the key's user: in a
grain the bridge sets X-Sandstorm-User-Id itself. Only in a grain, only
after a WeKan token, only for an existing enabled account, and a key without
participate reads only.

New strings translated in all languages.

Thanks to xet7 !
2026-10-14 09:49:42 +03:00

11 lines
676 B
JavaScript

// Off Sandstorm exactly fetchSafe (server/lib/ssrfGuard.js); in a grain, through
// the Powerbox grant a board admin gave this webhook, when there is one.
import { webhookFetch } from '/server/sandstormEgress';
const { deliverStoredWebhookHttp } = require('/server/lib/syncWebhookHttp');
// Internal adapter. Storage/access/response-effect adapters belong to the
// durable operation; they cannot replace the application's network guard.
export function sendStoredWebhook({ item, responses, assertCurrent, assertTarget, completeResponse }) {
return deliverStoredWebhookHttp({ item, responses, assertCurrent, assertTarget, completeResponse, requestHttp: webhookFetch });
}