Skip to content

bug(auth): new Permission members never reach the permissions table on existing deployments, so LLC roles cannot be granted them #16295

Description

@mrveiss

Finding

Nothing re-seeds the permissions / role_permissions tables when the Permission enum grows.

  • SYSTEM_PERMISSIONS / SYSTEM_ROLES are consumed at runtime by no code path. Their only consumers are migration 062, a one-time reconcile with hardcoded lists, and autobot-infrastructure/shared/scripts/migrations/migrate_config_users.py, a setup-time script.
  • The module docstring of autobot_shared/auth/permissions.py says a new member is seen by both backends automatically on the next deploy. That holds for the code-side gates (role_has_permission, require_permission), which read ROLE_PERMISSIONS. It does not hold for the database.

Consequence. llc/services/role_permission.py:_resolve_permission looks a permission up by name in the permissions table and raises unknown permission on a miss. It deliberately does not auto-create names. So on an existing deployment, a member added after the database was seeded cannot be granted to an LLC company role.

Members affected today:

Acceptance criteria

Found while delivering #16270.

Activity

  1. mrveiss commented on Sep 11, 2026

    @mrveiss
    OwnerAuthor

    A decision is needed here, and it also settles #16327's third criterion ("is the script still needed at all?").

    What the script is, on base a12b4bf79: autobot-infrastructure/shared/scripts/migrations/migrate_config_users.py is a one-off migration of users from the YAML security_config into PostgreSQL. Nothing in the repository invokes it; its only other mention is a line in the hardcoded-values baseline. Seeding permissions and system roles is one step inside it, and that step is broken: both loops index tuples and dict keys as dicts (#16327). So today nothing seeds these tables, and nothing re-seeds them either, which is this issue.

    Options:

    1. One idempotent seed function, used by both. This is my recommendation.
    2. Fix the script's loops (bug(infra): migrate_config_users.py reads SYSTEM_PERMISSIONS and SYSTEM_ROLES as lists of dicts, so both seeding loops raise TypeError #16327), and build this issue's step separately. That's the smallest change each, but it leaves two seeders to drift apart. The script's copy was already stale unnoticed, because nothing ran it.
    3. Retire the script, and let this step do all the seeding. Only correct once no deployment still holds YAML-config users to migrate. That needs host evidence I don't have, so it's no reason to delete the script now.

    Sequencing either way: after #16298, which delivers #16270. It rewrites _build_system_permissions and edits the script's permission loop, and #16327 is blocked on it with a native edge.

  2. added
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    on Sep 11, 2026
  3. mrveiss commented on Sep 11, 2026

    @mrveiss
    OwnerAuthor

    Owner decision, 2026-09-11: seed on every update.

    Implementation waits for #16298 (#16270), which reshapes _build_system_permissions and adds the new members.

  4. removed
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    on Sep 11, 2026
  5. added this to the v0.10.0 milestone on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions