Skip to content

Commit 4b7f69a

Browse files
Add _handle_configuration_without_authentication.
1 parent 5716a67 commit 4b7f69a

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

tabpy/tabpy_server/app/app.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,7 @@ def _parse_config(self, config_file):
394394
logger.critical(msg)
395395
raise RuntimeError(msg)
396396
else:
397-
logger.info(
398-
"Password file is not specified: " "Authentication is not enabled"
399-
)
397+
self._handle_configuration_without_authentication()
400398

401399
features = self._get_features()
402400
self.settings[SettingsParameters.ApiVersions] = {"v1": {"features": features}}
@@ -471,6 +469,31 @@ def _parse_pwd_file(self):
471469

472470
return succeeded
473471

472+
def _handle_configuration_without_authentication(self):
473+
std_no_auth_msg = "Password file is not specified: Authentication is not enabled"
474+
475+
if self.disable_auth_warning == True:
476+
logger.info(std_no_auth_msg)
477+
return
478+
479+
confirm_no_auth_msg = "\nWARNING: This TabPy server is not currently configured for username/password authentication. "
480+
481+
if self.settings[SettingsParameters.EvaluateEnabled]:
482+
confirm_no_auth_msg += ("This means that, because the TABPY_EVALUATE_ENABLE feature is enabled, there is "
483+
"the potential that unauthenticated individuals may be able to remotely execute code on this machine. ")
484+
485+
confirm_no_auth_msg += ("We strongly advise against proceeding without authentication as it poses a significant security risk.\n\n"
486+
"Do you wish to proceed without authentication? (y/N): ")
487+
488+
confirm_no_auth_input = input(confirm_no_auth_msg)
489+
490+
if confirm_no_auth_input == 'y':
491+
logger.info(std_no_auth_msg)
492+
else:
493+
print("\nAborting start up. To enable authentication for your TabPy server, see "
494+
"https://github.com/tableau/TabPy/blob/master/docs/server-config.md#authentication.")
495+
exit()
496+
474497
def _get_features(self):
475498
features = {}
476499

0 commit comments

Comments
 (0)