summary refs log tree commit diff
path: root/synapse/config/key.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-16 07:19:18 +0100
committerGitHub <noreply@github.com>2018-05-16 07:19:18 +0100
commit8030a825c8ea375652a856929d29d7ae28096cc1 (patch)
treefd1a3c6d59b793fb5ceca6d08187e12753bcaac1 /synapse/config/key.py
parentMerge pull request #3201 from matrix-org/dbkr/leave_rooms_on_deactivate (diff)
parentConsentResource to gather policy consent from users (diff)
downloadsynapse-8030a825c8ea375652a856929d29d7ae28096cc1.tar.xz
Merge pull request #3213 from matrix-org/rav/consent_handler
ConsentResource to gather policy consent from users
Diffstat (limited to 'synapse/config/key.py')
-rw-r--r--synapse/config/key.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/config/key.py b/synapse/config/key.py
index 4b8fc063d0..d1382ad9ac 100644
--- a/synapse/config/key.py
+++ b/synapse/config/key.py
@@ -59,14 +59,20 @@ class KeyConfig(Config):
 
         self.expire_access_token = config.get("expire_access_token", False)
 
+        # a secret which is used to calculate HMACs for form values, to stop
+        # falsification of values
+        self.form_secret = config.get("form_secret", None)
+
     def default_config(self, config_dir_path, server_name, is_generating_file=False,
                        **kwargs):
         base_key_name = os.path.join(config_dir_path, server_name)
 
         if is_generating_file:
             macaroon_secret_key = random_string_with_symbols(50)
+            form_secret = '"%s"' % random_string_with_symbols(50)
         else:
             macaroon_secret_key = None
+            form_secret = 'null'
 
         return """\
         macaroon_secret_key: "%(macaroon_secret_key)s"
@@ -74,6 +80,10 @@ class KeyConfig(Config):
         # Used to enable access token expiration.
         expire_access_token: False
 
+        # a secret which is used to calculate HMACs for form values, to stop
+        # falsification of values
+        form_secret: %(form_secret)s
+
         ## Signing Keys ##
 
         # Path to the signing key to sign messages with