diff --git a/scripts/local-test-plan.py b/scripts/local-test-plan.py index ea6cd36..ef0d456 100644 --- a/scripts/local-test-plan.py +++ b/scripts/local-test-plan.py @@ -22,9 +22,13 @@ with socket.socket() as s: # a free port on this machine s.bind(("127.0.0.1", 0)) port = s.getsockname()[1] +# Same as Cottage's servers: random32 and random16 are 24 and 12 characters from this +# alphabet (no look-alike characters), hex32 is 32 hex digits. Match them exactly, so a recipe +# that depends on a secret's length or characters fails here rather than in production. +ALPHA = "abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789" GEN = { - "random32": lambda: secrets.token_urlsafe(24)[:32], - "random16": lambda: secrets.token_urlsafe(12)[:16], + "random32": lambda: "".join(secrets.choice(ALPHA) for _ in range(24)), + "random16": lambda: "".join(secrets.choice(ALPHA) for _ in range(12)), "hex32": lambda: secrets.token_hex(16), } env = {