Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(calendar): recognize Teams /meet/ and Zoom webinar join URLs (#1692)

Henry Su896d4dde26e0
diff --git a/src/helpers/meetingJoinUrl.js b/src/helpers/meetingJoinUrl.js
index 82881536a..e76640bea 100644
--- a/src/helpers/meetingJoinUrl.js
+++ b/src/helpers/meetingJoinUrl.js
@@ -1,5 +1,40 @@
-const MEETING_URL_PATTERN =
- /https?:\/\/[^\s<>"']*(?:zoom\.us\/j\/|meet\.google\.com\/|teams\.microsoft\.com\/l\/meetup-join|teams\.live\.com\/meet\/|\.webex\.com\/|chime\.aws\/)[^\s<>"']*/i;
+const URL_PATTERN = /https?:\/\/[^\s<>"']+/gi;
+const TRAILING_PUNCTUATION_PATTERN = /[),.;:!?]+$/;
+const MEETING_URL_RULES = [
+ {
+ hostname: "zoom.us",
+ allowSubdomains: true,
+ pathnamePattern: /^\/(?:j|w|my)\/[^/]+/i,
+ },
+ { hostname: "meet.google.com", pathnamePattern: /^\/[^/]+/ },
+ {
+ hostname: "teams.microsoft.com",
+ pathnamePattern: /^\/(?:l\/meetup-join|meet)\/[^/]+/i,
+ },
+ { hostname: "teams.live.com", pathnamePattern: /^\/meet\/[^/]+/i },
+ { hostname: "webex.com", allowSubdomains: true, pathnamePattern: /^\/[^/]+/ },
+ { hostname: "chime.aws", pathnamePattern: /^\/[^/]+/ },
+];
+
+function isAllowedHostname(candidateHostname, allowedHostname, allowSubdomains) {
+ return (
+ candidateHostname === allowedHostname ||
+ (allowSubdomains && candidateHostname.endsWith(`.${allowedHostname}`))
+ );
+}
+
+function isMeetingUrl(value) {
+ try {
+ const url = new URL(value);
+ return MEETING_URL_RULES.some(
+ ({ hostname, allowSubdomains, pathnamePattern }) =>
+ isAllowedHostname(url.hostname, hostname, allowSubdomains) &&
+ pathnamePattern.test(url.pathname)
+ );
+ } catch {
+ return false;
+ }
+}
export function getMeetingJoinUrl(event) {
if (!event) return null;
@@ -22,8 +57,11 @@ export function getMeetingJoinUrl(event) {
export function extractMeetingUrl(candidates) {
if (!Array.isArray(candidates)) return null;
for (const candidate of candidates) {
- const match = candidate?.match?.(MEETING_URL_PATTERN);
- if (match) return match[0].replace(/[),.;:!?]+$/, "");
+ if (typeof candidate !== "string") continue;
+ for (const match of candidate.matchAll(URL_PATTERN)) {
+ const value = match[0].replace(TRAILING_PUNCTUATION_PATTERN, "");
+ if (isMeetingUrl(value)) return value;
+ }
}
return null;
}
diff --git a/test/helpers/meetingJoinUrl.test.js b/test/helpers/meetingJoinUrl.test.js
index 13d922114..0f7c99c87 100644
--- a/test/helpers/meetingJoinUrl.test.js
+++ b/test/helpers/meetingJoinUrl.test.js
@@ -53,8 +53,12 @@ test("extractMeetingUrl matches known meeting vendors", async () => {
const urls = [
"https://zoom.us/j/123456789",
"https://us02web.zoom.us/j/123456789?pwd=abc",
+ "https://zoom.us/w/123456789",
+ "https://us02web.zoom.us/w/123456789?pwd=abc",
+ "https://zoom.us/my/alice",
"https://meet.google.com/abc-defg-hij",
"https://teams.microsoft.com/l/meetup-join/19%3ameeting_x/0",
+ "https://teams.microsoft.com/meet/1234567890?p=abc",
"https://teams.live.com/meet/9876543210",
"https://company.webex.com/meet/jdoe",
"https://chime.aws/1234567890",
@@ -76,6 +80,52 @@ test("extractMeetingUrl finds a link inside a location string", async () => {
);
});
+test("extractMeetingUrl rejects meeting paths on untrusted hosts", async () => {
+ const { extractMeetingUrl } = await load();
+ const urls = [
+ "https://attacker.example/teams.microsoft.com/meet/123?p=abc",
+ "https://attacker.example/zoom.us/w/123?tk=secret",
+ "https://attacker.example/meet.google.com/abc-defg-hij",
+ "https://attacker.example/teams.live.com/meet/9876543210",
+ "https://attacker.example/company.webex.com/meet/jdoe",
+ "https://attacker.example/chime.aws/1234567890",
+ "https://attacker.example/?next=https://zoom.us/my/alice",
+ "https://[email protected]/w/123",
+ "https://zoom.us.attacker.example/w/123",
+ ];
+
+ for (const url of urls) {
+ assert.equal(extractMeetingUrl([url]), null);
+ }
+});
+
+test("extractMeetingUrl skips untrusted URLs before a valid meeting URL", async () => {
+ const { extractMeetingUrl } = await load();
+
+ assert.equal(
+ extractMeetingUrl([
+ "Agenda: https://attacker.example/zoom.us/w/123 Join: https://zoom.us/w/456",
+ ]),
+ "https://zoom.us/w/456"
+ );
+});
+
+test("extractMeetingUrl rejects unsupported paths on trusted hosts", async () => {
+ const { extractMeetingUrl } = await load();
+ const urls = [
+ "https://zoom.us/profile/alice",
+ "https://meet.google.com/",
+ "https://teams.microsoft.com/chat/123",
+ "https://teams.live.com/chat/123",
+ "https://company.webex.com/",
+ "https://chime.aws/",
+ ];
+
+ for (const url of urls) {
+ assert.equal(extractMeetingUrl([url]), null);
+ }
+});
+
test("extractMeetingUrl returns the first matching candidate", async () => {
const { extractMeetingUrl } = await load();
assert.equal(