Skip to content

fix(auth): username fallback never adopts local or LTI-native accounts (0.2.2) - #27

Merged
rrolf merged 1 commit into
mainfrom
fix/auth-username-fallback-scope
Oct 20, 2026
Merged

rrolf merged 1 commit into
mainfrom
fix/auth-username-fallback-scope

Conversation

@rrolf

@rrolf rrolf commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Anlass

Security-Review von Abstimmbar vor 1.0: Mit `OIDC_MATCH_BY_USERNAME_FALLBACK=True` konnte ein IdP-Login ein lokales Konto ohne OIDC-Subject übernehmen – insbesondere den per `createsuperuser` angelegten Break-Glass-Admin. Analog LTI-native Konten (`lti::`).

Änderung

  • `filter_users_by_claims`: Der Username-Fallback matcht nur noch Konten mit vorhandenem OIDC-Subject, das nicht mit `lti:` beginnt. Subject-Drift (altes Subject vorhanden) funktioniert weiter. Eine Übernahme wird als WARNING protokolliert.
  • `create_user`: Existiert bereits ein Konto mit demselben Usernamen (`iexact`), wird mit `PermissionDenied` sauber abgelehnt (Fehler-Redirect wie bei `MAX_USERS`) statt mit IntegrityError/500. Das bestehende Konto bleibt unberührt. Die Prüfung ist bewusst case-insensitiv.
  • README-Satz, CHANGELOG `[Unreleased]` → auth 0.2.2, Version 0.2.2.

Tests

`python runtests.py`: 57 OK (4 neue: leeres/NULL-Subject, Superuser unangetastet, `lti:`-Subject, Log-Assertions).

Nach dem Merge bitte Tag `auth/v0.2.2` setzen (oder ich mache es nach Freigabe); Abstimmbar hebt den Pin in seinem Security-PR.

🤖 Generated with Claude Code

…s (0.2.2)

With OIDC_MATCH_BY_USERNAME_FALLBACK an IdP login could adopt a local
break-glass superuser (no subject) or an LTI-native account (lti:...) that
shared the username. The fallback now only matches accounts with an existing
non-LTI OIDC subject, and logs each adoption at WARNING.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@rrolf
rrolf merged commit d0cfeb4 into main Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant