File tree Expand file tree Collapse file tree
packages/help-extension/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,17 @@ namespace CommandIDs {
4343 export const about = 'help:about' ;
4444}
4545
46+ // CVE-2026-40171 / GHSA-rch3-82jr-f9w9
47+ function isUrlSafe ( url : string ) : boolean {
48+ try {
49+ const parsed = new URL ( url , window . location . href ) ;
50+ const protocol = parsed . protocol . toLowerCase ( ) ;
51+ return [ 'http:' , 'https:' , 'mailto:' ] . includes ( protocol ) ;
52+ } catch {
53+ return false ;
54+ }
55+ }
56+
4657/**
4758 * A plugin to open the about section with resources.
4859 */
@@ -57,6 +68,10 @@ const open: JupyterFrontEndPlugin<void> = {
5768 label : ( args ) => args [ 'text' ] as string ,
5869 execute : ( args ) => {
5970 const url = args [ 'url' ] as string ;
71+ if ( ! isUrlSafe ( url ) ) {
72+ console . warn ( `Blocked unsafe URL: ${ url } ` ) ;
73+ return ;
74+ }
6075 window . open ( url ) ;
6176 } ,
6277 } ) ;
You can’t perform that action at this time.
0 commit comments