@@ -51,7 +51,7 @@ import {
51
51
RippleRef ,
52
52
RippleState ,
53
53
} from '@angular/material/core' ;
54
- import { SpecificEventListener , EventType } from '@material/base' ;
54
+ import { SpecificEventListener , EventType } from '@material/base/types ' ;
55
55
import { MDCSliderAdapter , MDCSliderFoundation , Thumb , TickMark } from '@material/slider' ;
56
56
import { Subscription } from 'rxjs' ;
57
57
import { GlobalChangeAndInputListener } from './global-change-and-input-listener' ;
@@ -977,7 +977,28 @@ class SliderAdapter implements MDCSliderAdapter {
977
977
return this . _delegate . _getInputElement ( thumbPosition ) . getAttribute ( attribute ) ;
978
978
}
979
979
setInputAttribute = ( attribute : string , value : string , thumbPosition : Thumb ) : void => {
980
- this . _delegate . _getInputElement ( thumbPosition ) . setAttribute ( attribute , value ) ;
980
+ const input = this . _delegate . _getInputElement ( thumbPosition ) ;
981
+
982
+ // Explicitly check the attribute we are setting to prevent xss.
983
+ switch ( attribute ) {
984
+ case 'aria-valuetext' :
985
+ input . setAttribute ( 'aria-valuetext' , value ) ;
986
+ break ;
987
+ case 'disabled' :
988
+ input . setAttribute ( 'disabled' , value ) ;
989
+ break ;
990
+ case 'min' :
991
+ input . setAttribute ( 'min' , value ) ;
992
+ break ;
993
+ case 'max' :
994
+ input . setAttribute ( 'max' , value ) ;
995
+ break ;
996
+ case 'value' :
997
+ input . setAttribute ( 'value' , value ) ;
998
+ break ;
999
+ case 'step' :
1000
+ input . setAttribute ( 'step' , value ) ;
1001
+ }
981
1002
}
982
1003
removeInputAttribute = ( attribute : string , thumbPosition : Thumb ) : void => {
983
1004
this . _delegate . _getInputElement ( thumbPosition ) . removeAttribute ( attribute ) ;
0 commit comments