Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update electron #994

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/background/window/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ const allowedIPCSenders = [
{ protocol: "file:", host: /^$/ },
];

export function validateIPCSender(frame: WebFrameMain) {
export function validateIPCSender(frame: WebFrameMain | null) {
if (!frame) {
// TODO:
// electron 33.0.2 から 33.2.0 へのアップデートで frame が null になる可能性が生じるようになった。
// ただし、null になるのはナビゲーション中やフレーム破棄後であるとされ、ここに null が渡されるケースは無いと思われる。
// null の場合に例外を投げるようにしても良いが、十分な検証ができるまではエラーログの出力に留める。
getAppLogger().error("validateIPCSender: frame is null");
return;
}
const u = new URL(frame.url);
for (const allowed of allowedIPCSenders) {
if (u.protocol === allowed.protocol && allowed.host.test(u.host)) {
Expand Down
1 change: 1 addition & 0 deletions src/tests/background/window/security.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe("security", () => {
validateIPCSender({
url: "file:///home/shogi/apps/shogihome/assets.asr",
} as any);
validateIPCSender(null);
});

it("validateIPCSender/notAllowed", () => {
Expand Down