Skip to content

Cap Google Chrome extension#1921

Merged
richiemcilroy merged 77 commits into
mainfrom
chrome-extension
Jun 17, 2026
Merged

Cap Google Chrome extension#1921
richiemcilroy merged 77 commits into
mainfrom
chrome-extension

Conversation

@richiemcilroy

Copy link
Copy Markdown
Member

The official Cap Google Chrome extension.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review. (162 files found, 100 file limit)

@polarityinc

polarityinc Bot commented Jun 17, 2026

Copy link
Copy Markdown

Paragon Review Skipped

Hi @richiemcilroy! Your Polarity credit balance is insufficient to complete this review.

Please visit https://app.paragon.run to finish your review.

Comment thread apps/chrome-extension/src/content/overlay.tsx Fixed
Comment thread apps/chrome-extension/src/content/overlay.tsx Fixed
Comment thread apps/chrome-extension/e2e/recording-upload.spec.ts Fixed
Comment thread apps/chrome-extension/public/manifest.json Outdated
Comment thread apps/chrome-extension/public/manifest.json
Comment thread apps/chrome-extension/src/content/overlay.tsx
Comment thread apps/chrome-extension/e2e/recording-upload.spec.ts Outdated
@richiemcilroy richiemcilroy merged commit 9f7ac2e into main Jun 17, 2026
20 checks passed
Comment on lines +53 to +73
const PANEL_TOKEN = decodeURIComponent(window.location.hash.slice(1));
const IS_EMBEDDED = PANEL_TOKEN.length > 0 && window.parent !== window;
const DEFAULT_MEDIA_ACCESS: MediaAccessState = {
camera: false,
microphone: false,
updatedAt: 0,
};

const postPanelMessage = (
message: { type: "size"; height: number } | { type: "dismiss" },
) => {
if (!IS_EMBEDDED) return;
window.parent.postMessage(
{
source: "cap-extension-panel",
token: PANEL_TOKEN,
...message,
},
"*",
);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decodeURIComponent can throw on malformed %-escapes, and this is a web-accessible page, so it’s easy for a hostile embed to crash the UI via #%.... Also, you can avoid using "*" here by scoping the postMessage target to the embedding page’s origin.

Suggested change
const PANEL_TOKEN = decodeURIComponent(window.location.hash.slice(1));
const IS_EMBEDDED = PANEL_TOKEN.length > 0 && window.parent !== window;
const DEFAULT_MEDIA_ACCESS: MediaAccessState = {
camera: false,
microphone: false,
updatedAt: 0,
};
const postPanelMessage = (
message: { type: "size"; height: number } | { type: "dismiss" },
) => {
if (!IS_EMBEDDED) return;
window.parent.postMessage(
{
source: "cap-extension-panel",
token: PANEL_TOKEN,
...message,
},
"*",
);
};
const PANEL_TOKEN = (() => {
try {
return decodeURIComponent(window.location.hash.slice(1));
} catch {
return "";
}
})();
const IS_EMBEDDED = PANEL_TOKEN.length > 0 && window.parent !== window;
const PANEL_PARENT_ORIGIN = (() => {
try {
return new URL(document.referrer).origin;
} catch {
return "*";
}
})();
const DEFAULT_MEDIA_ACCESS: MediaAccessState = {
camera: false,
microphone: false,
updatedAt: 0,
};
const postPanelMessage = (
message: { type: "size"; height: number } | { type: "dismiss" },
) => {
if (!IS_EMBEDDED) return;
window.parent.postMessage(
{
source: "cap-extension-panel",
token: PANEL_TOKEN,
...message,
},
PANEL_PARENT_ORIGIN,
);
};

type: "stop";
};

const token = decodeURIComponent(window.location.hash.slice(1));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same decodeURIComponent footgun here — a malformed hash can crash the preview iframe before it ever registers.

Suggested change
const token = decodeURIComponent(window.location.hash.slice(1));
const token = (() => {
try {
return decodeURIComponent(window.location.hash.slice(1));
} catch {
return "";
}
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants