diff --git a/docs/config.rst b/docs/config.rst index 39558a7d..167ee5c1 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -540,3 +540,10 @@ Default: None Sets the URI to which an OAuth 2.0 server redirects the user after successful authentication and authorization. `oauth2_redirect_uri` option should be used with :ref:`auth`, :ref:`auth_provider`, :ref:`oauth2_key` and :ref:`oauth2_secret` options. + +censor_config +~~~~~~~~~~~~~ + +Default: False + +Censors all fields in all worker's config tabs diff --git a/flower/__init__.py b/flower/__init__.py index 24c8e6f7..e8b1e333 100644 --- a/flower/__init__.py +++ b/flower/__init__.py @@ -1,2 +1,2 @@ -VERSION = (2, 0, 0) +VERSION = (2, 0, 1) __version__ = '.'.join(map(str, VERSION)) + '-dev' diff --git a/flower/app.py b/flower/app.py index 3427e098..a8789a73 100644 --- a/flower/app.py +++ b/flower/app.py @@ -30,6 +30,12 @@ def rewrite_handler(handler, url_prefix): handler.handler_class, handler.kwargs, handler.name) return ("/{}{}".format(url_prefix.strip("/"), handler[0]), handler[1]) +def rewrite_handler_censor_config(handler): + if type(handler) is url: + if handler.name == "config": + return url(handler.regex.pattern, handler.handler_class, {"censor_config": True}, handler.name) + return handler + class Flower(tornado.web.Application): pool_executor_cls = ThreadPoolExecutor @@ -41,6 +47,12 @@ def __init__(self, options=None, capp=None, events=None, if options is not None and options.url_prefix: handlers = [rewrite_handler(h, options.url_prefix) for h in handlers] kwargs.update(handlers=handlers) + + if options.censor_config: + logging.debug("Censoring config from web interface") + handlers = [rewrite_handler_censor_config(h) for h in handlers] + kwargs.update(handlers=handlers) + super().__init__(**kwargs) self.options = options or default_options self.io_loop = io_loop or ioloop.IOLoop.instance() diff --git a/flower/options.py b/flower/options.py index 083d4b5b..a16ed13d 100644 --- a/flower/options.py +++ b/flower/options.py @@ -68,6 +68,8 @@ define("url_prefix", type=str, help="base url prefix") define("task_runtime_metric_buckets", type=float, default=Histogram.DEFAULT_BUCKETS, multiple=True, help="histogram latency bucket value") +define("censor_config", type=bool, default=False, + help="censor config from web interface") default_options = options diff --git a/flower/templates/worker.html b/flower/templates/worker.html index 9dd64daf..f9566b3e 100644 --- a/flower/templates/worker.html +++ b/flower/templates/worker.html @@ -333,14 +333,22 @@