Skip to content

App group rebind bug#427

Merged
eguerrant merged 1 commit into
mainfrom
rebind_bug
Apr 28, 2026
Merged

App group rebind bug#427
eguerrant merged 1 commit into
mainfrom
rebind_bug

Conversation

@eguerrant
Copy link
Copy Markdown
Contributor

@eguerrant eguerrant commented Apr 28, 2026

A group owner could rebind an existing app group to a different app they don't own by changing the app_id in a PUT request, bypassing app-level authorization boundaries and retaining ownership of the moved group.

Fixed it and added a new test

@eguerrant eguerrant marked this pull request as ready for review April 28, 2026 00:14
@eguerrant eguerrant merged commit ac2cad5 into main Apr 28, 2026
6 checks passed
@eguerrant eguerrant deleted the rebind_bug branch April 28, 2026 16:56
somethingnew2-0 added a commit that referenced this pull request Apr 29, 2026
Two PRs merged to main against the (now-replaced) Flask backend; the
operation-layer changes auto-merged during the rebase, this commit
ports the matching view-layer changes to the FastAPI routers and
fixes the upstream-added tests for the new harness.

PR #427 (App group rebind bug)
- api/routers/groups.py PUT /api/groups/{id}: refuse to rebind an
  AppGroup to a different `app_id` unless the caller is an Access
  admin or owns the target app. Apply the rebind when the type isn't
  also changing — type-change rebinds keep going through
  ModifyGroupType. The Flask version relied on
  `schema.load(request.json, instance=group, partial=True)` to apply
  app_id; the FastAPI router updates it explicitly.

PR #426 (Create app + reserved-prefix group bug fixes)
- api/routers/apps.py POST /api/apps: 409 if an owner group with the
  target name already exists *with owners* — otherwise CreateApp would
  silently absorb a squatted owner group.
- api/routers/groups.py POST /api/groups: 400 on reserved prefixes
  that don't match the group type (`App-` for non-AppGroup, `Role-`
  for non-RoleGroup, the `-Owners` suffix on a directly-created
  AppGroup).
- api/routers/groups.py PUT /api/groups/{id}: same prefix check, but
  resolved against the *final* group type so a legitimate
  OktaGroup→AppGroup/RoleGroup conversion still works. Wrap
  ModifyGroupType in try/except for ValueError → 400.

Test ports
- Rewrote Flask-era signatures (`app: Flask`, `client: FlaskClient`,
  `db: SQLAlchemy`) to the FastAPI harness (`FastAPI`, `TestClient`,
  `Any`). Added the missing `url_for` fixture to the upstream-added
  tests, swapped `rep.get_json()` → `rep.json()`, and replaced one
  `app.config["CURRENT_OKTA_USER_EMAIL"]` access with `settings.…`.

Verified: `pytest tests/` 283/283, `ruff check`/`format`, `mypy .`
all green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants