summary refs log tree commit diff
path: root/scripts-dev/check_auth.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-10-11 11:24:03 +0100
committerRichard van der Hoff <richard@matrix.org>2019-10-11 11:24:03 +0100
commitcad0132fb590aec10a398a5d961896c6348fae4f (patch)
tree41da980079232bfd3f97fff227131a9d75e2ddaf /scripts-dev/check_auth.py
parentMerge pull request #6127 from matrix-org/erikj/patch_inner (diff)
downloadsynapse-cad0132fb590aec10a398a5d961896c6348fae4f.tar.xz
Remove dead check_auth script
This doesn't work, and afaict hasn't been used since 2015.
Diffstat (limited to '')
-rw-r--r--scripts-dev/check_auth.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/scripts-dev/check_auth.py b/scripts-dev/check_auth.py
deleted file mode 100644
index 2a1c5f39d4..0000000000
--- a/scripts-dev/check_auth.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from __future__ import print_function
-
-import argparse
-import itertools
-import json
-import sys
-
-from mock import Mock
-
-from synapse.api.auth import Auth
-from synapse.events import FrozenEvent
-
-
-def check_auth(auth, auth_chain, events):
-    auth_chain.sort(key=lambda e: e.depth)
-
-    auth_map = {e.event_id: e for e in auth_chain}
-
-    create_events = {}
-    for e in auth_chain:
-        if e.type == "m.room.create":
-            create_events[e.room_id] = e
-
-    for e in itertools.chain(auth_chain, events):
-        auth_events_list = [auth_map[i] for i, _ in e.auth_events]
-
-        auth_events = {(e.type, e.state_key): e for e in auth_events_list}
-
-        auth_events[("m.room.create", "")] = create_events[e.room_id]
-
-        try:
-            auth.check(e, auth_events=auth_events)
-        except Exception as ex:
-            print("Failed:", e.event_id, e.type, e.state_key)
-            print("Auth_events:", auth_events)
-            print(ex)
-            print(json.dumps(e.get_dict(), sort_keys=True, indent=4))
-            # raise
-        print("Success:", e.event_id, e.type, e.state_key)
-
-
-if __name__ == "__main__":
-    parser = argparse.ArgumentParser()
-
-    parser.add_argument(
-        "json", nargs="?", type=argparse.FileType("r"), default=sys.stdin
-    )
-
-    args = parser.parse_args()
-
-    js = json.load(args.json)
-
-    auth = Auth(Mock())
-    check_auth(
-        auth,
-        [FrozenEvent(d) for d in js["auth_chain"]],
-        [FrozenEvent(d) for d in js.get("pdus", [])],
-    )