Skip to content

Commit 20391a4

Browse files
Potential fix for code scanning alert no. 59: Unsafe jQuery plugin (#1666)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 1bc1bbc commit 20391a4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sourcefiles/modern/plugins/jquery/jquery-ui-1.12.1.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8847,7 +8847,12 @@ $.extend( Datepicker.prototype, {
88478847
var altFormat, date, dateStr,
88488848
altField = this._get( inst, "altField" );
88498849

8850-
if ( altField ) { // update alternate field too
8850+
// Mitigation for potential XSS: only allow altField as a selector, not as HTML
8851+
if (
8852+
typeof altField === "string" &&
8853+
altField.length > 0 &&
8854+
altField.trim().charAt(0) !== "<"
8855+
) { // update alternate field too
88518856
altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
88528857
date = this._getDate( inst );
88538858
dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );

0 commit comments

Comments
 (0)