mher / flower

Real-time monitor and web admin for Celery distributed task queue
https://flower.readthedocs.io
Other
6.42k stars 1.08k forks source link

Add a configuration to mask some of the information that is shown in the config tab of the worker view #1347

Open ercpereda opened 9 months ago

ercpereda commented 9 months ago

Is your feature request related to a problem? Please describe. The Config tab of the worker view can show the value of the celery config that contains secrets.

Describe the solution you'd like Add a configuration to Flower to list the variables that should be masked before being shown in the config tab.

Modifying this template a little could be enough. https://github.com/mher/flower/blob/b8b1ab196fc4a8ecefcd0997b42e515692672cb8/flower/templates/worker.html#L330-L348

          <div class="tab-pane fade" id="tab-config" role="tabpanel" aria-labelledby="tab-config">
            <div class="col-lg-8">
              <table class="table table-bordered table-striped caption-top">
                <caption>Configuration options</caption>
                <tbody>
                  {% for name,value in sorted(worker.get('conf', {}).items()) %}
                  {% if value is not None %}
                  <tr>
                    <td><a
                        href="https://docs.celeryq.dev/en/latest/userguide/configuration.html#{{ name.lower().replace('_', '-') }}"
                        target="_blank">{{ name }}</a></td>
                    - <td>{{ value }}</td>
                    + <td>{{ value if name not in LIST_OF_SECRETS_DEFINED_IN_THE_CONFIG  else '********' }}
                  </tr>
                  {% end %}
                  {% end %}
                </tbody>
              </table>
            </div>
          </div> <!-- end config tab -->