Repository: freedomofpress/securedrop

Issue:
Back out CUSTOM_NOTIFICATION for 0.4
While QA'ing the 0.4 release, we realized that the `CUSTOM_NOTIFICATION` configuration option introduced in #1399 does not have a good deployment story for currently deployed instances because we generally do not have a good story for automated migrations of the SecureDrop web application configuration.

Currently, any changes that are made to `config.py.example` cannot be propagated to currently deployed instances because the [Ansible playbooks](https://github.com/freedomofpress/securedrop/blob/892cf52299f17ed9c70df0bb0bec68137101bab2/install_files/ansible-base/roles/app/tasks/initialize_securedrop_app.yml#L29-L41) will avoid touching `config.py` if it has already been generated. Thus, *new* instances of 0.4 would be able to use the new `CUSTOM_NOTIFICATION` feature, but *existing* instances that are upgrading to 0.4 would not be able to take advantage of the feature. If the administrators of existing instances tried to modify the configuration on the Admin Workstation, those changes would simply not be propagated to the production machines.

We discussed this internally and agreed that the best course of action is to back out #1399 and any related changes for the 0.4 release, to avoid confusing and frustrating SecureDrop administrators with a new feature that would work inconsistently across old and new SecureDrop instances. We also agreed that it would be good to target the next release after 0.4, 0.4.1, for re-landing #1399, along with the configuration management changes required to support it consistently across current and new SecureDrop instances. I will file a separate follow-up issue to summarize the automated configuration upgrade issue and track work towards a resolution.


Discussion:
Follow-up issue to discuss automated migration of the web application configuration: #1966.

Resolving patch:
diff --git a/securedrop/source.py b/securedrop/source.py
--- a/securedrop/source.py
+++ b/securedrop/source.py
@@ -124,9 +124,7 @@ def check_tor2web():
 
 @app.route('/')
 def index():
-    return render_template('index.html',
-                           custom_notification=getattr(
-                               config, 'CUSTOM_NOTIFICATION', ''))
+    return render_template('index.html')
 
 
 def generate_unique_codename():


Test patch:
diff --git a/securedrop/tests/test_source.py b/securedrop/tests/test_source.py
--- a/securedrop/tests/test_source.py
+++ b/securedrop/tests/test_source.py
@@ -263,28 +263,6 @@ def test_submit_sanitizes_filename(self, gzipfile):
                                     mode=ANY,
                                     fileobj=ANY)
 
-    def test_custom_notification(self):
-        """Test that `CUSTOM_NOTIFICATION` string in config file
-        is rendered on the Source Interface page. We cannot assume
-        it will be present in production instances, since it is added
-        via the Ansible config, not the Debian package scripts."""
-        custom_msg = config.CUSTOM_NOTIFICATION
-
-        dev_msg = ("This is an insecure SecureDrop Development server "
-                   "for testing ONLY. Do NOT submit documents here.")
-        staging_msg = "This is a SecureDrop Staging VM for testing ONLY"
-
-        self.assertTrue(custom_msg in (dev_msg, staging_msg))
-        resp = self.client.get('/')
-        self.assertEqual(resp.status_code, 200)
-        # The app-tests aren't host-aware, so we can't accurately predict
-        # which custom notification message we want. Let's check for both,
-        # and fail only if both are not found.
-        try:
-            self.assertIn(dev_msg, resp.data)
-        except AssertionError:
-            self.assertIn(staging_msg, resp.data)
-
     def test_tor2web_warning_headers(self):
         resp = self.client.get('/', headers=[('X-tor2web', 'encrypted')])
         self.assertEqual(resp.status_code, 200)