[MM-68968] Guard redirects and subframe navigations alongside will-navigate - #3927
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe change adds shared subframe navigation validation and applies it to redirect and frame-navigation events in calls widgets, plugin popups, and web contents. Tests cover allowed web URLs and blocked custom protocols. ChangesNavigation handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant WebContents
participant NavigationHandlers
participant MainFramePolicy
participant SubframePolicy
WebContents->>NavigationHandlers: will-redirect or will-frame-navigate
NavigationHandlers->>MainFramePolicy: validate main-frame navigation
NavigationHandlers->>SubframePolicy: validate subframe navigation
SubframePolicy-->>WebContents: allow web URL or prevent custom protocol
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
edgarbellot
left a comment
There was a problem hiding this comment.
LGTM 👍 main path + edge cases covered, thank you!
|
Cherry pick is scheduled. |
|
Error trying doing the automated Cherry picking. Please do this manually |
|
/cherry-pick release-6.2 |
|
Cherry pick is scheduled. |
|
Error trying doing the automated Cherry picking. Please do this manually |
Summary
Our navigation checks were only registered on
will-navigate, which Electron emits for top-level, renderer-initiated navigations. The other navigation events it exposes —will-redirectandwill-frame-navigate— were never wired up, so navigations arriving through those paths were never evaluated against the same rules.This PR registers the existing checks on those events too, covering server views, the Calls widget window, and plugin popups. Redirects are dispatched by frame type so that subframes continue to use the subframe check rather than the main-frame one, since ordinary embeds redirect as a matter of course.
The subframe guard moved into
webContentEventsCommonso all three call sites can share a single implementation.Ticket Link
https://mattermost.atlassian.net/browse/MM-68968
Release Note
Change Impact: 🟡 Medium
Regression Risk: Changes affect shared navigation handling across multiple Electron windows. Automated tests cover the updated main-frame and subframe paths.
QA Recommendation: Manual QA can be skipped because automated coverage is complete and rollback is straightforward.
Generated by CodeRabbitAI