File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1625,6 +1625,13 @@ def update_settings(data_id):
1625
1625
"""
1626
1626
1627
1627
updated_settings = get_json_arg (request , "settings" , {})
1628
+
1629
+ # block users from manually updating 'enable_custom_filters'
1630
+ if "enable_custom_filters" in updated_settings :
1631
+ raise ValueError (
1632
+ "Cannot alter the property 'enable_custom_filters' from this endpoint"
1633
+ )
1634
+
1628
1635
if not global_state .load_flag (data_id , "enable_custom_filters" , False ):
1629
1636
updated_settings .pop ("query" , None )
1630
1637
Original file line number Diff line number Diff line change @@ -585,6 +585,21 @@ def test_update_settings(test_data, unittest):
585
585
response_data = response .get_json ()
586
586
assert "error" in response_data
587
587
588
+ settings = json .dumps (dict (enable_custom_filters = True ))
589
+ with app .test_client () as c :
590
+ with ExitStack () as stack :
591
+ global_state .set_data (c .port , None )
592
+ response = c .get (
593
+ "/dtale/update-settings/{}" .format (c .port ),
594
+ query_string = dict (settings = settings ),
595
+ )
596
+ assert response .status_code == 200 , "should return 200 response"
597
+ response_data = response .get_json ()
598
+ assert (
599
+ response_data ["error" ]
600
+ == "Cannot alter the property 'enable_custom_filters' from this endpoint"
601
+ )
602
+
588
603
589
604
@pytest .mark .unit
590
605
def test_update_formats ():
You can’t perform that action at this time.
0 commit comments