From d591bdd494cf28a399ea7d7ae7ccbae3a5cab020 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Wed, 30 Oct 2024 09:58:01 +0100 Subject: Widget: Don't let widget name affect `$.ui` prototype & constructor This is an edge case and it only affects code accepting untrusted input as a widget name, but it's still technically correct to filter these out. Closes gh-2310 --- ui/widget.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ui') diff --git a/ui/widget.js b/ui/widget.js index 7201b4fbf..d5fbd885c 100644 --- a/ui/widget.js +++ b/ui/widget.js @@ -56,6 +56,9 @@ $.widget = function( name, base, prototype ) { var namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; + if ( name === "__proto__" || name === "constructor" ) { + return $.error( "Invalid widget name: " + name ); + } var fullName = namespace + "-" + name; if ( !prototype ) { -- cgit v1.2.3