Do not allow data that is too large in zookeeper.
authorScott Gasch <[email protected]>
Wed, 17 Aug 2022 19:01:26 +0000 (12:01 -0700)
committerScott Gasch <[email protected]>
Wed, 17 Aug 2022 19:01:26 +0000 (12:01 -0700)
config.py

index b344631003bb29dc186c0d7db8f2631b8c7ac4bc..81bd7d113021b3b66324836804004fdd38beb5aa 100644 (file)
--- a/config.py
+++ b/config.py
@@ -393,6 +393,9 @@ def _augment_sys_argv_from_loadfile():
                 newargs = [
                     arg.strip('\n') for arg in contents.split('\n') if 'config_savefile' not in arg
                 ]
+                size = sys.getsizeof(newargs)
+                if size > 1024 * 1024:
+                    raise Exception(f'Saved args are too large!  ({size} bytes)')
             except Exception as e:
                 raise Exception(f'Error reading {zkpath} from zookeeper.') from e
             SAVED_MESSAGES.append(f'Loaded config from zookeeper from {zkpath}')