You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: BED-10722 unify custom organization role management capabilities - #128
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.
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.
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.
Documents permission sources, owner-authority requirements, excluded states, and organization-specific access conditions. The schema descriptions and relationship diagram include the additional source types.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
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.
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
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.
Custom organization role management was represented only for custom organization roles. Derive the existing traversable
GH_WriteOrganizationCustomOrgRoleedge consistently for organization roles, App installations, fine-grained PATs, and classic PATs, targeting the relevant organization.Evaluation uses the same normalized
permissions_organizationprojection exported on role, installation, and fine-grained PAT nodes; classic PATs use anadmin:orgscope 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:
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