Skip to content

Remove API key scope enforcement and strict mode toggles#334

Merged
MaxEriksson2000 merged 6 commits intodevelopfrom
remove/scope-enforcement-toggle
Apr 10, 2026
Merged

Remove API key scope enforcement and strict mode toggles#334
MaxEriksson2000 merged 6 commits intodevelopfrom
remove/scope-enforcement-toggle

Conversation

@MaxEriksson2000
Copy link
Copy Markdown
Collaborator

Summary

  • Scope enforcement and strict mode are now always active — the two tenant-level feature flag toggles, env kill-switch, and admin UI switches have been removed
  • API keys are always restricted to resources within their configured scope, with strict list-endpoint validation
  • Removes PATCH /settings/scope-enforcement and /settings/strict-mode endpoints (breaking API change)
  • Migration 202604091000 cleans up the feature flag rows from the database
  • Adds remove/ as allowed branch name prefix in CI

Test plan

  • Verify API keys respect scope boundaries (space/assistant/app-scoped keys can only access their scope)
  • Verify admin settings page renders without scope enforcement toggles
  • Verify removed endpoints return 404
  • Run pytest tests/unit/test_api_key_scope_enforcement.py — all pass
  • Run pytest tests/unit/test_setting_service_audit.py — all pass

Scope enforcement and strict mode are now always active — API keys are
always restricted to resources within their configured scope. This removes
the tenant-level feature flags, env kill-switch, admin UI toggles, and
the two PATCH settings endpoints that previously allowed disabling scope
boundaries.

Migration 202604091000 deletes the feature flag rows from the database.
Strict mode blocks list endpoints entirely when scope can't be
deterministically proven via path parameter. Scope enforcement
without strict mode already filters list results correctly.
The strict_mode parameter in _enforce_api_key_scope() was always False
and the conditional block was never reached. Remove the parameter,
the strict mode block, the _strict_scope_hint helper, and all related
tests (strict mode matrix, strict mode wiring, strict mode deny tests).

Tenant credential strict_mode (separate feature) is untouched.
@MaxEriksson2000 MaxEriksson2000 merged commit b3edd6c into develop Apr 10, 2026
9 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