diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 032c31bb65..e14885ef67 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1153,6 +1153,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base32" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "022dfe9eb35f19ebbcb51e0b40a5ab759f46ad60cadf7297e0bd085afb50e076" + [[package]] name = "base64" version = "0.13.1" @@ -10443,6 +10449,7 @@ dependencies = [ "async-stripe", "async_zip", "axum", + "base32", "base64 0.21.7", "bytes", "candle-core", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index baedb4461e..b48a7f7f01 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -180,6 +180,7 @@ swc_ecma_parser = "=0.144.3" swc_ecma_ast = "=0.113.7" swc_ecma_visit = "=0.99.1" base64 = "0.21.0" +base32 = "^0" hmac = "0.12.1" sha2 = "0.10.6" sqlx = { version = "0.8.0", features = [ diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index c9273eec97..5e59225745 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -86cfcdef47f8b740cbbdf568f7a2282984ea7460 \ No newline at end of file +9431876ca4dd2ce51a04b102557daa9f685dc5d5 \ No newline at end of file diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index ce5addbd38..8afb489378 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -51,6 +51,7 @@ chrono.workspace = true chrono-tz.workspace = true hex.workspace = true base64.workspace = true +base32.workspace = true serde_urlencoded.workspace = true cron.workspace = true mime_guess.workspace = true diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0beb7494bd..e0dcc8511d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -42,6 +42,7 @@ "openai": "^4.47.1", "pdfjs-dist": "^3.8.162", "quill": "^1.3.7", + "rfc4648": "^1.5.3", "svelte-carousel": "^1.0.25", "svelte-chartjs": "^3.1.5", "svelte-exmarkdown": "^3.0.5", @@ -8577,6 +8578,11 @@ "node": ">=0.10.0" } }, + "node_modules/rfc4648": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/rfc4648/-/rfc4648-1.5.3.tgz", + "integrity": "sha512-MjOWxM065+WswwnmNONOT+bD1nXzY9Km6u3kzvnx8F8/HXGZdz3T6e6vZJ8Q/RIMUSp/nxqjH3GwvJDy8ijeQQ==" + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index 0e8cf66c6b..84e2a74623 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -122,6 +122,7 @@ "openai": "^4.47.1", "pdfjs-dist": "^3.8.162", "quill": "^1.3.7", + "rfc4648": "^1.5.3", "svelte-carousel": "^1.0.25", "svelte-chartjs": "^3.1.5", "svelte-exmarkdown": "^3.0.5", diff --git a/frontend/src/lib/components/details/WebhooksPanel.svelte b/frontend/src/lib/components/details/WebhooksPanel.svelte index d345fee292..97b40199f0 100644 --- a/frontend/src/lib/components/details/WebhooksPanel.svelte +++ b/frontend/src/lib/components/details/WebhooksPanel.svelte @@ -21,6 +21,7 @@ import Alert from '../common/alert/Alert.svelte' import { SettingService } from '$lib/gen' import { base } from '$lib/base' + import { base32 } from 'rfc4648' let userSettings: UserSettings @@ -127,9 +128,16 @@ } function emailAddress() { - return `${$workspaceStore}+${ - requestType === 'hash' ? 'hash.' + hash : (isFlow ? 'flow.' : '') + path.replaceAll('/', '.') - }+${token}@${emailDomain}` + const pathOrHash = requestType === 'hash' ? hash : path.replaceAll('/', '.') + const plainPrefix = `${$workspaceStore}+${ + (requestType === 'hash' ? 'hash.' : isFlow ? 'flow.' : '') + pathOrHash + }+${token}` + const encodedPrefix = base32 + .stringify(new TextEncoder().encode(plainPrefix), { + pad: false + }) + .toLowerCase() + return `${pathOrHash}+${encodedPrefix}@${emailDomain}` } function fetchCode() {