Skip to content

fix: BED-10722 unify custom organization role management capabilities - #128

Merged
jaredcatkinson merged 2 commits into
mainfrom
fix/BED-10722-unify-custom-org-role-permissions
Dec 1, 2026
Merged

jaredcatkinson merged 2 commits into
mainfrom
fix/BED-10722-unify-custom-org-role-permissions

Conversation

@jaredcatkinson

@jaredcatkinson jaredcatkinson commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Custom organization role management was represented only for custom organization roles. Derive the existing traversable GH_WriteOrganizationCustomOrgRole edge consistently for organization roles, App installations, fine-grained PATs, and classic PATs, targeting the relevant organization.

Evaluation uses the same normalized permissions_organization projection exported on role, installation, and fine-grained PAT nodes; classic PATs use an admin:org scope adapter. PATs additionally require their owner's underlying authority, resolved from collected user/team assignments and normalized role permissions, without consulting emitted capability or scope edges. Suspended installations, expired tokens, inactive classic PATs, pending requests, and unresolved owner authority receive no capability. Classic PATs are limited to recorded authorized organizations.

Schema and documentation: extend the existing edge to the additional source kinds, update organization inbound and credential outbound accordions, and remove the old raw organization-role permission emission path. Correct the relationship documentation's previous guaranteed self-escalation claim. No node or edge kinds are removed.

Validation:

  • Full suite: 1,294 tests passed after integrating current upstream main; Ruff and diff checks passed.
  • Coverage includes all principal types, owner authority, parent-team membership, organization boundaries, permission classification, expiration, inactive credentials, and pending requests.
  • Audited converted output with 10 expected edges: four organization roles, three installations, and one classic PAT targeting three organizations. No duplicate, missing, unexpected, or dangling capability edges. Fine-grained PAT paths are covered by tests.

Re-run preprocessing/conversion and import the updated schema. Recollection is needed only when required grant or assignment evidence is absent.

Ticket: BED-10722

Summary by CodeRabbit

  • New Features
    • Added a traversable relationship showing which organization roles, App installations, and personal access tokens can manage custom organization roles.
    • Capability visibility reflects the relevant permissions, token status, authorized organizations, and—where applicable—the owner’s authority.
  • Documentation
    • Updated the permission catalog and relationship guides to explain how this capability is determined and which cases do not qualify.

Derive GH_WriteOrganizationCustomOrgRole from normalized organization permission properties for roles, App installations, and fine-grained PATs, with a classic PAT admin:org scope adapter. Require PAT owner authority from collected membership and role assignments without consulting capability edges. Bound credentials by state, expiration, and organization authorization.

Schema: extend the existing traversable edge to App installations and both PAT kinds, update organization inbound and credential outbound accordions, and document permission-based evaluation. Remove the old raw org-role mapping for this capability; no node or edge kinds are removed.

Validation: 1284 tests passed; Ruff and diff checks passed. Audited graph output: 10 expected edges across organization roles, App installations, and a classic PAT, with valid endpoints and no duplicate, missing, or unexpected edges.
Preserve BED-10721 self-assignment and BED-10722 permission-based role management in schema, documentation, edge declarations, and lookup logic.

Validation: 1294 tests passed; Ruff and diff checks passed. No node or edge kinds removed.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

This change adds GH_WriteOrganizationCustomOrgRole relationships for organization roles, App installations, and PATs. It evaluates grant permissions, owner authority, token expiration, installation state, and organization authorization. Tests, schema navigation, and documentation cover the relationship and its conditions.

Changes

Custom Organization Role Management

