@@ -67,7 +67,8 @@ class TabPyApp:
67
67
arrow_server = None
68
68
max_request_size = None
69
69
70
- def __init__ (self , config_file ):
70
+ def __init__ (self , config_file , disable_auth_warning = True ):
71
+ self .disable_auth_warning = disable_auth_warning
71
72
if config_file is None :
72
73
config_file = os .path .join (
73
74
os .path .dirname (__file__ ), os .path .pardir , "common" , "default.conf"
@@ -394,9 +395,7 @@ def _parse_config(self, config_file):
394
395
logger .critical (msg )
395
396
raise RuntimeError (msg )
396
397
else :
397
- logger .info (
398
- "Password file is not specified: " "Authentication is not enabled"
399
- )
398
+ self ._handle_configuration_without_authentication ()
400
399
401
400
features = self ._get_features ()
402
401
self .settings [SettingsParameters .ApiVersions ] = {"v1" : {"features" : features }}
@@ -471,6 +470,31 @@ def _parse_pwd_file(self):
471
470
472
471
return succeeded
473
472
473
+ def _handle_configuration_without_authentication (self ):
474
+ std_no_auth_msg = "Password file is not specified: Authentication is not enabled"
475
+
476
+ if self .disable_auth_warning == True :
477
+ logger .info (std_no_auth_msg )
478
+ return
479
+
480
+ confirm_no_auth_msg = "\n WARNING: This TabPy server is not currently configured for username/password authentication. "
481
+
482
+ if self .settings [SettingsParameters .EvaluateEnabled ]:
483
+ confirm_no_auth_msg += ("This means that, because the TABPY_EVALUATE_ENABLE feature is enabled, there is "
484
+ "the potential that unauthenticated individuals may be able to remotely execute code on this machine. " )
485
+
486
+ confirm_no_auth_msg += ("We strongly advise against proceeding without authentication as it poses a significant security risk.\n \n "
487
+ "Do you wish to proceed without authentication? (y/N): " )
488
+
489
+ confirm_no_auth_input = input (confirm_no_auth_msg )
490
+
491
+ if confirm_no_auth_input == 'y' :
492
+ logger .info (std_no_auth_msg )
493
+ else :
494
+ print ("\n Aborting start up. To enable authentication for your TabPy server, see "
495
+ "https://github.com/tableau/TabPy/blob/master/docs/server-config.md#authentication." )
496
+ exit ()
497
+
474
498
def _get_features (self ):
475
499
features = {}
476
500
0 commit comments