Accept current Cloudflare token lengths with safe characters

This commit is contained in:
hellcat 2026-10-13 20:47:45 +08:00
parent f6603a57ef
commit 7db335dbc0

View File

@ -32,7 +32,7 @@ def api(method, suffix, payload=None):
if not re.fullmatch(r'[a-f0-9]{32}', zone) or cfg['target'] != TARGET:
raise RuntimeError('Unapproved DNS configuration')
token = TOKEN.read_text().strip()
if not re.fullmatch(r'[A-Za-z0-9_-]{40}', token):
if not re.fullmatch(r'[A-Za-z0-9_-]{20,128}', token):
raise RuntimeError('Invalid token format')
with tempfile.TemporaryDirectory(prefix='acme-api-', dir=STATE) as folder:
body = pathlib.Path(folder) / 'request.json'