Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop): authenticate telemetry by origin instead of embedded secret
Richie McIlroyc266f4e3d5f3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ba50b5875..c42007a69 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -152,7 +152,6 @@ jobs:echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .envecho 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .envecho 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}' >> .env- echo 'VITE_OPENPANEL_CLIENT_SECRET=${{ secrets.VITE_OPENPANEL_CLIENT_SECRET }}' >> .envecho 'VITE_OPENPANEL_API_URL=${{ secrets.VITE_OPENPANEL_API_URL }}' >> .envecho 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env@@ -222,7 +221,6 @@ jobs:echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .envecho 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .envecho 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}' >> .env- echo 'VITE_OPENPANEL_CLIENT_SECRET=${{ secrets.VITE_OPENPANEL_CLIENT_SECRET }}' >> .envecho 'VITE_OPENPANEL_API_URL=${{ secrets.VITE_OPENPANEL_API_URL }}' >> .envecho 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .envdiff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 62e9c004b..e22099e88 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -286,7 +286,6 @@ jobs:echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}"echo 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}'echo 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}'- echo 'VITE_OPENPANEL_CLIENT_SECRET=${{ secrets.VITE_OPENPANEL_CLIENT_SECRET }}'echo 'VITE_OPENPANEL_API_URL=${{ secrets.VITE_OPENPANEL_API_URL }}'echo 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}'echo 'RUST_TARGET_TRIPLE=${{ matrix.settings.target }}'diff --git a/apps/desktop/src-tauri/src/telemetry.rs b/apps/desktop/src-tauri/src/telemetry.rsindex 26d838ba5..7d1139361 100644--- a/apps/desktop/src-tauri/src/telemetry.rs+++ b/apps/desktop/src-tauri/src/telemetry.rs@@ -14,9 +14,11 @@ use crate::auth::AuthStore;/// Baked in at compile time so self-built binaries send nothing.const CLIENT_ID: Option<&str> = option_env!("VITE_OPENPANEL_CLIENT_ID");-/// The OpenPanel REST `/track` endpoint requires a `write` or `root` client, so-/// unlike the browser SDK the secret is part of the contract here.-const CLIENT_SECRET: Option<&str> = option_env!("VITE_OPENPANEL_CLIENT_SECRET");+/// `/track` accepts origin-allowlisted requests without a client secret — the+/// same auth path the webview SDK uses — so no credential ships in the binary.+/// Must stay on the OpenPanel client's CORS allowlist alongside the webview+/// origins.+const ORIGIN: &str = "tauri://localhost";const API_URL: Option<&str> = option_env!("VITE_OPENPANEL_API_URL");const DEFAULT_API_URL: &str = "https://api.openpanel.dev";@@ -442,12 +444,10 @@ pub fn async_capture_event(app: &AppHandle, event: AnalyticsEvent) {},};- let mut req = http_client()+ let req = http_client().post(track_url())- .header("openpanel-client-id", client_id);- if let Some(secret) = CLIENT_SECRET {- req = req.header("openpanel-client-secret", secret);- }+ .header("openpanel-client-id", client_id)+ .header("origin", ORIGIN);// Events are best-effort: log and drop, never retry.match req.json(&body).send().await {