Layer / File(s) Summary
Permission evidence and owner authorization
src/openhound_github/kinds/edges.py, src/openhound_github/models/organization_role_management.py, src/openhound_github/lookup.py, src/openhound_github/models/org_role.py
Adds shared permission checks and edge helpers. The lookup resolves a user’s organization-role permissions from default roles, direct assignments, and team ancestry.
Capability edges and validation
src/openhound_github/models/*, tests/test_organization_role_management.py, extension/schema.json
Organization roles, App installations, and both PAT types emit traversable custom-role write edges under their respective grant and authorization conditions. Tests cover grants, owner authority, credential state, and schema navigation.
Capability documentation
README.md, descriptions/edges/GH_WriteOrganizationCustomOrgRole.md, descriptions/nodes/*, extension/schema.json
Documents permission sources, owner-authority requirements, excluded states, and organization-specific access conditions. The schema descriptions and relationship diagram include the additional source types.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PersonalAccessToken
  participant organization_role_management
  participant GithubLookup
  participant OrganizationRoleInventory
  PersonalAccessToken->>organization_role_management: Check grant and expiration
  PersonalAccessToken->>organization_role_management: Check owner authority
  organization_role_management->>GithubLookup: Get organization role permissions
  GithubLookup->>OrganizationRoleInventory: Query assignments and role permissions
  OrganizationRoleInventory-->>GithubLookup: Return matching role records
  GithubLookup-->>organization_role_management: Return projected permissions
  organization_role_management-->>PersonalAccessToken: Return owner authorization
  PersonalAccessToken->>organization_role_management: Generate custom role write edge
Loading

Possibly related PRs

  • SpecterOps/openhound-github#123: Adds the permissions_organization property on OrgRole nodes, which this change uses to evaluate role permissions and owner authority.

Suggested reviewers: jonasbk, eladshamir

Merge Risk: Minimal · up to 25558

This change adds the custom organization role write relationship for roles, App installations, and PATs, with checks for grant, state, and owner authority. No actionable merge-blocking issue was found in the supplied changes. The author reports a passing test suite and an audit of the converted output.

Security architecture risk: Low · up to 25558

The change represents more existing permissions without granting new GitHub access. The main risk is misinterpretation: existing Tier Zero rules can describe a newly matched role or user as having a guaranteed escalation path, even though the relationship establishes only authority to manage custom role definitions.

Retained concerns

  • Trivial · security · observed: The unchanged Tier Zero role and user rules interpret matching edges as custom-role self-escalation. The PR makes built-in owner roles with a qualifying normalized grant eligible for that same edge, so the old explanation now applies to additional matches that do not establish the claimed escalation mechanism. This affects the interpretation of security classifications, not GitHub permissions.

View findings in the submitted review

Security review details

Security Blast Radius

  • observed — An App installation or fine-grained PAT targets its resolved organization. A classic PAT can target multiple organizations, but only those recorded as authorized and only where its resolved owner independently has the required authority.

Trust Boundaries and Controls

  • observed — A PAT's permission or scope alone is insufficient. The lookup binds owner authority to the target organization and uses direct assignments, team ancestry, or qualifying built-in membership. Missing owner or organization identity cannot satisfy the gate.
  • observed — The credential emitters reject suspended installations, expired PATs, and classic PATs not marked active before producing the capability.

Hardening Proposals

  • proposed — Align the Tier Zero rule explanations with the narrower edge contract, and state explicitly whether credential principals are intentionally outside those classifications. Keep any assertion about self-escalation separate from the role-definition write capability.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: unifying custom organization role management capabilities, under the BED-10722 ticket. The changeset extends the GH_WriteOrganizationCustomOrgRole edge to organization role…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: unifying custom organization role management capabilities, under the BED-10722 ticket. The changeset extends the GH_WriteOrganizationCustomOrgRole edge to organization roles, App installations, fine-grained PATs, and classic PATs, and it corrects the related documentation. The title covers the main change at a high level and does not mention the documentation correction or the fix's specific evaluation rules, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the roles at dawn,
Then hops where granted edges run.
The PAT must pass its owner’s test,
The app must face the right request.
No stale token joins the play,
New paths meet the schema today.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Architecture findings (1)

Advisory architecture findings (1)

  • Trivial — The unchanged Tier Zero role and user rules interpret matching edges as custom-role self-escalation. The PR makes built-in owner roles with a qualifying normalized grant eligible for that same edge, so the old explanation now applies to additional matches that do not establish the claimed escalation mechanism. This affects the interpretation of security classifications, not GitHub permissions.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d047e958-8160-45c2-836c-00763ec0f7e9
Commits

Reviewing files that changed from the base of the PR and between b8248e1 and 255589c.

Files selected for processing: 15

  • README.md
  • descriptions/edges/GH_WriteOrganizationCustomOrgRole.md
  • descriptions/nodes/GH_AppInstallation.md
  • descriptions/nodes/GH_ClassicPersonalAccessToken.md
  • descriptions/nodes/GH_OrgRole.md
  • descriptions/nodes/GH_PersonalAccessToken.md
  • extension/schema.json
  • src/openhound_github/kinds/edges.py
  • src/openhound_github/lookup.py
  • src/openhound_github/models/app_installation.py
  • src/openhound_github/models/classic_personal_access_token.py
  • src/openhound_github/models/org_role.py
  • src/openhound_github/models/organization_role_management.py
  • src/openhound_github/models/personal_access_token.py
  • tests/test_organization_role_management.py

Included review availability: This review used your included allowance. 8 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

@jaredcatkinson
jaredcatkinson merged commit a60f117 into main Dec 1, 2026
4 checks passed
@jaredcatkinson
jaredcatkinson deleted the fix/BED-10722-unify-custom-org-role-permissions branch December 1, 2026 16:01
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