Files
felhom.eu/documentation/audits/login-gate-2026-09-29/B/b3.py
T
2026-09-29 08:20:42 +02:00

17 lines
1.1 KiB
Python

# Part B3 — the household completes each app's first setup THROUGH the gate (browser session = gate cookie).
import json, secrets, string, sys
sys.path.insert(0, '.')
from browser import Browser, hopstr
D = "enkisfelhom.hu"
hh = Browser("household"); hh.jar = json.load(open('jars.json'))["hh"]
def pw():
return "Hh" + secrets.token_hex(10) + "7"
creds = {"n8n": ("owner@spike.hu", pw()), "immich": ("admin@spike.hu", pw())}
json.dump(creds, open('creds.json', 'w')) # scratch only, 0600, deleted at teardown
st, b, h = hh.req(f"https://g-n8n.{D}/rest/owner/setup", "POST", accept="application/json",
body={"email": creds["n8n"][0], "firstName": "Spike", "lastName": "Owner", "password": creds["n8n"][1]})
print("n8n POST /rest/owner/setup (household, through the gate) ->", st, b[:60].replace(creds['n8n'][1], '<pw>'))
st, b, h = hh.req(f"https://g-immich.{D}/api/auth/admin-sign-up", "POST", accept="application/json",
body={"email": creds["immich"][0], "password": creds["immich"][1], "name": "Spike"})
print("immich POST /api/auth/admin-sign-up (household, through the gate) ->", st, b[:60])