Skip to content

Commit 900ac0b

Browse files
fix: reject client_secret without client_id to prevent wrong-tenant data (#135)
* fix: reject client_secret without client_id to prevent wrong-tenant data If client_secret (license key) is set without client_id, the SDK would silently use 'community' as the tenant identity. All data would be stored under the wrong tenant, causing data loss on upgrade when client_id is eventually set correctly. * fix: wrap long line to pass ruff linter (100 char limit) * fix: assign error message to variable per ruff EM101 rule
1 parent 43b4c84 commit 900ac0b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

axonflow/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,14 @@ def __init__(
390390
}
391391
# Always send Basic auth — server derives tenant from clientId.
392392
# Uses effective client_id ("community" default when not configured).
393+
# Reject client_secret without client_id — licensed mode must specify tenant.
394+
if client_secret and not client_id:
395+
msg = (
396+
"client_id is required when client_secret is set. "
397+
"Set client_id to your tenant identity to avoid "
398+
"data being stored under the wrong tenant."
399+
)
400+
raise ValueError(msg)
393401
effective_client_id = client_id or "community"
394402
credentials = f"{effective_client_id}:{client_secret or ''}"
395403
encoded = base64.b64encode(credentials.encode()).decode()

0 commit comments

Comments
 (0)