File tree Expand file tree Collapse file tree
app/components/Views/AgenticCliDashboardWebview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { SafeAreaView } from 'react-native-safe-area-context';
44import { useNavigation } from '@react-navigation/native' ;
55import { WebView , WebViewMessageEvent } from '@metamask/react-native-webview' ;
66import type {
7+ ShouldStartLoadRequest ,
78 WebViewErrorEvent ,
89 WebViewHttpErrorEvent ,
910} from '@metamask/react-native-webview/lib/WebViewTypes' ;
@@ -145,11 +146,26 @@ const AgenticCliDashboardWebview: React.FC = () => {
145146 ) ;
146147
147148 const handleShouldStartLoadWithRequest = useCallback (
148- ( request : { url : string } ) => {
149+ ( request : ShouldStartLoadRequest ) => {
149150 if ( AgenticCliDashboardWebviewService . shouldLoadInWebView ( request . url ) ) {
150151 return true ;
151152 }
152153
154+ if ( ! request . isTopFrame ) {
155+ return true ;
156+ }
157+
158+ if (
159+ request . navigationType !== 'click' &&
160+ request . navigationType !== 'formsubmit'
161+ ) {
162+ Logger . log ( 'AgenticCliDashboardWebview: blocked external navigation' , {
163+ navigationType : request . navigationType ,
164+ url : redactUrlToken ( request . url ) ,
165+ } ) ;
166+ return false ;
167+ }
168+
153169 Linking . openURL ( request . url ) . catch ( ( err ) =>
154170 Logger . error (
155171 err as Error ,
You can’t perform that action at this time.
0 commit comments