mcp-context-forge
mcp-context-forge copied to clipboard
[BUG]: Non-admin import of a file containing roots fails for all entity types
Summary
Exports produced by an admin include a roots list. When an import file contains roots, /v1/import requires unrestricted platform-admin authority (main.py:13320, calling auth_context.py:961). The settings page does not send selected_entities, so a non-admin who imports such a file receives a 403, and none of the other entity types in the file are imported.
Notes:
- Misleading error: The toast says "You don't have permission to import this configuration." The user does hold the named permission (
admin.import); the refusal is caused by the roots list. - Both buttons fail: Dry run posts to the same endpoint, so both actions on the current page fail the same way.
- No matching fix for import: PR contextforge-web-ui#239 resolved the equivalent export failure by hiding Roots from non-admins. Import has no corresponding handling.
- Workaround will stop working: #7418 proposes rejecting any file that contains roots, regardless of selection. Excluding roots through
selected_entitieswill therefore no longer work.
Proposed changes
- When the caller is not
is_admin, remove therootslist from the parsed file before the dry run that produces the per-type counts, so the confirmation step reflects what the import will write. - State in the confirmation step that roots are excluded, so the user sees this before committing.
- Show the existing permission message only to callers who lack
admin.import, and stop using it for the roots refusal.
Acceptance criteria
- [ ] A non-admin imports an admin-exported file containing roots, and all other entity types in the file are created.
- [ ] The confirmation step states that roots are excluded, and its per-type counts match what the import writes.
- [ ] An admin importing the same file creates the roots.
- [ ] A caller without
admin.importstill sees the permission message.
Related issues
#7418, #7419, #7421