App group rebind bug#427
Merged
Merged
Conversation
somethingnew2-0
approved these changes
Apr 28, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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